Metrics and dashboards tell you what is happening; alerting decides when a human must stop what they are doing and respond. This lesson builds the vocabulary that keeps that decision honest: a Service Level Indicator (SLI) is the number you measure, a Service Level Objective (SLO) is the target you promise, and the error budget is the finite amount of failure that target permits. Get these right and the pager fires when the budget is genuinely at risk, and stays silent when it is not.
The Analogy: The Winter Heating-Oil Tank
A house in a cold country is heated from a single oil tank in the yard. The supplier fills it once, at the start of winter, with what both parties agree is enough oil to last until the spring delivery -- provided the household burns it at the planned nightly rate. That full tank is not an infinite resource and it is not meant to be hoarded; it is a budget, sized deliberately so that ordinary winter use draws it down to near empty exactly as the season ends. Some of it is expected to be spent.
The tank is the error budget made physical. A cold snap that runs the furnace harder for a few nights is not a crisis -- that is precisely the slack the budget exists to absorb, and burning a little faster on a bad week is fine as long as the tank still reaches the delivery date. What matters is not any single cold night but the total draw against a fixed allowance over a fixed window. The household is allowed to consume the whole tank; it is simply not allowed to run out early.
The number that predicts trouble is therefore not the level in the tank but the rate the level is falling. Divide the oil remaining by tonight's consumption and you get the days of oil left; compare that to the days of winter left and you know whether you are on track. If the furnace is drinking three times the planned rate, the season's oil disappears in a third of the season, and it does so regardless of how full the tank looks at this moment. A gauge that reports burn rate against time remaining gives warning while there is still time to order a top-up or turn the thermostat down.
The household that watches the wrong instrument comes to grief. Fit only a float switch that buzzes when the tank drops below a fixed low mark, and through a steady, week-long over-burn the alarm says nothing at all -- the level is high, therefore not critical yet -- right up until the tank runs dry on a freezing night in February with no warning and no time to react. The level was never the danger; the speed of consumption was, and the fixed-level alarm was structurally blind to it. An alarm that fires on burn rate against the days remaining would have called days earlier, while the fix was still cheap.
Syntax or Core Structure
An SLO is a promise about a measured ratio over a window. Subtract it from 100% and you have the error budget: a concrete, finite allowance of failure you are permitted to spend before the window closes. The core calculation converts that fraction into the units on-call actually reasons about -- minutes of downtime and numbers of failed requests.
SLO = 0.999 # promise: 99.9% of requests succeed
WINDOW_DAYS = 30 # measured over a rolling 30 days
minutes = WINDOW_DAYS * 24 * 60 # 43200 minutes in the window
budget_fraction = 1 - SLO # 0.001 -- the error budget
TOTAL_REQUESTS = 2000000
budget_minutes = budget_fraction * minutes
budget_requests = budget_fraction * TOTAL_REQUESTS
print('SLO: %.1f%% success over %d days' % (SLO * 100, WINDOW_DAYS))
print('error budget: %.3f of all requests' % budget_fraction)
print('allowed downtime: %.1f minutes' % budget_minutes)
print('allowed bad requests (of %d): %d' % (TOTAL_REQUESTS, budget_requests))
Output:
SLO: 99.9% success over 30 days
error budget: 0.001 of all requests
allowed downtime: 43.2 minutes
allowed bad requests (of 2000000): 2000
Three nines over a 30-day window is 43.2 minutes of allowed downtime, not the 43.8 you will sometimes see quoted -- that figure quietly assumes a 30.4-day average month. Pin the window explicitly (30 days here) and the budget is exact: 0.1% of 43200 minutes, and 0.1% of every request served.
Technical Depth: Burn Rate and Multi-Window Alerts
Burn rate turns an error rate into a deadline
The error budget is spent at a speed. Burn rate is that speed expressed as a multiple of the sustainable pace: divide the observed error rate by the budget fraction. A burn rate of 1x consumes the budget exactly over the full window; 10x consumes it in a tenth of the window. Turning burn rate into a time-to-exhaustion is what lets an alert speak in deadlines instead of raw percentages.
SLO = 0.999
budget = 1 - SLO # 0.001
WINDOW_DAYS = 30
def burn_rate(error_rate, b):
return error_rate / b
def days_to_exhaust(error_rate, b, window_days):
return window_days / burn_rate(error_rate, b)
for er in (0.001, 0.002, 0.01, 0.02):
br = burn_rate(er, budget)
dte = days_to_exhaust(er, budget, WINDOW_DAYS)
print('error rate %.3f -> burn %.0fx -> budget gone in %.2f days' % (er, br, dte))
Output:
error rate 0.001 -> burn 1x -> budget gone in 30.00 days
error rate 0.002 -> burn 2x -> budget gone in 15.00 days
error rate 0.010 -> burn 10x -> budget gone in 3.00 days
error rate 0.020 -> burn 20x -> budget gone in 1.50 days
A sustained 1% error rate against a 99.9% SLO is a 10x burn -- a month of budget gone in three days. That is the insight a raw percentage hides and a burn rate makes obvious.
Multi-window, multi-burn-rate alerts
Pageable alerts should fire fast on a severe burn and not at all on noise. The Google SRE approach pairs a fast burn rate with a short confirmation window, so a genuine emergency pages within minutes while a brief blip is filtered out. A lower burn rate over a longer window opens a ticket rather than a page.
| Long window | Short window | Burn rate | Budget consumed | Action |
|---|---|---|---|---|
| 1 hour | 5 minutes | 14.4x | 2% | page |
| 6 hours | 30 minutes | 6x | 5% | page |
| 3 days | 6 hours | 1x | 10% | ticket |
The short window is the safety catch: both the long and the short rate must exceed the threshold, so the alert resolves quickly once the burn stops and does not linger for the whole long window. Encoded as a Prometheus rule over a recording rule that pre-computes the error ratio, the fast-burn page looks like this.
groups:
- name: slo-burn-rate
rules:
- alert: ErrorBudgetFastBurn
expr: |
job:slo_errors:ratio_rate1h{job="api"} > (14.4 * 0.001)
and
job:slo_errors:ratio_rate5m{job="api"} > (14.4 * 0.001)
for: 2m
labels:
severity: page
annotations:
summary: "Fast burn of error budget on {{ $labels.job }}"
description: "Consuming error budget 14.4x faster than sustainable"
Real World Example: The Alert That Never Fired
A payments team ran an API with a 99.9% availability SLO over a rolling 30 days. On-call had one alert wired for error rate: page if the 5xx ratio exceeds 5% for two minutes. It had fired maybe twice in a year, both real outages, so everyone trusted it. Then a bad deploy pushed the steady-state error rate to 2% -- not enough to trip a 5% threshold, but far above what the SLO could afford. The following program models the two decisions that alert could have made on that same 2% signal.
SLO = 0.999
budget = 1 - SLO # 0.001
STATIC_THRESHOLD = 0.05 # page if error rate exceeds 5%
FAST_BURN = 14.4 # SRE fast-burn multiple
observed = 0.02 # 2% error rate, sustained
burn = observed / budget # 20x
days_left = 30 / burn
naive_page = observed > STATIC_THRESHOLD
correct_page = burn >= FAST_BURN
print('observed error rate: %.3f' % observed)
print('static threshold: %.3f' % STATIC_THRESHOLD)
print('burn rate: %.0fx (budget gone in %.2f days)' % (burn, days_left))
print('naive alert (rate > threshold) fires: %s' % naive_page)
print('burn-rate alert fires: %s' % correct_page)
print('naive and burn-rate agree: %s' % (naive_page == correct_page))
Output:
observed error rate: 0.020
static threshold: 0.050
burn rate: 20x (budget gone in 1.50 days)
naive alert (rate > threshold) fires: False
burn-rate alert fires: True
naive and burn-rate agree: False
The two checks read the identical 2% error rate and reach opposite verdicts. The static-threshold alert compares 2% to its 5% line, finds it lower, and stays silent -- exactly as it was configured to. The burn-rate alert instead compares the consumption speed to the budget: 2% is twenty times the sustainable rate, which drains a 30-day budget in a day and a half, so it pages. The final line prints False: the two approaches disagree, and on this input the naive one is wrong.
That disagreement is the whole lesson. A static error-rate threshold is blind to the timescale of the SLO -- it is mathematically invariant under any error rate below its line, no matter how quickly that rate would exhaust the budget. You can make the burn arbitrarily catastrophic, right up to 4.99%, and the 5% alert still never fires. The budget is gone in days while the pager stays dark, and the first anyone hears of it is a breached SLO report at month end.
The design flaw is concrete and provable from the output: the naive check is a function of level, not speed, so it cannot see a slow burn. But the burn-rate side has honest limits too. This model assumes a single, constant error rate; a single-window burn-rate alert is twitchy on brief spikes, which is why production rules pair a long and a short window so the burn must actually persist before paging. The 14.4 multiple is a convention tied to the specific 1-hour-over-5-minute window pair, not a universal constant -- change the windows and the threshold changes with them. And burn rate assumes the budget is spent smoothly, whereas real incidents are bursty, so multi-window alerting exists precisely to bridge that gap between a clean model and messy traffic.
Common Mistakes
- Alerting on causes instead of symptoms. Paging on high CPU or low memory floods on-call with conditions that may never affect a user. Alert on the symptom the SLO measures -- error rate and latency experienced by requests -- and leave resource metrics for dashboards and diagnosis.
- Static error-rate thresholds with no reference to the budget. A fixed page-above-5% line is blind to the SLO timescale: it misses a 2% burn that exhausts a monthly budget in a day, and it over-pages on a harmless spike. Alert on burn rate against the error budget instead.
- Setting an SLO of 100%. A 100% target leaves zero error budget, which forbids all deploys, all maintenance, and every dependency failure. Pick a number with slack -- 99.9% or 99.95% -- so the budget can absorb normal change.
- Confusing SLA, SLO, and SLI. The SLI is the measured number, the SLO is your internal target, and the SLA is the external contract with financial consequences. Set the SLO stricter than the SLA so you detect and react before you owe anyone a credit.
- Alerts with no runbook. An actionable alert names the exact next step. A page that says only error rate high forces the responder to rediscover the response at 3 AM. Every pageable alert should link a runbook with concrete first actions.
- No
forduration on the rule. Firing on a single scrape turns every transient blip into a page. A shortforclause requires the condition to persist before alerting, filtering out noise without meaningfully delaying real incidents.
- Paging on warnings. If the correct response is to look at it during business hours, it is a ticket, not a page. Reserve pages for conditions that need a human now; route everything else to a queue. Mixing the two trains people to ignore the pager.
- Measuring the SLO over the wrong window. A budget computed over an all-time average hides a bad week inside months of good data. Use a rolling window -- 28 or 30 days -- so recent failure actually moves the number the alert reads.
- Ignoring a spent budget. The budget is a decision tool, not a trophy. When it is exhausted, the response is to freeze risky launches and spend engineering on reliability; when it is healthy, you are free to ship faster. An unused budget means the SLO is too loose.
Best Practices
- Define SLOs from the user's perspective -- the ratio of requests that were fast and successful -- not from server-side resource metrics that users never see.
- Alert on burn rate against the error budget, using multi-window multi-burn-rate rules so severe burns page fast and mild ones open tickets.
- Keep pageable alerts few and actionable; every one must link a runbook and correspond to a condition a human can and must fix immediately.
- Set the internal SLO stricter than any external SLA so you have time to respond before a contractual breach.
- Pre-compute error ratios as Prometheus recording rules; alert expressions stay cheap, readable, and consistent across dashboards and rules.
- Add a
forduration to every rule so a single bad scrape cannot page anyone, and pair long and short windows so alerts also resolve promptly.
- Route by severity in Alertmanager: critical to a pager, everything else to chat or a ticket queue, and group related alerts to prevent storms.
- Review SLOs and alert quality on a regular cadence -- track pages per week, false-positive rate, and budget consumption -- and tune aggressively.
Practice Exercises
- Write a function that takes an SLO (as a fraction) and a window in days and returns the error budget in both minutes and as a percentage. Verify that 99.9% over 30 days yields 43.2 minutes, and that 99.99% over the same window yields 4.32 minutes.
- Given a list of per-minute error ratios over an hour, compute the average burn rate against a 99.9% SLO and report how many days the full 30-day budget would last at that pace. Flag the hour as a fast burn if the rate exceeds 14.4x.
- Write a Prometheus alerting rule (as YAML) that pages only when both a 1-hour and a 5-minute burn rate exceed 14.4x for a 99.9% SLO, and a second, lower-severity rule that opens a ticket at a 1x burn over 3 days. Explain why the short window is present.
- Take a static page-above-5%-error-rate alert and construct two scenarios: one where it fires but the budget is barely touched, and one where the budget is being exhausted in under two days yet it never fires. Compute the burn rate in each case to justify replacing it.