histogram_quantile()
The PromQL function that estimates a percentile from a histogram's cumulative buckets.
In more detail
It finds the bucket holding the requested rank and interpolates inside it. The usual shape is to rate each bucket over one window, sum by the identifying labels while keeping le, and pass the result in. The answer is in the metric's unit, usually seconds.
Example
histogram_quantile(0.99, sum by (le, route) (rate(http_request_duration_seconds_bucket[5m])))Related terms
- histogram — A metric that counts measurements, such as request durations, into ranges of values so their distribution and percentiles can be calculated.
- histogram bucket — One counter inside a histogram that counts every observation at or below its upper boundary.
- le label — The label on a histogram bucket that holds its upper boundary; le stands for "less than or equal to".
- percentile — The value below which a given percentage of measurements fall; p99 latency is the time 99 in 100 requests beat.
- linear interpolation — Estimating a value between two known points by assuming the values in between are spread evenly.
Taught in
- Why A Histogram Beats An Average — Full-Stack Observability: Metrics, Tracing & Logging
- Calculating Percentiles With histogram_quantile — Full-Stack Observability: Metrics, Tracing & Logging