Write an SLO in a declarative tool so teams do not hand-write burn-rate rules.

AdvancedScenarioSLOs and Error Budgets
Answer

Situation read → Hand-written multi-window burn-rate rules are error-prone. Generate them.

What I'd do →

  1. Use Sloth or Pyrra (or OpenSLO spec) to define SLOs as code.
  2. Generate recording rules and alerts in CI and deploy via GitOps.
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:
      name: CheckoutHighErrorRate
      page_alert: {labels: {severity: page}}
      ticket_alert: {labels: {severity: ticket}}
  1. Run sloth generate -i slo.yaml -o rules.yaml and review the output.

Why → Consistent, tested rules across teams with one input per SLO.

Interview tip → Mention the generated multi-window, multi-burn-rate alerts by name.

All Monitoring & Observability questions

More on SLOs and Error Budgets