PCA (Prometheus Certified Associate) sample exam question with answer 601
Question:
Suppose you have a counter metric requests_total that counts the number of HTTP requests to your service. Which of the following PromQL expressions can be used to calculate the percentage of requests that returned a 500 error over the past 10 minutes?
- sum(increase(requests_total{status="500"}[10m])) / sum(increase(requests_total[10m]))
- rate(requests_total{status="500"}[10m]) / rate(requests_total[10m])
- sum_over_time(requests_total{status="500"}[10m]) / sum_over_time(requests_total[10m])
- count_over_time(requests_total{status="500"}[10m]) / count_over_time(requests_total[10m])
Answer:
A - is the correct answer. This expression first calculates the increase in the requests_total counter over the past 10 minutes that had a status label equal to "500" using the increase() function. It then divides that sum by the total increase in the requests_total counter over the past 10 minutes to get the percentage of requests that had a "500" status