简体   繁体   English

Prometheus 对 Grafana 的平均响应时间

[英]Average response time on Grafana from Prometheus

I am trying to find the average response time of all the URLs in Grafana,我试图找到 Grafana 中所有 URL 的平均响应时间,

The below query not returning any data, what am I doing wrong here?下面的查询没有返回任何数据,我在这里做错了什么?

    avg by (uri) (rate(http_server_requests_seconds_sum{app_name="$app",
                  namespace="$namespace", uri!~".*actuator.*|/health|root"}[1m]) 
   /rate(http_server_requests_seconds_count{app_name="$app",
                  namespace="$namespace", uri!~".*actuator.*|/health|root"}[1m]))

The data is collected via a micrometer.数据通过千分尺收集。

If you want to get the average then you should divide the _sum by the _count counter.如果你想得到平均值,那么你应该将 _sum 除以 _count 计数器。 If your labels are ok, then you will get data(if there any) by below PromQL.如果您的标签没问题,那么您将通过 PromQL 下方获取数据(如果有)。

sum by (uri) (rate(http_server_requests_seconds_sum{app_name="$app", 
            namespace="$namespace", uri!~".*actuator.*|/health|root"}[1m])) 
/ sum by (uri) (rate(http_server_requests_seconds_count{app_name="$app",
            namespace="$namespace", uri!~".*actuator.*|/health|root"}[1m]))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM