Interview Prep/Monitoring & Observability/Alerting Strategy, SLOs & Runbooks

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.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Alerting Strategy, SLOs & Runbooks