How do you compute a 95th percentile latency from a histogram in PromQL (histogram_quantile)? [Basic]
Answer
To compute p95 latency from a Prometheus histogram, apply rate() to the _bucket series, aggregate by le and the dimensions you want, then pass that to histogram_quantile(0.95, ...).
Technical explanation
The le label defines bucket boundaries and must be preserved until histogram_quantile runs.
For fleet-level latency, sum bucket rates across instances before calculating the quantile.
Bucket design controls accuracy; include buckets around your SLO thresholds.
Hands-on example
PromQL: histogram_quantile(0.95, sum(rate(http_request_duration_seconds_bucket{service='checkout'}[5m])) by (le)). For p95 by route: histogram_quantile(0.95, sum(rate(http_request_duration_seconds_bucket[5m])) by (le, route)).
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]