How do you generate SLO alert rules without hand-writing dozens of burn-rate expressions?
IntermediateProductionAlerting Strategy, SLOs & Runbooks
Answer
Use an SLO generator. Sloth and Pyrra take a small spec and emit recording rules plus multi-window, multi-burn-rate alerts. In production we keep the spec next to the service code:
version: "prometheus/v1"
service: "checkout"
slos:
- name: "requests-availability"
objective: 99.9
sli:
events:
error_query: sum(rate(http_requests_total{job="checkout",code=~"5.."}[{{.window}}]))
total_query: sum(rate(http_requests_total{job="checkout"}[{{.window}}]))
alerting:
page_alert: { labels: { severity: page } }
ticket_alert: { labels: { severity: ticket } }
sloth generate -i slo.yaml -o rules.yaml produces consistent, reviewed rules; nobody copy-pastes the 14.4/6/3/1 factors wrong.
More on Alerting Strategy, SLOs & Runbooks
What is the single most important rule for deciding whether an alert should page a human?BeginnerWhat severity levels do you define, and where does each one go?BeginnerWhy do mature teams alert on SLO burn rate instead of raw error rate thresholds?IntermediateIn a multi-window burn-rate alert, what is the short window for?AdvancedHow do you pick an SLO target for a service that has never had one?BeginnerWhat makes a good SLI, and where should it be measured?Intermediate