Interview Prep/Monitoring & Observability/PromQL and recording rules

`histogram_quantile` returns `NaN`

IntermediateTroubleshootingPromQL and recording rules
Answer

Likely causes → No requests in the window (all bucket rates are 0), so the quantile is undefined.

Diagnose → sum(rate(http_request_duration_seconds_count[5m])) is 0.

Fix → Accept it as "no traffic", or filter: ... and sum(rate(..._count[5m])) > 0. In Grafana, set the panel to show NaN as null/gap.

Prevent → Alerts on latency should be combined with a minimum traffic condition.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on PromQL and recording rules