Indicators and objectives
Define service objectives and use telemetry, failure handling and recovery procedures to protect user outcomes.
THE IDEA
Indicators and objectives
A service level indicator (SLI) measures an outcome users care about, such as the fraction of requests that succeed. A service level objective (SLO) sets a target for it over a window. Choose the denominator on purpose: a time-based 99.9% over 30 days (43,200 minutes) allows 43.2 bad minutes, while a request-based 99.9% over 10 million requests allows 10,000 failed requests. The two are not interchangeable.
An SLI measures a defined outcome; an SLO is a target for it over a window. Say whether you count requests or time, what counts as good, and over how long.
Predict first. Can a monthly request success ratio be silently interpreted as minutes of outage?
Chapter context
Reliability is measured against what users need, not whether every component reports healthy. Observability connects symptoms to evidence, while resilience and recovery determine what happens when dependencies or infrastructure fail.
TRY IT YOURSELF
Part 1. Do it hands-on
Work out the allowances by hand, then write the indicator helpers.
An SLI measures a defined outcome; an SLO is a target for it over a window. Say whether you count requests or time, what counts as good, and over how long.
- To do: A 30-day window has 43,200 minutes. A time-based availability SLO of 99.9% allows how many bad minutes (1 decimal)?
- To do: At 99.99% (2 decimals)?
- To do: A request-based SLO of 99.9% over 10,000,000 requests in the window allows how many failed requests?
- To do: Can a monthly request success ratio be silently interpreted as minutes of outage? Type yes or no
Part 2. Do it in code
- allowed_bad_minutes(slo, days): (1 − slo) × days × 1440.
- allowed_bad_requests(slo, total_requests): (1 − slo) × total_requests, rounded to the nearest integer.
- request_sli(good, total): good / total (1.0 when total is 0 — nothing failed).
- time_sli(bad_minutes, days): 1 − bad_minutes / (days × 1440).
- meets_slo(sli, slo): sli >= slo (with a 1e-12 tolerance for rounding).
- same_unit(kind_a, kind_b): the two indicators are comparable only if they are the same kind ("request" or "time"); raise ValueError for anything else, return a == b otherwise.
Stuck, or something not working? You can come back to it any time.
CHECK YOUR UNDERSTANDING
Can a monthly request success ratio be silently interpreted as minutes of outage?
Chapter reference: math, worked example & code
This section belongs to the whole chapter, so it is the same on every lesson in it and may cover a different lesson's topic. The code for the experiment you just ran is inside the experiment itself.
Math and notation
For a time-based target A over W minutes, allowed bad time is . A simplified two-replica failover availability model is only if failures are independent and failover is perfect. It excludes many shared-dependency and detection failures.
Worked example
A 30-day time window contains 43,200 minutes. At 99.9% time-based availability, allowed bad time is 43.2 minutes; at 99.99%, it is 4.32 minutes. Two independent 99%-available replicas with ideal failover give 99.99% in the toy model, not a general deployment guarantee.
Reference code
The following example uses the Python standard library and does not call a remote service.
from math import isclose
minutes=30*24*60
assert minutes == 43200
assert isclose((1-.999)*minutes,43.2)
assert isclose((1-.9999)*minutes,4.32)
assert isclose(1-(1-.99)**2,.9999)
Python examples are provided for study and local execution; this page does not execute Python.
Common mistakes
Availability and durability differ. An average is not a latency percentile. Backup existence is not proof of recoverability. Correlated failures can dominate replica calculations.