prometheus / prometheus/client_js
Negative observations
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 3.5k
- Forks
- 429
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 22
Description
Hi,
I was assuming that histogram metric can handle negative observations, but it appears that it fails to do so and I haven't found any mention of this neither in this repository, nor in official description of Prometheus metrics. In fact, the latter explicitly states that negative observations are possible:
In principle, however, you can use summaries and histograms to observe negative values (e.g. temperatures in centigrade).
In my use case, being able to observe negative metrics is critical, so unfortunately I have to resort to the custom implementation of histogram metric.
On the other notice, the limitation seems to be relatively easy to eliminate - values that don't fall into last bucket could be handled separately.
Maybe you could consider extending implementation to support negative observations as well? Or are there any other reasons (e.g. compatibility) that prevent us from doing so? I would be happy to provide a PR myself.
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 locating the histogram implementation and its existing tests, then trace how observations outside the last bucket are handled. The issue is complete when negative observations work correctly, relevant histogram tests cover them, and any compatibility or documentation implications are addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100