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 the difference between rate() and irate()? [Basic]
- What is a recording rule, and when would you use one? [Basic]
- What is PromQL, and what is an instant vector versus a range vector? [Basic]
- What is an alerting rule, and how does it differ from a recording rule? [Basic]
- What is the Pushgateway, and why is it discouraged for most cases? [Basic]
- What is the difference between an exporter and instrumenting your app directly? [Basic]
- What is a scrape target, and how does service discovery find them? [Basic]
- How does Prometheus handle high cardinality, and why is it a problem? [Intermediate]