PCA (Prometheus Certified Associate) sample exam question with answer 111
Let http_requests_total be a counter metric representing the number of requests that have hit a given type of web server. Assume there are multiple instances of this type of server. Let this metric have a label called status_code where the values are HTTP status codes (200, 201, 404, 503, etc).
Which of the following queries yields the per-minute rate of requests broken down by status code?
- rate(http_requests_total[1m])
- sum by (instance) (rate(http_requests_total[1m]))
- sum by (status_code) (rate(http_requests_total[1m])) * 60
- sum by (status_code) (rate(http_requests_total[1m]))
Answer:
D - is the correct answer.
A - this query does not aggregate by status code.
B - this query aggregates by instance, not status code.
C - this query yields the per-second rate as provided by the rate function. To get the per-minute rate, you must multiply the result by 60 (60 seconds in a minute)