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

Question:
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, etc).
Which of the following queries yields the per-minute rate of requests broken down by status code?

  1. rate(http_requests_total[1m]) by (status_code)
  2. sum by (status_code) (rate(http_requests_total[5m])) * 60
  3. sum on (status_code) (rate(http_requests_total[5m])) * 60
  4. sum by (status_code) (rate(http_requests_total[5m]))
Answer:
B - is the correct answer
A - is incorrect as this query does not aggregate by status code as indicated in the question
C - is incorrect as this query uses the on keyword in place of by. The on keyword is used for vector matching in PromQL while by is used to specify the labels to aggregate by in a dimensional aggregation
D - is incorrect as this query gives the per-second rate. The question asks for the per-minute rate which can be calculated by multiplying the result by 60 (60 seconds in a minute)