How does `histogram_quantile()` work?

IntermediateConceptPromQL & Recording Rules
Answer

It estimates a quantile from cumulative bucket counters by finding the bucket where the rank falls and linearly interpolating within it.

histogram_quantile(0.95,
  sum by (le, service) (rate(http_request_duration_seconds_bucket[5m])))

Always keep le in the by clause and rate() the buckets first. Accuracy depends on bucket boundaries: if all requests are between 0.5 and 1 s and you only have those two buckets, p95 is a guess within that range.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on PromQL & Recording Rules