Interview Observability

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)).

Preparing for an interview?

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

← All Observability questions