How-To Guide

How to Define SLIs and Error Budgets

Turn reliability goals into measurable service level indicators and error budgets that decide when to ship features and when to stop.

On this page

  1. Introduction
  2. From SLO to SLI to Error Budget
  3. Choosing the Right Indicator
  4. Measuring Availability from Events
  5. Computing the Error Budget
  6. Alerting with Burn Rates
  7. Policy: What the Budget Means
  8. Conclusion

Introduction

Reliability arguments are usually fought with anecdotes until someone writes down a number. The service level objective is that number: an explicit target such as 99.9 percent of requests succeed within 300 milliseconds over 30 days. The service level indicator is how you measure it from real events. The error budget is the amount of failure the objective allows, and it is the useful part because it converts a target into a policy: while budget remains, ship features; when it is exhausted, spend the effort on reliability. This article shows how to pick an indicator, measure it from events, compute the budget, and alert before it runs out.

From SLO to SLI to Error Budget

An SLO is a target for reliability, stated as a ratio over a window. An SLI is the measurement that feeds it: good events divided by total valid events, or a latency threshold on the same basis. The error budget is one minus the objective, so a 99.9 percent objective over 30 days allows about 43 minutes of full outage, or an equivalent amount of partial failure. The budget is what makes the objective actionable, because it tells you how much risk you may still take.

Choose the window to match the decision. A rolling 30-day window suits release policy; a shorter window reacts faster but is noisier. Avoid calendar-month resets, which can make the same incident feel urgent at the end of the month and irrelevant at the start.

Choosing the Right Indicator

Start from what the user cares about, not from what is easy to measure. For an API that is availability and latency; for a data pipeline it is freshness and completeness; for a storage service it is durability and latency. A good indicator is a ratio of good over valid, measured at the boundary the user sees, so an internal retry that succeeds does not count as a failure and an error the user sees always does.

Avoid measuring server-side CPU or queue depth as an SLI; those are causes, not the user’s experience. Use them as diagnostics once the user-facing indicator burns. If you must pick one, pick success rate of the user-facing operation, because it is the closest proxy for whether the service worked.

Measuring Availability from Events

Compute the indicator from a counter of events tagged good or bad, then express the budget over the window. The recording rules below make the ratio queryable and the budget visible. Percentiles for latency come from a histogram, computing the fraction of requests under the threshold rather than a single averaged latency, because averages hide the tail.

# Success ratio over a 5-minute window (fast signal)
sum(rate(http_requests_total{status=~"2..|3.."}[5m]))
  /
sum(rate(http_requests_total[5m]))

# Latency SLI: fraction of requests served under 300ms
sum(rate(http_request_duration_seconds_bucket{le="0.3"}[5m]))
  /
sum(rate(http_request_duration_seconds_count[5m]))

# Error budget consumed over 30 days for a 99.9% objective
1 - (
  sum(rate(http_requests_total{status=~"2..|3.."}[30d]))
  /
  sum(rate(http_requests_total[30d]))
) / 0.001

Computing the Error Budget

The budget is (1 minus objective) times the total valid events, expressed either as a request count or as a time allowance. For a 99.9 percent objective over a month, the time allowance is about 43 minutes of total unavailability. Track the consumed fraction, not just the absolute, so a small service and a large one are compared fairly.

Report the budget in a place the whole team sees, because its purpose is to inform decisions about whether to ship. A budget that nobody looks at changes no behavior. Pair it with the current burn rate so people see how fast it is being spent.

Alerting with Burn Rates

Alerting on the raw error rate produces noise, because a brief spike is not an incident. Alerting on burn rate instead measures how fast the budget is being consumed relative to the window. A multi-window scheme pairs a fast window with a slow window so a genuine incident pages quickly while a blip does not. The classic pattern alerts when the burn rate is high over both a short and a long window, which suppresses transient noise without missing sustained failures.

# Multi-window burn-rate alerts for a 99.9% SLO (30-day window)
groups:
  - name: slo-burn
    rules:
      - alert: ErrorBudgetFastBurn
        expr: |
          (1 - sum(rate(http_requests_total{status=~"2..|3.."}[5m]))
               / sum(rate(http_requests_total[5m]))) > 14.4 * 0.001
        for: 2m
        labels: { severity: page }
        annotations:
          summary: "Burning 14.4x budget rate over 5m"

      - alert: ErrorBudgetSlowBurn
        expr: |
          (1 - sum(rate(http_requests_total{status=~"2..|3.."}[1h]))
               / sum(rate(http_requests_total[1h]))) > 6 * 0.001
        for: 15m
        labels: { severity: ticket }

Policy: What the Budget Means

A budget without a policy is decoration. Write down the rules: while more than half the budget remains, features ship normally; when less remains, reviews get stricter; when the budget is exhausted, feature work stops and the team fixes reliability. Exceptions are allowed but must be explicit, with someone accountable for the risk.

The policy aligns incentives. Without it, teams either chase perfect reliability and ship nothing, or ship constantly and treat outages as bad luck. With it, the choice is a shared, measurable decision, and reliability becomes a budget to spend rather than a slogan.

Conclusion

Define an objective over a window, measure a user-facing ratio as the indicator, derive the error budget and its time allowance, and alert on burn rate with multiple windows so a real incident pages but a blip does not. Write the policy that says what the budget means for shipping. The point is not the number itself but the decisions it enables: how much risk to take, when to stop, and how to settle reliability arguments with evidence instead of opinion.

Sources: Google SRE Book: Service Level Objectives, Google SRE Workbook: Alerting on SLOs, Prometheus alerting rules.

FAQ

How many SLIs should one service have?
A few, focused on what users feel: availability and latency for request services, freshness and completeness for pipelines. More indicators dilute attention. Use server-side metrics as diagnostics once a user-facing indicator is burning.
Why alert on burn rate instead of the error rate?
Burn rate measures how fast the budget is being consumed, so it captures both the size and the duration of a problem. A brief spike does not page, but a sustained failure does, which keeps alerts actionable instead of noisy.

Related Examples