http_request_duration_seconds_sum/http_request_duration_seconds_count显示2个图表 [英] http_request_duration_seconds_sum / http_request_duration_seconds_count shows 2 graphs

查看:1104
本文介绍了http_request_duration_seconds_sum/http_request_duration_seconds_count显示2个图表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Grafana仪表板,尝试在其中绘制一些普罗米修斯指标.

我正在尝试使用以下公式计算两个端点的平均响应时间:

http_request_duration_seconds_sum / http_request_duration_seconds_count

但是当将查询绘制到Grafana图形面板中时,我得到4个图形(每个2个),而不是只有2个,我不理解.

谁能告诉我,为什么有4条曲线而不是2条? 顶部的两个来自相同的查询,同样地,两个按钮也来自相同的查询.

更新

正在添加

sum(rate(http_request_duration_sum))[24h] / sum(rate(http_request_duration_count))[24h] 

答案?这给了我2条曲线而不是4条曲线,但是不确定结果是否是我想要的(端点的平均响应时间).

解决方案

我发现以下查询:

sum(rate(http_request_duration_sum))[24h] / sum(rate(http_request_duration_count))[24h] 

我正在寻找

答案,它以秒为单位给出了平均响应时间,并且只有1条曲线pr查询.

当然 scrape_interval应该是24小时,因此我将其设置为[1m]. <-根据此 SO-answer

I have a Grafana dashboard, where I try to plot some of the prometheus metrics.

I am trying to calculate the average response time for 2 endpoints using the formula:

http_request_duration_seconds_sum / http_request_duration_seconds_count

but when plotting the query into the Grafana graph panel, I get 4 graphs (2 for each) instead of only 2, which I don't understand.

Can anyone tell me, why there are 4 curves instead of 2? The two on the top are from the same query and likewise for the two in the buttom.

UPDATE

Is adding

sum(rate(http_request_duration_sum))[24h] / sum(rate(http_request_duration_count))[24h] 

the answer? That gives me 2 curves instead of 4, but not sure if the result is what I am looking for (being the average response time for the endpoint).

解决方案

I found out that the following query:

sum(rate(http_request_duration_sum))[24h] / sum(rate(http_request_duration_count))[24h] 

is the answer, I am looking for, giving me the average response time in seconds and only 1 curve pr query.

Of course the scrape_interval should not be 24h, so I've set it to [1m] instead. <- this according to this SO-answer

这篇关于http_request_duration_seconds_sum/http_request_duration_seconds_count显示2个图表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆