30. Observability
1
The picture to keep in your head2
30.1 Why do you need observability?3
30.2 What are the three pillars?4
30.3 What are golden signals, RED and USE?5
30.4 What are SLI, SLO and SLA?6
30.5 What are error budgets?7
30.6 How do you alert without noise?8
30.7 What makes a good dashboard?9
30.8 How do you debug an incident, step by step?10
Memory card and where the analogy breaks11
Practice: five levels12
Interview questions13
Solutions14
Sources15
Code lab30. Observability
30.4 What are SLI, SLO and SLA?
3 min read+10 XP
Targets and alerts
In the car: The car measures kilometres driven (what you measure). The manufacturer recommends a service every 10,000 km (your target). The warranty says they'll fix it free if it breaks within 3 years (the contract, with consequences).
In the system:
- SLI (Service Level Indicator): a measurement of how users experience the service, usually a ratio of good events to all events. "Fraction of checkouts that succeed within 2 seconds."
- SLO (Service Level Objective): the target for an SLI over a window. "99.9% of checkouts succeed within 2 seconds, measured over 30 days."
- SLA (Service Level Agreement): a contract with customers or partners, with consequences (credits, refunds) if missed. "99.5% monthly, or partners get credits." SLAs are usually looser than internal SLOs, so you notice and fix problems before you owe anyone money.
Figure: measure what users feel, set a target, and treat the gap as a budget.
Choosing good SLIs:
- Measure what users feel, ideally at the edge (load balancer or client), not internal CPU.
- Availability SLI: good requests ÷ valid requests (exclude 4xx caused by bad input).
- Latency SLI: requests faster than a threshold ÷ all requests ("99% under 2 s"), rather than "average latency".
- Per user journey: browse, search, add to cart, checkout. Not every endpoint needs one.
Don't aim for 100%: it's impossibly expensive, and users can't tell 99.99% from 100% through their own flaky Wi-Fi.
Memory code: "Measure the kilometres, promise the service interval, sign the warranty looser."