SLIs, SLOs and Error Budgets

Define reliability in terms users care about, set explicit targets, and use the remaining error budget to balance speed and stability.

Intermediate · about 4 hours · difficulty 3/5

Learn first: Alerting That Does Not Burn People Out

"Make it reliable" is not a target. Service level objectives turn reliability into a number that product and engineering agree on.

Vocabulary

  • SLI (indicator): a ratio of good events to valid events, measured from the user's point of view. Examples: fraction of requests that return non-5xx in under 300 ms; fraction of jobs completed within 10 minutes.
  • SLO (objective): the target for an SLI over a window, such as 99.9% over 28 days.
  • SLA (agreement): a contract with customers and penalties, usually looser than the internal SLO.
  • Error budget: 100% minus the SLO. At 99.9% over 30 days you may be "bad" for about 43 minutes.

Choosing good SLOs

  • Start from critical user journeys (log in, search, pay), not from every component.
  • Measure as close to the user as possible: load balancer logs or synthetic probes beat host metrics.
  • 100% is the wrong target; each extra nine costs far more and users cannot tell.
  • Begin with what you achieve today and tighten later.

Using the budget

  • Budget left: ship faster, run experiments, do risky migrations.
  • Budget exhausted: an agreed error budget policy kicks in, such as a feature freeze or reliability work taking priority.
  • Alert on burn rate: how fast the budget is being consumed, with a fast window for outages and a slow one for gradual decay.

Tools such as Sloth or Pyrra generate Prometheus rules from SLO definitions, and most observability vendors support SLOs natively.

Good enough to move on: you can write an SLI as a good/valid ratio, calculate the error budget for a given SLO, and set up a multi-window burn-rate alert.

Key concepts

  • SLI, SLO and SLA
  • User journeys and good/valid ratios
  • Error budget math
  • Error budget policies
  • Burn-rate alerting
  • Sloth and Pyrra

Mini project

Define availability and latency SLOs for your demo API, generate Prometheus recording and burn-rate alert rules (by hand or with Sloth), and build a Grafana panel showing budget remaining.

Check yourself

Your service has a 99.95% monthly SLO and already had a 15-minute outage. Roughly how much budget remains, and what might your policy say?

Free resources