Interview Prep/SRE & Reliability/Prometheus SLIs & Recording Rules

The availability SLI panel shows `NaN` every night between 02:00 and 05:00.

BeginnerTroubleshootingPrometheus SLIs & Recording Rules
Answer

Likely causes → Zero traffic in the window: 0 / 0 is NaN in PromQL. Alerts comparing NaN > threshold are silently false.

Diagnose →

sum(rate(http_requests_total{job="checkout"}[5m]))

If it is 0 during those hours, the ratio is undefined.

Fix → For dashboards, display "no traffic" by using longer windows or wrapping with or vector(0) only for the error side. For alerting, keep NaN (no traffic means no failed users) but add a traffic-drop alert and synthetic probes so a total outage at night is still detected.

Prevent → Every SLO gets a companion traffic-drop or absent() alert, and synthetic checks for low-traffic periods.

All SRE & Reliability questions Roadmap: SRE & incident response

More on Prometheus SLIs & Recording Rules