Quiz: Prometheus¶
5 questions
L1 (3 questions)¶
1. What is the difference between a counter and a gauge in Prometheus?
Show answer
Counter only goes up (e.g., total requests). Gauge goes up and down (e.g., current memory). Use rate() on counters; use gauge values directly.2. What is a histogram and when do you use one?
Show answer
Histogram buckets count observations by value range. Use for latency (p50/p95/p99). Query with histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m])).3. What is the difference between rate() and irate() in PromQL?
Show answer
rate() calculates per-second average increase over the full range vector (e.g., rate(http_requests_total[5m]) averages over 5 minutes). irate() uses only the last two data points for an instantaneous rate. rate() is smoother and better for alerting. irate() is spikier and better for dashboards where you want to see sudden changes. Never use irate() for alerting — it is too volatile.L2 (2 questions)¶
1. Prometheus shows a target as DOWN. How do you troubleshoot?
Show answer
1. Check ServiceMonitor selector matches service labels.2. Verify the metrics endpoint is reachable (curl pod-ip:port/metrics).
3. Check Prometheus config (Status > Targets).
4. Check network policies blocking scrape traffic.
2. Write a PromQL query to find the top 5 pods by CPU usage.