5

I'm trying to figure out the calculation behind

histogram_quantile(0.9, rate(http_request_duration_seconds_bucket[10m]))

Based on https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_quantile, the above expression calculates the 90th percentile of request durations over the last 10m.

As I understand, http_request_duration_seconds_bucket is an array of buckets with le and counts. le specifies the bucket boundaries.

What's the calculation behind rate(http_request_duration_seconds_bucket[10m]) then, does it calculate the increase of counts in each bucket per second?

Based on the expression, above, histogram_quantile(0.9, rate(...)), the rate(...) part is like a cumulative density distribution (CDF).

Do I understand correctly?

zyxue
  • 7,904
  • 5
  • 48
  • 74

1 Answers1

0

What's the calculation behind rate(http_request_duration_seconds_bucket[10m]) then, does it calculate the increase of counts in each bucket per second?

As explained by this post, rate applied on buckets here calculates a set of rate of increments that happened on all the buckets in the span of the last 10 minutes. So, to answer your question, it is a cumulative density distribution on the rate of changes calculated in a given time frame.

The histogram_quantile function then uses this data to compute quantiles/percentiles.

aaruja
  • 371
  • 2
  • 12