PromQL 中 histogram_quantile(0.9, rate(http_request_duration_seconds_bucket[10m])) 背后的数学原理是什么 [英] what's the math behind histogram_quantile(0.9, rate(http_request_duration_seconds_bucket[10m])) in PromQL
问题描述
我想弄清楚背后的计算
histogram_quantile(0.9, rate(http_request_duration_seconds_bucket[10m]))
基于 https://prometheus.io/docs/prometheus/latest/querying/functions/#histogram_quantile,上面的表达式计算了过去 10m 中请求持续时间的第 90 个百分位.
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.
据我所知,http_request_duration_seconds_bucket
是一个带有 le
和计数的桶数组.le
指定桶边界.
As I understand, http_request_duration_seconds_bucket
is an array of buckets with le
and counts. le
specifies the bucket boundaries.
rate(http_request_duration_seconds_bucket[10m])
背后的计算是什么,那么,它是计算每桶每秒的计数增加吗?
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?
根据上面的表达式,histogram_quantile(0.9, rate(...))
,rate(...)
部分就像一个累积密度分布(CDF).
Based on the expression, above, histogram_quantile(0.9, rate(...))
, the rate(...)
part is like a cumulative density distribution (CDF).
我理解正确吗?
推荐答案
rate(http_request_duration_seconds_bucket[10m]) 后面的计算是什么,它是计算每桶每秒的计数增加吗?
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?
正如这篇帖子所解释的,应用在桶上的rate
在这里计算一组rate of increment
s 在过去 10 分钟内发生在所有存储桶上.因此,为了回答您的问题,它是在给定时间范围内计算的变化率的累积密度分布
.
As explained by this post, rate
applied on buckets here calculates a set of rate of increment
s 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.
histogram_quantile
函数然后使用这些数据来计算分位数/百分位数.
The histogram_quantile
function then uses this data to compute quantiles/percentiles.
这篇关于PromQL 中 histogram_quantile(0.9, rate(http_request_duration_seconds_bucket[10m])) 背后的数学原理是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!