Observability: logs, metrics, traces, alerts and SLOs
We'll cover the following
Visual summary

Download imageFree to share, please link back to this lesson.
The problem: checkout is slow at 3am
Your phone buzzes at 3am: the checkout page is slow. Customers are complaining, and you have thirty services behind that page. Where do you look first? Opening a random service and reading its logs is like searching a city for one person with no address.
You need three different questions answered, and each has its own kind of data:
- Is something wrong, and how bad? You need numbers over time, such as error rate and latency. These are metrics.
- Where in the chain is it slow? You need to follow one request through every service. These are traces.
- Why is that one service slow? You need the detailed events it recorded. These are logs.
Together, logs, metrics and traces are called observability: being able to understand what a system is doing from the outside, using the data it emits. The rest of this lesson covers each signal, how to alert on them, and how to turn them into reliability targets (SLOs).
The three pillars
| Signal | What it is | What it tells you |
|---|---|---|
| Logs | One service's diary of discrete events with text, for example "payment failed for order 7" | What happened inside one service |
| Metrics | Numbers over time: requests per second, error rate, p99 latency, CPU. Cheap and pre-aggregated. | That something is wrong. Used for dashboards and alerts. |
| Traces | The journey of one request across all services, with timing for each hop | Where it is slow |
Logs and traces are not the same thing: a log lives in one service, while a trace stitches the services together.
Correlation ID and distributed tracing
- A correlation ID (the transaction id every downstream call carries) is the foundation of tracing.
- Distributed tracing adds a trace ID for the whole request and a span for each hop (service A, then B, then the DB) with start time, duration and parent. They travel in headers (the W3C
traceparentstandard). - The waterfall view shows it at a glance: "checkout took 2.1 s, and 1.8 s of it was the inventory service".
- Tools: OpenTelemetry (the standard), Jaeger, Zipkin, Datadog.
- Generate the ID at your edge / gateway instead of trusting the client.
- Log the trace ID in every log line so logs and traces connect.
- Sample traces (for example 1% plus every slow or failed request), because tracing everything is expensive.
Here is the waterfall for the slow checkout. The trace shows the problem without opening a single log file:
checkout request (trace 4f2a...) 2100 ms
gateway 20 ms
cart-service 120 ms
inventory-service 1800 ms <-- the slow hop
db query: stock lookup 1750 ms
payment-service 160 msAlerting: symptoms, not causes
- CPU at 80% is a cause, and users may be perfectly happy at 80%. Alert on what users feel.
- The golden signals: latency, traffic, errors, saturation. For example "error rate above 1%" or "p99 checkout latency above 2 s".
- Autoscaling on resource metrics such as CPU or queue depth is a good use of them. It is not the same as paging a human.
- Only page a human for something actionable. Too many noisy alerts cause alert fatigue, and people start ignoring them.
SLI, SLO, SLA and the error budget
| Term | Meaning | Example |
|---|---|---|
| SLI (indicator) | A measurement | % of checkout requests that succeed in under 300 ms |
| SLO (objective) | Your internal target for the SLI | 99.9% over 30 days |
| SLA (agreement) | The customer contract, with penalties if missed. Looser than the SLO. | 99.5% or a service credit |
Set the SLO stricter than the SLA, so you are warned well before you break the contract.
Error budget: the arithmetic
The error budget is the failure your SLO still allows. A 99.9% SLO allows 0.1% failure. Over a 30-day window, that is:
30 days = 30 x 24 x 60 = 43,200 minutes
budget = 0.1% of 43,200 = 43.2 minutes (about 43 minutes of downtime a month)
SLO 99.9% -> 43.2 min per 30 days
SLO 99.99% -> 4.3 min per 30 daysA healthy budget means ship faster. A burned budget means freeze features and fix reliability.
Burn rate says how fast you are spending the budget. A burn rate of 1 uses exactly the whole budget by the end of the 30 days. A burn rate of 15 empties it in 30 / 15 = 2 days. For a 99.9% SLO, an error rate of 1.5% (15 times the allowed 0.1%) is a burn rate of 15.
- Fast burn (the month's budget gone in about 2 days): page someone now.
- Slow burn (the budget will run out before the window ends, but not soon): open a ticket.
- Do not alert on the SLA directly.
Metrics vs logs, and the tools
There are two ways to get a number like "errors per minute" out of a system.
- Normal way: the app emits metrics directly (counters, gauges, histograms) using Prometheus, StatsD or OpenTelemetry. These are tiny numbers, cheap to store.
- Log-based metrics: a tool counts log lines that match a pattern ("ERROR lines per minute") in Splunk, Datadog or CloudWatch. Use it only as a fallback for legacy apps you cannot change. It is fragile (a reworded message breaks the pattern) and costly (logs are huge).
Many companies run one platform for all three signals (Datadog, the Grafana stack, New Relic, Elastic, Splunk). The storage underneath is separate for each signal, and the trace ID links them. Splunk began as a log search and analytics platform and now also offers metrics and tracing.
The open-source stack covers all three: ELK or Loki for logs, Prometheus + Grafana for metrics, Jaeger / Tempo for traces.
Back to 3am
Now the opening scenario has an order of work: the alert (from metrics) tells you checkout p99 is high, the trace shows the inventory hop is slow, and that service's logs at that time explain why.
Check yourselfThe p99 checkout latency alert fires at 3am. In what order do you use metrics, traces and logs, and what does each one tell you?
Metrics first: what is wrong, which endpoint, since when, and how bad. Then traces: which service or hop is slow. Then the logs of that service at that time: why.
Check yourselfYour SLO is 99.9% over 30 days. Roughly how much downtime can you afford, and what does a burn rate of 15 mean?
About 43 minutes (0.1% of 43,200 minutes). A burn rate of 15 means you are spending the budget 15 times faster than the pace that would last the whole window, so it is gone in about 2 days. That is a page, not a ticket.
Summary: say it in the interview
- "Metrics for detection, traces for locating, logs for explaining. I alert on SLO burn and user-facing symptoms, not raw CPU."