gpt4 book ai didi

histogram - 基于Prometheus中的速率了解histogram_quantile

转载 作者:行者123 更新时间:2023-12-02 11:18:52 52 4
gpt4 key购买 nike

根据Prometheus文档,为了使用直方图度量具有95%的百分位数,我可以使用以下查询:

histogram_quantile(0.95, sum(rate(http_request_duration_seconds_bucket[5m])) by (le))

资料来源: https://prometheus.io/docs/practices/histograms/#quantiles

由于每个直方图桶都是一个计数器,我们可以将每个桶的速率计算为:

per-second average rate of increase of the time series in the range vector.



另请: https://prometheus.io/docs/prometheus/latest/querying/functions/#rate

因此,例如,如果存储桶值[t-5m] = 100且存储桶值[t] = 200,则存储桶率[t] =(200-100)/(10 * 60)= 0.167

最后,最令人困惑的部分是,对于已知度量值的给定指标,直方图量化函数如何找到第95个百分位数?

有什么代码或算法可以让我更好地理解吗?

最佳答案

我相信this是普罗米修斯的代码
一般的想法是,您可以使用存储桶中的数据来推断/近似分位数
Elasticsearch的汇总功能还does something similar(但有所不同/简单得多)

关于histogram - 基于Prometheus中的速率了解histogram_quantile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55162093/

52 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com