SLOs, error budgets and on-call
Decide how reliable is reliable enough: pick SLIs users feel, set SLOs, turn them into error budgets, alert on burn rate instead of every error, and write runbooks that make on-call calm.
By the end of this lesson you'll be able to
0 of 5 complete"Never down" is impossible and expensive, and users can't tell 99.99% from 100% anyway. An SLO sets how reliable is reliable enough, and the gap to 100% becomes an error budget you're allowed to spend. In this lesson you'll define SLIs in PromQL, turn SLOs into budgets, alert on burn rate instead of every error, and set up the runbooks and on-call habits around them.
SLIs and SLOs
- SLI (service level indicator): a measurement of how users experience the service, almost always a ratio of good events to all events. "Share of requests that didn't fail."
- SLO (service level objective): the target for that SLI over a window. "99.9% over 30 days."
- SLA (service level agreement): a contract with customers, with money or credits if it's broken. It's usually looser than the SLO (say 99.5%), so you react long before you owe anything. Many internal services have SLOs and no SLA at all.
Pick SLIs users feel
Good SLIs come from the golden signals in lesson 1, seen from the user's side:
| SLI type | Good event | All events |
|---|---|---|
| Availability | Requests that didn't return 5xx | All requests |
| Latency | Requests faster than a threshold, say 1 s | All requests |
| Freshness (for pipelines) | Data updated in the last 10 minutes | All checks |
Measure as close to the user as you can: at the load balancer or ingress rather than deep inside one service. And pick two or three SLIs per service, not twenty.
Write the SLI in PromQL
The HotROD demo app from the tracing lesson exposes request counters and a latency histogram.
After a few ride bookings on the lab, its /metrics page showed:
hotrod_requests_total{endpoint="GET_/dispatch",error="false"} 13 hotrod_requests_total{endpoint="GET_/dispatch",error="true"} 0 hotrod_request_latency_bucket{endpoint="GET_/dispatch",error="false",le="0.5"} 0 hotrod_request_latency_bucket{endpoint="GET_/dispatch",error="false",le="1"} 11 hotrod_request_latency_bucket{endpoint="GET_/dispatch",error="false",le="2.5"} 13 hotrod_request_latency_count{endpoint="GET_/dispatch",error="false"} 13
Read it as two SLIs:
- Availability: 13 requests, 0 with
error="true", so 13 / 13 = 100%. - Latency (under 1 second): the
le="1"bucket counts requests that took 1 s or less: 11. All requests: 13. So 11 / 13 = 84.6%. Against a "95% of bookings under 1 s" SLO, this service is failing badly, which matches the 330 ms SQL query and fourteen Redis calls you found in the trace.
As PromQL over a 30-day window, the same two SLIs are:
# Availability SLI sum(rate(hotrod_requests_total{endpoint="GET_/dispatch", error="false"}[30d])) / sum(rate(hotrod_requests_total{endpoint="GET_/dispatch"}[30d])) # Latency SLI: share of bookings finished within 1 second sum(rate(hotrod_request_latency_bucket{endpoint="GET_/dispatch", le="1"}[30d])) / sum(rate(hotrod_request_latency_count{endpoint="GET_/dispatch"}[30d]))
The latency SLI only works if a bucket boundary sits exactly at your threshold. If your SLO says 300 ms and the histogram has buckets at 250 ms and 500 ms, add a 300 ms bucket first. Over 30 days these queries are heavy, so in practice you turn the 5-minute ratio into a recording rule and average that.
Choose the target
Start from what you achieve today, not from a wish. If the last three months were 99.95%, a 99.9% SLO is honest and leaves room. Every extra nine is about ten times harder:
| SLO | Error budget over 30 days |
|---|---|
| 99% | 7 hours 12 minutes |
| 99.5% | 3 hours 36 minutes |
| 99.9% | 43.2 minutes |
| 99.95% | 21.6 minutes |
| 99.99% | 4.3 minutes |
You can't promise more than what you depend on. If your cloud database offers 99.95%, a 99.99% SLO for the app on top of it is a wish.
Error budgets
The error budget is 1 - SLO. For 99.9% that's 0.1% of requests, or 43.2 minutes of full
outage, in each 30-day window. If the service handles 10 million requests a month, the budget is
10,000 failed requests.
What makes the budget useful is an error-budget policy that both product and engineering signed up to, for example:
- Budget above 50%: release normally.
- Budget below 25%: extra review for risky changes; no Friday deploys.
- Budget gone: freeze feature releases (security fixes excepted) and put the team on reliability work until the 30-day window recovers.
Now the weekly argument has an answer. Product can see that last week's incident used 60% of the month's budget. Ops can see that a quiet month has budget to spare for a risky migration.
Alert on burn rate
The burn rate is how fast you're using budget compared with the steady pace that would use exactly all of it by the end of the window:
- Burn rate 1: errors at exactly the budget rate. The budget lasts the full 30 days.
- Burn rate 14.4: 14.4 times too fast. The whole 30-day budget is gone in about 2 days; one hour at this rate uses 2% of it.
In PromQL, burn rate is the error ratio divided by the budget:
( sum(rate(hotrod_requests_total{endpoint="GET_/dispatch", error="true"}[1h])) / sum(rate(hotrod_requests_total{endpoint="GET_/dispatch"}[1h])) ) / 0.001
The Google SRE workbook recommends multiwindow, multi-burn-rate alerts. Each alert checks a long window (is this sustained?) and a short window (is it still happening right now?):
| Severity | Burn rate | Long window | Short window | Budget used when it fires |
|---|---|---|---|---|
| Page | 14.4 | 1 hour | 5 minutes | 2% |
| Page | 6 | 6 hours | 30 minutes | 5% |
| Ticket | 1 | 3 days | 6 hours | 10% |
# slo-rules.yml - alert: CheckoutErrorBudgetBurnFast expr: | (sum(rate(hotrod_requests_total{error="true"}[1h])) / sum(rate(hotrod_requests_total[1h]))) > (14.4 * 0.001) and (sum(rate(hotrod_requests_total{error="true"}[5m])) / sum(rate(hotrod_requests_total[5m]))) > (14.4 * 0.001) labels: severity: page annotations: summary: 'Checkout is burning its 30-day error budget 14x too fast' runbook_url: https://runbooks.example.com/checkout-error-budget
The short window makes the alert stop soon after the problem stops, instead of firing for another hour. Writing these by hand for every service is tedious, so tools like Sloth generate the recording rules and alerts from a short SLO file, and Grafana and most hosted tools have SLO features built in.
Runbooks and on-call
An alert is only as good as what happens after it fires.
Runbooks
A runbook is a short page linked from the alert's runbook_url. It's written for someone tired,
new, or both:
# TargetDown What it means: Prometheus could not scrape {{ job }} on {{ instance }} for 1 minute. Impact check: Is the service's error SLI dropping? (Grafana: "Checkout SLO" dashboard) Is it one instance or all of them? (Prometheus: up{job="..."}) First steps: 1. ssh / kubectl to the instance; is the process running? systemctl status node_exporter | kubectl get pods -n <ns> 2. If one instance is dead and others serve traffic: replace it, then investigate. 3. If all are down: check the last deploy (rollback first, debug second). Escalate to: #team-platform; after 30 min, the platform lead on the on-call rota. Last updated: 2026-11, by Rajeev
Keep runbooks in Git next to the alert rules, so they change together. When an alert fires and the runbook was wrong or missing, fixing it is part of closing the incident.
A healthy on-call rotation
- A rota, not a hero. At least 4 to 6 people, one week each, with a secondary as backup. The same person on call every night burns out.
- Pages are rare and real. Google's SRE book suggests at most about two incidents per 12-hour shift; more than that means the alerts need fixing, not the people.
- Clear handover. At the end of the week: what fired, what's still open, what was noisy.
- Pay and time off for on-call. It's work.
Blameless postmortems
After a real incident, write a postmortem: what happened (a timeline, like the one in lesson 4), the impact in SLO terms ("used 38% of the monthly budget"), why it happened, and actions with owners. Blameless means you ask what in the system let a person make that mistake, not who made it. People who fear blame hide problems, and hidden problems come back as bigger outages.
Start with one SLO for your most important user journey (login, checkout, search), measured at the edge. Put it on a dashboard everyone sees, agree the error-budget policy with product, and review SLOs every quarter. An SLO nobody looks at is just a number.
Write an SLO for one service
Pick one service you know (or HotROD's /dispatch). Write a one-page SLO document with: the user journey, two SLIs (availability and latency) with their PromQL, a 30-day SLO for each with the reason for the number, the error budget in minutes and in requests at your traffic, a fast and a slow burn-rate alert, and a three-line error-budget policy.
~/slo.mdReveal one safe solution
Service: ride booking (GET /dispatch) SLI 1, availability: requests with error="false" / all requests SLO 99.9% over 30 days SLI 2, latency: requests with le="1" / all requests SLO 95% under 1 s over 30 days Error budget: 99.9% → 43.2 min/30 days; at 1M bookings/month → 1,000 failed bookings Today: availability 13/13 = 100%; latency 11/13 = 84.6% → latency SLO already broken Alerts: burn rate 14.4 over 1h and 5m → page; burn rate 1 over 3d and 6h → ticket Policy: budget gone → feature freeze; fix the SQL query and batch the Redis calls first
That's the lab's real starting point: the service never failed, yet it's too slow for the SLO. An SLO turns "it feels slow" into a number and a priority. Your service, numbers and reasons will differ.
Try it yourself
0 of 6 steps doneRun each task in your own account or terminal, then tick it off.
Quick check
What is the difference between an SLO and an SLA?
Official reading for this lesson
Or get every quiz answer right and it completes itself.
Something unclear, wrong or out of date in this lesson? Tell me, and I'll fix it.