PCA (Prometheus Certified Associate) sample exam question with answer 490

Question:
Which of the following is a correct PromQL query to get the top 5 endpoints with the highest average response time over the last hour?

  1. topk(5, avg(http_request_duration_seconds)[1h] by (endpoint))
  2. avg(http_request_duration_seconds) > topk(5)[1h] by (endpoint)
  3. sum_over_time(http_request_duration_seconds)[1h] > topk(5) by (endpoint)
  4. max_over_time(avg(http_request_duration_seconds)[1h]) > topk(5) by (endpoint)
Answer:
A - is correct answer. To get the top 5 endpoints with the highest average response time over the last hour, we need to use the topk function to select the top 5 endpoints with the highest average response time over the last hour