PCA (Prometheus Certified Associate) sample exam question with answer 10
Question:
Which PromQL expression selects the sum of the http_requests_total metric over the last hour, for a specific status code label value?
- sum(http_requests_total{status_code="200"}[1h])
- sum_over_time(http_requests_total{status_code="200"}[1h])
- rate(http_requests_total{status_code="200"}[1h])
- increase(http_requests_total{status_code="200"}[1h])
Answer:
B - The sum_over_time() function selects the sum of the metric values over a specified time range.
In this case, the range is the last hour denoted by [1h], and the metric is http_requests_total filtered by a specific label value using curly braces {}.
Therefore, the correct PromQL expression is sum_over_time(http_requests_total{status_code="200"}[1h]).