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

Question:
You are creating an exporter that exposes Prometheus metrics from your fitness tracking app.
Which metric type would be BEST for a metric that counts the number of nights you have slept less than or equal to 1 hour, 2 hours, 3 hours, ..., 12 hours?

  1. Counter
  2. Gauge
  3. Histogram
  4. Summary
Answer:
C - Correct, a histogram metric does expose user-defined buckets and thus is perfect for this use case
A - is incorrect as this scenario actually requires multiple counters, one for each "bucket" of hours of sleep less than a certain number of hours
B - is incorrect as this scenario does not require tracking a value that can go arbitrarily up or down. Instead it requires the use of several bucketed counters for each hour of sleep
D - Though a summary is similar to a histogram in that it samples observations, the question establishes clearly defined buckets as hours of sleep. As summary metrics calculate quantiles on the client side and do not expose bucketed values, a summary does not quite fit the scenario