问题描述
直方图(和摘要)时间序列吸引了我普罗米修斯,但我一直无法以promdash或grafana显示直方图.我期望能够显示:
I'm attracted to prometheus by the histogram (and summaries) time-series, but I've been unsuccessful to display a histogram in either promdash or grafana. What I expect is to be able to show:
- 在某个时间点的直方图,例如X轴上的存储区和Y轴上的存储区的计数以及每个存储区的一列
- 桶的堆叠图,以使每个桶都被着色,并且堆叠的总数等于inf桶
- a histogram at a point in time, e.g. the buckets on the X axis and the count for the bucket on the Y axis and a column for each bucket
- a stacked graph of the buckets such that each bucket is shaded and the total of the stack equals the inf bucket
一个示例指标将是HTTP服务器的响应时间.
A sample metric would be the response time of an HTTP server.
推荐答案
Grafana v5 +为将Prometheus直方图表示为热图提供了直接支持. http://docs.grafana.org/features/panels/heatmap /#histograms-and-buckets
Grafana v5+ provides direct support for representing Prometheus histograms as heatmap.http://docs.grafana.org/features/panels/heatmap/#histograms-and-buckets
与直方图相比,首选热图,因为直方图无法向您显示趋势如何随时间变化.因此,如果您有时间序列直方图,请使用热图面板对其进行描绘.
Heatmaps are preferred over histogram because a histogram does not show you how the trend changes over time. So if you have a time-series histogram, then use the heatmap panel to picture it.
为使您入门,下面是一个示例(用于Prometheus数据):
To get you started, here is an example (for Prometheus data):
假设您的直方图如下所示,
Suppose you've a histogram as follows,
http_request_duration_seconds_bucket(le=0.2) 1,
http_request_duration_seconds_bucket(le=0.5) 2,
http_request_duration_seconds_bucket(le=1.0) 2,
http_request_duration_seconds_bucket(le=+inf) 5
http_request_duration_seconds_count 5
http_request_duration_seconds_sum 3.07
您可以使用查询sum(increase(http_request_duration_seconds_bucket[10m])) by (le)
将直方图数据显示为热图,并确保将格式设置为热图".图例格式为{{ le }}
,并将面板设置中的可视化设置为热图".
You can picture this histogram data as a heatmap by using the query: sum(increase(http_request_duration_seconds_bucket[10m])) by (le)
, making sure to set the format as "heatmap," the legend format as {{ le }}
, and setting the visualization in the panel settings to "heatmap."
这篇关于如何使用Promdash或Grafana可视化直方图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!