Reputation: 2396
I am trying to find the average response time of all the URLs in Grafana,
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.
Upvotes: 7
Views: 22500
Reputation: 1255
If you want to get the average then you should divide the _sum by the _count counter. If your labels are ok, then you will get data(if there any) by below 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]))
Upvotes: 18