How do you calculate the average request duration during the last 5 minutes from a histogram or summary called http_request_duration_seconds?
In Prometheus, histograms and summaries expose metrics with _sum and _count suffixes to represent total accumulated values and sample counts, respectively. To compute the average request duration over a given time window (for example, 5 minutes), you divide the rate of increase of _sum by the rate of increase of _count:
text{Average duration} = frac{text{rate(http_request_duration_seconds_sum[5m])}}{text{rate(http_request_duration_seconds_count[5m])}}
Here,
http_request_duration_seconds_sum represents the total accumulated request time, and
http_request_duration_seconds_count represents the number of requests observed.
By dividing these rates, you obtain the average request duration per request over the specified time range.
Extracted and verified from Prometheus documentation -- Querying Histograms and Summaries, PromQL Rate Function, and Metric Naming Conventions sections.
Lizette
1 day agoMichal
6 days agoChristoper
11 days agoMicaela
17 days agoLeonardo
22 days agoCrissy
27 days agoWhitney
1 month agoAlease
1 month agoTrina
1 month agoLauran
2 months agoJaclyn
2 months agoIn
2 months agoClare
2 months agoSkye
2 months agoSalina
2 months agoShawna
3 months agoTrina
3 months ago