PCA (Prometheus Certified Associate) sample exam question with answer 561
Question:
Given the histogram metric http_request_duration_seconds, which of the following queries gives the average request duration over the last five minutes?
- histogram_quantile(0.5, rate(http_request_duration_seconds_bucket[5m]))
- rate(http_request_duration_seconds_sum[5m]) / rate(http_request_duration_seconds_count[5m])
- rate(http_request_duration_seconds_bucket{le="0.5"}[5m]) / rate(http_request_duration_seconds_count[5m])
- histogram_quantile(0.5, http_request_duration_seconds_bucket)
Answer:
B - is the correct answer. More at
count-and-sum-of-observations
A - is incorrect as the histogram_quantile function cannot be used for calculating the average
C - is incorrect as we do not know if there is a histogram bucket associated with 0.5. Even if there was, this bucket would be a counter of the number of requests received with a duration of less than or equal to 0.5, it would not give the average
D - is incorrect as the histogram_quantile function cannot be used for calculating the average. Additionally, there is nothing in this query that targets the desired "last five minutes" aspect of the question