Interview Prep/Monitoring & Observability/Prometheus and PromQL at Scale

Your dashboard shows the average of per-pod p99 latencies. Why is it wrong, and how do you compute a correct fleet-wide p99?

IntermediateScenarioPrometheus and PromQL at Scale
Answer

Situation read → Percentiles cannot be averaged. A p99 of 50 ms on one pod and 2 s on another does not average to anything meaningful.

What I'd do → Aggregate histogram buckets first, then compute the quantile:

histogram_quantile(0.99,
  sum by (le, service) (rate(http_request_duration_seconds_bucket[5m])))
  1. Always keep le in the by clause.
  2. Do not use summary quantiles for cross-instance aggregation, since they are pre-computed per instance.
  3. Make a recording rule for the expression for faster dashboards.

Why → Histogram buckets are counters and are additive across instances, so summing them gives the correct combined distribution.

Interview tip → "Summaries can't be aggregated; histograms can." Say it clearly.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Prometheus and PromQL at Scale