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

Prometheus logs `vector contains metrics with the same labelset after applying rule labels` for your SLI recording rule.

AdvancedTroubleshootingPrometheus SLIs & Recording Rules
Answer

Likely causes → The rule's labels: block overwrites a label that distinguishes series in the result. For example, the expression returns one series per code, and the rule sets code: "all", so all results collapse to the same labelset.

Diagnose →

kubectl logs -n monitoring prometheus-monitoring-kube-prometheus-prometheus-0 -c prometheus | grep "same labelset"

Run the expression without the rule labels and inspect which labels vary.

Fix → Aggregate away the varying label in the expression (sum without (code) (...)) or choose a rule label name that does not clash.

Prevent → Make SLI recording rules return exactly one series per SLO (or per explicit dimension) and unit test them with promtool test rules.

All SRE & Reliability questions Roadmap: SRE & incident response

More on Prometheus SLIs & Recording Rules