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

You applied a `PrometheusRule` for your SLO, but `slo:sli_error:ratio_rate5m` returns nothing in Prometheus.

BeginnerTroubleshootingPrometheus SLIs & Recording Rules
Answer

Likely causes → The Prometheus Operator is not selecting the rule (label mismatch with ruleSelector), the rule is in a namespace outside ruleNamespaceSelector, or the expression itself returns no data.

Diagnose →

kubectl get prometheus -n monitoring -o jsonpath='{.items[0].spec.ruleSelector}'
kubectl get prometheusrule -A --show-labels | grep checkout
curl -s localhost:9090/api/v1/rules | jq '.data.groups[].name'

Fix → Add the label the selector expects (kube-prometheus-stack defaults to release: <helm-release-name>), or install the chart with prometheus.prometheusSpec.ruleSelectorNilUsesHelmValues=false so all rules are picked up. If the group is loaded but empty, run the raw expression in the Prometheus UI and fix the selectors.

Prevent → Keep a CI check that the rule group appears in /api/v1/rules after deploy, and standardize rule labels in a template.

All SRE & Reliability questions Roadmap: SRE & incident response

More on Prometheus SLIs & Recording Rules