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

Errors clearly appear in the logs, but the SLI shows zero 5xx for low-traffic routes.

AdvancedTroubleshootingPrometheus SLIs & Recording Rules
Answer

Likely causes → Labeled counters are created lazily: the code="500" series appears only at the first error. rate() needs at least two samples, so the first increment of a new series is invisible, and on low-traffic routes most errors are "first errors" after each pod restart.

Diagnose →

http_requests_total{job="checkout",code="500"}

Check whether the series appears only after errors and with value 1.

Fix → Pre-initialize expected label combinations at startup (for example REQS.labels(route, "500") in Python, or .WithLabelValues(...) in Go), so the series exists at 0 before any error.

Prevent → Make counter initialization part of the instrumentation library and the service template.

All SRE & Reliability questions Roadmap: SRE & incident response

More on Prometheus SLIs & Recording Rules