What are the Prometheus metric types (counter, gauge, histogram, summary)? [Basic]
Answer
The main Prometheus metric types are counter, gauge, histogram, and summary. Counters only increase, gauges go up and down, histograms bucket observations, and summaries calculate quantiles on the client side.
Technical explanation
Counters fit totals such as requests, errors, retries, and bytes processed.
Gauges fit current values such as memory usage, queue depth, in-flight requests, and temperature.
Histograms and summaries are used for distributions such as latency or payload size, with histograms generally preferred when server-side aggregation is needed.
Hands-on example
Instrumentation example: create http_requests_total as a counter, in_flight_requests as a gauge, and http_request_duration_seconds as a histogram with buckets matching SLO thresholds such as 0.1, 0.25, 0.5, 1, and 2.5 seconds.
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 a time series in Prometheus, and how is it identified (metric name plus labels)? [Basic]
- What is the difference between a counter and a gauge? [Basic]
- How does Prometheus collect metrics — what is the pull model and scraping? [Basic]
- What is the difference between a symptom-based and a cause-based alert, and which is better? [Basic]
- What is a scrape target, and how does service discovery find them? [Basic]
- Why are multi-window, multi-burn-rate alerts better than a single threshold? [Basic]
- What is a burn rate, and how do you alert on it? [Basic]
- What is the difference between an exporter and instrumenting your app directly? [Basic]