Observability for developers · Concept
Counter, gauge, histogram or summary
Practise this out loud
Say your answer out loud to an AI interviewer that follows up, and get a score for it.
Practise by voiceThe interviewer asks
Explain Prometheus's four metric types with one example each from an orders service. For request latency, which one would you use, and why not just record the average?
Then
Follow-ups the interviewer asks next
- Why do you almost always wrap a counter in
rate()? - What happens to a counter when the pod restarts?
- Why can't you average the p99s of ten pods?
- How do you choose histogram buckets?
- What are native histograms, and are they ready to use?
- Which OpenTelemetry instruments match these?
The answer
What a strong answer covers
- Counter: only goes up, and resets to 0 on restart (
http_requests_total,orders_placed_total). Query it withrate()orincrease(), which handle resets. - Gauge: goes up and down (
orders_in_queue,db_pool_connections_in_use, memory). Query the value,avg_over_timeormax_over_time; neverrate(). - Histogram: counts observations into buckets (
_bucket{le="0.5"}) plus_sumand_count. Percentiles come fromhistogram_quantile(0.99, sum by (le) (rate(..._bucket[5m]))), and buckets from many pods can be added first. - Summary: the client computes quantiles itself; exact per pod and cheap, but quantiles can't be combined across pods, and they're fixed at instrumentation time. Prometheus's docs prefer histograms.
- Averages hide the slow tail: an average of 120 ms can hide 3% of requests at 4 s. Use percentiles from histograms, and an SLO such as "share of requests under 500 ms".
- Buckets: around the SLO threshold and the expected range, in seconds (base units).
- Native histograms: buckets chosen automatically on an exponential scale, much cheaper per series; stable since Prometheus 3.8 (late 2025) but opt-in per scrape (
scrape_native_histograms), and client support varies by language. Prometheus was at 3.16 in November 2026. - OpenTelemetry has Counter, UpDownCounter, Gauge and Histogram; its exponential histograms map to native histograms.
The red pen
Common traps
Avoid:rate() on a gauge; averaging quantiles; observing milliseconds into a metric named in seconds.
Practise this out loud
Say your answer out loud to an AI interviewer that follows up, and get a score for it.
Practise by voicePractise questions like this out loud
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.