-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weighted histogram #155
Weighted histogram #155
Conversation
@deadtrickster , could you approve this one? It is a very useful patch. |
surprised by Value*Weight - Value expected to be averaged by caller or observe/n called as soon as Value changes? Weight means exact measurements count? Weights are confusing to me because of neural networks and other math stuff. Could it be Count? Why not to call existing observe on each observation? |
It may be averaged, or it may be instant. My case is second one. Anyway, the value is still used to calculate the bucket. Disregarding the weight.
I don't care of the naming. It could be named
Because to keep the intention, I would have to call |
In prometheus histograms have counts, not weights. ok, now it's more clear that you have just single event that comes with value and count. |
61c5dff
to
488b73f
Compare
Renamed weights to counts, fixed the doc. |
Great! I think commits must be signed |
Is this your requirement? I've never signed my commits before. I don't even have a GPG/PGP or other signature. Why is this important? |
It's a requirement for this repo, yes. I think it was made so on request of somebody wanting to use in their org. Years ago |
This expected to help in collecting weighted histograms, when we need to update bucket adding given positive integer number (aka wight or count)
- add support to non-integer values - count the sum correctly (with weights) - add test cases - adjust documentation
488b73f
to
3497e2a
Compare
Commits signed. |
❤️ |
The
prometheus_histogram:observe_n/3,4,5
adds limited support for the weighted histograms. It accepts the extra argument "Weight" which is limited to integer numbers to fit existing bucket counters data type. It may be, for example, the number of time ticks when the recent value was observed, allowing for better accuracy when measurements are irregular.In general, the weight could be any number, but this is difficult to implement since the overall Prometheus histogram model is based on the bucket counters concept, where the counters are expected to be non-negative integers. That's why the new function is limited to integer weights only, which is still useful in many applications.