-
Notifications
You must be signed in to change notification settings - Fork 961
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
@Timed: histogram buckets have a too high cadinality #1947
Comments
@adericbourg You can control the buckets added by
Even more of a shortcut, Spring boot has property-driven configuration for setting minimum and maximum expected values: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#per-meter-properties Also, there is no need to use In general we try to discourage fine grained control of histogram buckets because experience has shown that folks tend to select buckets leading to high-error-bound percentile approximations (and the true error bound is in fact unknowable from the discretized distribution, so they never really know). Technically |
Thanks a lot for that answer: it is very helpful! I agree that tuning histogram may cause "bad" approximations and I don't mean to fight against it. A complete solution could be:
Anyhow, setting SLA manually and disabling |
This temptation is actually precisely why we removed (obvious) configurability. It's just too easy to say "hey it's publishing 100 buckets right now, can we turn that down to 50 buckets?" But the impact on percentile approximation is unknowable. Narrowing min/max (provided your timings don't go outside of that range) doesn't affect the approximation's accuracy. There are other options for selecting bucket functions. Somebody once suggested the E series for example, though it was based on an argument about the readability of buckets and not performance. Happy to take PRs with other bucketing functions if you discover one that demonstrates a decent error bound. Maybe adding more dynamism to buckets, such as was done recently for VictoriaMetrics histograms, is a good path forward. |
@jkschneider Hi thanks for the explanation - now I see why spring does not allow me to set the buckets explicitly, but only allow to set min/max. However, I see people recommending that, prometheus should not have too high cardinality, e.g. only 10 buckets should be used. What do you think about it, and how do you solve it in your production environment? Thanks |
TL;DR management:
metrics:
distribution:
slo:
http.server.requests:
- 100ms
- 500ms
- 1s
- 2s |
Using
@Timed
annotation does not allow to control buckets for a timer (like thesla()
method would on a timer builder).This results in having many buckets.
Example (with a Prometheus registry):
As a library user:
Currently, using buckets or not is enabled (if I read well) by the
histogram
attribute of@Timed
annotation.I don't see a "good" option right now:
sla
property) could bring confusion as it would conflict withhistogram
histogram
bysla
would break the APIWhat do you think?
The text was updated successfully, but these errors were encountered: