Imagine that you create a histogram with 5 buckets with values: 0.5, 1, 2, 3, 5. Let’s call this histogram http_request_duration_seconds and 3 requests come in with durations 1s, 2s, 3s. Then you would see that /metrics endpoint contains:
Here we can see that: sum is 1s + 2s + 3s = 6, count is 3, because of 3 requests bucket {le=”0.5″} is 0, because none of the requests where <= 0.5 seconds
# average http_request_duration_seconds_sum / http_request_duration_seconds_count
# quantile, Which results in 1.5. histogram_quantile(0.5, rate(http_request_duration_seconds_bucket[10m])
http_request_duration_seconds{quantile="0.5"} 2 http_request_duration_seconds{quantile="0.9"} 3 http_request_duration_seconds{quantile="0.99"} 3 http_request_duration_seconds_sum 6 http_request_duration_seconds_count 3 So we can see that:
sum is 1s + 2s + 3s = 6,
count is 3, because of 3 requests.
{quantile=”0.5″} is 2, meaning 50th percentile is 2.