[英]Is it possible to find max. value from a Histogram
Using grafana-agent to scrape the metrics from my application.使用 grafana-agent 从我的应用程序中抓取指标。 I wonder if it's possible to gather max.
我想知道是否有可能收集最大。 value within a histogram by using PromQL.
使用 PromQL 计算直方图中的值。 I have been publishing execution time metrics in an Histogram from my application, but I would like to also get the max.
我一直在我的应用程序的直方图中发布执行时间指标,但我也想获得最大值。 value like max.
值如最大值。 execution time within/per minute.
执行时间以内/每分钟。 I wonder if this is possible by Histogram and PromQL or should I consider a customized solution for that?
我想知道这是否可以通过直方图和 PromQL 实现,或者我应该考虑为此定制解决方案吗?
Thanks,谢谢,
You can use the following query for obtaining the estimated maximum value from histogram metric with the name foo
over the last hour:您可以使用以下查询从名称为
foo
的直方图指标中获取过去一小时内的估计最大值:
histogram_quantile(1, increase(foo_bucket[1h]))
Note that the _bucket
suffix is added to the foo
histogram name in the query.请注意,
_bucket
后缀添加到查询中的foo
直方图名称。
This query uses the histogram_quantile function for calculating the estimated maximum value seen during the last hour (see 1h
in square brackets in the query above).此查询使用histogram_quantile function 来计算过去一小时内看到的估计最大值(请参阅上面查询中方括号中的
1h
)。 The estimation error can be quite big if the maximum observed value is located too far from the configured histogram bucket bounds.如果最大观测值距离配置的直方图桶边界太远,估计误差可能会很大。 See this article for details and possible solutions on how to reduce the estimation error.
有关如何减少估计误差的详细信息和可能的解决方案,请参阅本文。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.