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

A 1m-window recording rule returns empty results intermittently. Scrape interval is 30s.

IntermediateTroubleshootingPrometheus SLIs & Recording Rules
Answer

Likely causes → rate() needs at least two samples in the window. With a 30s scrape interval and a 1m window, any missed or delayed scrape leaves only one sample.

Diagnose →

count_over_time(http_requests_total{job="checkout"}[1m])

Fix → Use windows of at least 4x the scrape interval (2m for 30s scrapes); that is why the shortest SLO window is usually 5m. In Grafana use $__rate_interval.

Prevent → Lint recording rules for windows shorter than 4x scrape interval.

All SRE & Reliability questions Roadmap: SRE & incident response

More on Prometheus SLIs & Recording Rules