PCA (Prometheus Certified Associate) sample exam question with answer 496
Question:
Which of the following is a correct PromQL query to get the average response time for HTTP GET requests to the /api/v1 endpoint for the last 5 minutes?
- avg(http_request_duration_seconds{method="GET", endpoint="/api/v1"})[5m]
- sum(http_request_duration_seconds{method="GET", endpoint="/api/v1"}) / count(http_request_duration_seconds{method="GET", endpoint="/api/v1"})[5m]
- avg_over_time(http_request_duration_seconds{method="GET", endpoint="/api/v1"}[5m])
- rate(http_request_duration_seconds{method="GET", endpoint="/api/v1"})[5m]
Answer:
A - is correct answer. To get the average response time for HTTP GET requests to the /api/v1 endpoint for the last 5 minutes, we need to use the avg function to calculate the average of all the individual values of http_request_duration_seconds over the last 5 minutes