Observability and running a system
Metrics, logs and traces, how to define 'healthy' with SLOs, and how to ship changes without breaking things.
On the roadmap:Intermediate · step 8: Reliability and observability
Lesson 11 of 13 · 9 min read · quiz · exercise
You cannot fix what you cannot see
A system you cannot observe is a system you cannot trust. Observability is the ability to understand what is happening inside from the outside. Three kinds of signal work together.
| Signal | What it is | Best for |
|---|---|---|
| Metrics | Numbers over time (requests per second, error rate, CPU) | Dashboards, alerts, trends |
| Logs | Timestamped records of events | Details of what happened |
| Traces | The path of one request through many services | Finding where time is spent |
Figure SDA-FND-11-1 · From alert to root cause · © forcsguy.com
What to measure
A simple checklist, the four golden signals:
- Latency: how long requests take (use percentiles).
- Traffic: how much demand there is.
- Errors: how many requests fail.
- Saturation: how full the busiest resource is (CPU, memory, connections, disk, queue depth).
Averages hide pain. If the average is 100 ms but p99 is 4 seconds, one user in a hundred is waiting four seconds, and with many requests per page that is most of your users sometimes.
Defining healthy: SLIs, SLOs, error budgets
- An SLI (indicator) is a measurement, like "fraction of requests answered successfully in under 300 ms".
- An SLO (objective) is the target, like "99.9% over 30 days".
- The error budget is what is left over: 0.1% of requests may fail. While there is budget, ship features; when it runs out, focus on reliability.
Alert on symptoms users feel (error rate, latency) more than on causes (one machine's CPU). Page a human only for things that need action now.
Ship changes safely
Most outages come from changes. Reduce the risk:
- Small, frequent releases are easier to understand and undo than big ones.
- Canary release: send a few percent of traffic to the new version and watch the metrics before going wider.
- Feature flags: deploy code turned off, then enable it gradually, and switch it off instantly if needed.
- Blue-green: keep the old version running so you can switch back in seconds.
- Backwards-compatible changes: database and API changes should work with both old and new code during rollout.
- Fast rollback must be a rehearsed, boring button.
When things go wrong
Have an incident process: someone leads, someone communicates, mitigate first and investigate later. Afterwards write a blameless postmortem that asks "how did our system and process allow this?" rather than "who did this?". That is how reliability actually improves.
A worked example: error budgets and burn rate
Your service has an SLO of 99.9% of requests succeed over 30 days, and it serves 10 million requests a month.
- Error budget: 0.1% of 10,000,000 = 10,000 failed requests may happen in the month before you break the promise.
- Burn rate is how fast you spend it. A burn rate of 1 uses exactly the budget over 30 days. If 5% of requests are failing now, the error rate is 50 times the allowed 0.1%, a burn rate of 50: the whole month's budget is gone in 30 / 50 = 0.6 days, about 14 hours.
- Alert on burn rate, not on a single bad minute. A common pattern watches two windows together: page someone if the burn rate over the last hour is above about 14 and the last 5 minutes agree (a fast burn: 2% of the monthly budget gone in an hour). Open a ticket for a slower burn, say rate above 6 over 6 hours. Two windows avoid paging for blips and avoid missing slow leaks.
Why this beats "alert when error rate is above X": it ties alerts to what users were promised, it pages only when the budget is in danger, and it gives the team a rule for trade-offs: when the budget is healthy, ship faster; when it is nearly spent, slow down and fix reliability.
Figure SDA-FND-11-2 · Alerting on how fast the error budget burns · © forcsguy.com
Finding the cause with all three signals
A worked investigation shows why you want metrics, traces and logs together.
- A metric alerts: the checkout success rate dropped and p99 latency rose. Metrics tell you that something is wrong and how bad, cheaply and over time.
- Narrow it down by dimension: break the metric down by region, version and endpoint. Only the new version in one region is affected, a strong hint it is a deploy.
- A trace shows where the time goes: one slow checkout request shows 4.8 of its 5 seconds in a call to the payment provider's tokenisation endpoint.
- Logs give the detail: filter logs by the trace id from that request and read the exact error: a timeout talking to a new tokenisation URL.
- Fix and verify: roll back the version, and watch the metric recover.
Figure SDA-FND-11-3 · From an alert to a root cause · © forcsguy.com
The glue is a correlation id (trace id) carried on every request and written into every log line, so you can jump from one signal to the others.
Mistakes people make
- Alerting on causes instead of symptoms. "CPU is 85%" may be fine; "users are seeing errors" never is. Page on symptoms users feel, and use cause metrics for diagnosis.
- Averaging percentiles. The mean of two hosts' p99 is meaningless; merge distributions instead (see the t-digest lesson).
- High-cardinality labels. A label such as
user_idon a metric creates a new time series per user, which can multiply storage and cost by millions. Put such detail in logs or traces. - Logs without structure or ids. Free text is hard to query. Log JSON with a trace id, service and version.
- Dashboards no one owns. A wall of graphs nobody reads is noise. Build a small dashboard per service around the golden signals: latency, traffic, errors and saturation.
- No runbook. An alert that does not say what to check first wastes the first ten minutes of every incident.
Try it yourself
Run any test in the System Builder and read its charts as if they were production graphs: which signal moves first, and which part would you look at next? Build the search metrics lab to practise percentile maths, and read the t-digest lesson for how real systems summarise latency at scale.
Real-world reading
Related reading
- The Site Reliability WorkbookGoogle SRE team · O'Reilly / GoogleBooks
- Feature Toggles (aka Feature Flags)Pete Hodgson · Martin FowlerBlogs
- InfluxData BlogInfluxData engineers · InfluxDataBlogs
- MetricsDB: TimeSeries Database for storing metrics at TwitterTwitter engineers · TwitterCase Studies
Show 6 moreShow fewer
- The Architecture Twitter Uses to Deal with 150M Active Users, 300K QPS, a 22 MB/S Firehose, and Send Tweets in Under 5 SecondsHigh Scalability engineers · High ScalabilityCase Studies
- Steady State: Always Put Logs on Separate DiskMicrosoft engineers · MicrosoftCase Studies
- XCMetrics: All-in-One Tool for Tracking Xcode Build Metrics at SpotifySpotify engineers · SpotifyCase Studies
- Honeycomb BlogHoneycomb engineers · HoneycombBlogs
- BookKeeper: Distributed Log Storage at YahooYahoo engineers · YahooCase Studies
- Analyzing V8 Garbage Collection Logs at AlibabaAlibaba engineers · AlibabaCase Studies
Check your understanding
Question 1 of 4
0 correct so far
Which pillar of observability is best for spotting a trend such as rising error rate?
Go deeper
- Site Reliability Engineering, Monitoring Distributed Systems by Google SRE team
Topics covered in this lesson
Practise it: Find the slow part
Everything below is already set up for this lesson: change the design, run the traffic, and see whether you meet the goal.
- 1The task
- 2Build and test
At 20 seconds the database becomes five times slower. Your dashboard shows rising latency and errors. Use the colours and charts to find which part is the problem, then fix it.
Goal: Keep errors under 2% and the slowest 5% under 400 ms.
Run it and watch which part turns red when the test passes 20 seconds.
Try it yourself
Users complain that checkout is slow. Which three things would you want on a dashboard, and which tool would you use to find out where in the request the time goes?
Click what a strong design here would need:
Next course
© 2026 forcsguy.com. Original lesson text and diagrams. Books and sites linked above belong to their authors.