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

Your per-route SLI query fails with `found duplicate series for the match group {route="/api/checkout"} on the right hand-side of the operation`.

IntermediateTroubleshootingPrometheus SLIs & Recording Rules
Answer

Likely causes → Division with one-to-one matching where the right side has several series per route (for example still split by instance or code) because it was not aggregated to the same labels as the left side.

Diagnose → Run each side alone and compare the label sets:

sum by (route) (rate(http_requests_total{job="checkout",code=~"5.."}[5m]))
rate(http_requests_total{job="checkout"}[5m])

Fix → Aggregate both sides to identical labels:

sum by (route) (rate(http_requests_total{job="checkout",code=~"5.."}[5m]))
/
sum by (route) (rate(http_requests_total{job="checkout"}[5m]))

Prevent → In recording rules always use explicit sum by (...) on numerator and denominator with the same label list.

All SRE & Reliability questions Roadmap: SRE & incident response

More on Prometheus SLIs & Recording Rules