prometheus / prometheus/client_js
Initialize metrics with labels to 0
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 3.5k
- Forks
- 429
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 22
Description
In https://github.com/siimon/prom-client/pull/139 metrics without labels are initialized to 0 when created. Would it be possible to have a function that can initialize metrics with labels to 0 for a known set of label values? Something like:
const summary = new promClient.Summary({
name: 'http_request_duration_seconds',
labelNames: labels
});
summary.init({"response_status": "success"});
summary.init({"response_status": "error"});
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the Summary metric implementation and pull request 139, which established initialization for metrics without labels. Trace how label values are currently created, then define the expected behavior for init({"response_status":"success"}) and init({"response_status":"error"}) and add coverage showing those labeled series start at 0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- observability-sre
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100