A. rate(http_request_duration_seconds_sum[5m]) / rate(http_request_duration_seconds_count[5m])
B. rate(http_request_duration_seconds_total[5m]) / rate(http_request_duration_second$_count[5m])
C. rate(http_request_duration_seconds_total[5m]) / rate(http_request_duration_seconds_average[5m])
D. rate(http_request_duration_seconds_sum[5m]) / rate(http_request_duration_seconds_average[5m])
Explanation:
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_seco nds_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.
Reference: Extracted and verified from Prometheus documentation C Querying Histograms and Summaries, PromQL Rate Function, and Metric Naming Conventions sections.