What is the difference between a counter and a gauge? [Basic]
Answer
A counter represents a cumulative value that only increases except when the process restarts. A gauge represents a current value that can go up or down.
Technical explanation
Use rate() or increase() on counters to calculate activity over time.
Use gauges directly or with avg_over_time, max_over_time, or min_over_time depending on the question.
Using a gauge for request totals or a counter for queue depth creates misleading dashboards and alerts.
Hands-on example
Example: http_requests_total is a counter, so query rate(http_requests_total[5m]). queue_depth is a gauge, so query max_over_time(queue_depth[10m]) or avg(queue_depth) by (queue). Do not apply rate() to queue_depth unless it explicitly represents a cumulative total.
Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.
More Observability interview questions
- What is observability, and how is it different from traditional monitoring? [Basic]
- What are the three pillars of observability (metrics, logs, traces)? [Basic]
- What is the difference between monitoring and observability in practice? [Basic]
- What are the four golden signals of monitoring? [Basic]
- What is the difference between the USE method and the RED method? [Basic]
- When would you use the USE method versus the RED method? [Basic]
- What is an SLI, an SLO, and an SLA, and how do they relate? [Basic]
- How do you choose good SLIs for a service? [Basic]