Error ratio query returns no data during quiet hours
IntermediateTroubleshootingPromQL and recording rules
Answer
Likely causes → When there are no errors, the status=~"5.." series do not exist yet, so the numerator is empty and the division returns nothing.
Diagnose → Run numerator and denominator separately.
Fix →
(sum(rate(http_requests_total{status=~"5.."}[5m])) or vector(0))
/
sum(rate(http_requests_total[5m]))
Or initialise counters for known status classes in code.
Prevent → Pre-initialise label combinations you alert on.
More on PromQL and recording rules
A PromQL query in the UI returns `Empty query result` for a metric you can see on `/metrics`Beginner`rate(http_requests_total[1m])` returns nothing but `http_requests_total` has dataBeginner`rate()` applied to a gauge shows huge spikesBeginnerBinary operation fails: `many-to-many matching not allowed: matching labels must be unique on one side`Advanced`found duplicate series for the match group {pod="api-1"} on the right hand-side of the operation`Intermediate`histogram_quantile` returns `NaN`Intermediate