Observability
Read first: Networking for request paths
Metrics tell you the shape, traces tell you which hop, and logs tell you about one request. Rate, errors, and duration are how you look at a service, and utilization, saturation, and errors are how you look at a resource. On a slow checkout you open duration and errors for that route first, then one trace, and you never put a user id on a metric.
You cannot fix a checkout you cannot see, and you can also drown in the seeing. Observability is the discipline of recording enough to answer “what is slow, how widespread, and which hop” without recording so much that the recording system becomes the outage. Three kinds of signal cover that, and they are not interchangeable. People get into trouble by using the expensive one as a counter, or the cheap one as a per-user log.
Core concepts
Metrics are aggregated numbers. A counter of checkouts, a histogram of how long they took, a gauge of how many are in flight. You keep the aggregate and throw away the individual. That is why metrics survive high traffic: one series is a line, whether it counted a hundred events or a hundred million. The cost shows up when you multiply series. Every distinct combination of labels is its own line. A label with a small set of values is a dimension. A label with a value per user is a new line per user, and that will take the metrics system down. Time-series data is the same warning from the storage side. High cardinality is not a styling choice. It is memory.
Logs are what one request did. A line with a request id, a route, a status, a latency, and maybe an error string. At low volume this is the easiest tool you have. At high volume it is a write stream proportional to traffic, and someone pays to store it. Logs answer “what happened to this request.” They are a bad way to answer “is checkout slower than an hour ago,” because that question is an aggregation and you would be building a metrics system out of text, badly, during an incident.
Traces are a tree of spans. A span is one timed operation with a name, a start, a duration, and a parent. The checkout span is the parent of the inventory span and the payment span, including when those spans are in another process. You only get the tree if you propagate a trace context on the request as it crosses the network. Networking for request paths is that crossing. Without propagation, each process has a pile of spans and no parents, and you will blame the service you happen to be looking at. Traces are the tool that shows which hop owned the time. They are too big to keep for every request at serious volume, so you sample, and you bias the sample toward errors and slow requests or you will sample your way out of the incident.
RED is the service view. Rate, errors, duration. How many requests per second, what fraction failed, and how long the rest took. Duration means a distribution. Latency numbers that matter already said why a mean is not a duration: a handful of multi-second calls hide inside a pretty average, and those calls are the ones users retry. Keep p50 and p99, and the timeout. RED is what you put on a service dashboard. It is also the raw material of an SLI, which SLOs and error budgets turns into a target. RED does not tell you whether the host is out of CPU. It tells you whether users are having a bad time, which is the question you opened the laptop to answer.
USE is the resource view. Utilization, saturation, errors. Utilization is how busy the resource is, such as CPU percent or the fraction of the connection pool checked out. Saturation is the queue: runnable threads waiting, requests waiting for a pool slot, disk operations waiting. Errors are resource errors, such as a connection that the pool could not create. A resource can be highly utilized and healthy if nobody is waiting. A resource can be moderately utilized and broken if the queue is long. CPU at 40% with a payment pool whose waiters are growing is a saturated pool, not a quiet machine. People graph utilization and forget saturation, then conclude the machine is fine while requests sit.
OpenTelemetry is a model, not a configuration guide. It is the shared description of spans, metrics, and logs, plus the context you propagate, so that libraries and services emit one shape and you export that shape to whatever backend you run. The value is that you instrument once. The exporter, the collector, the vendor endpoint, and the flags that turn them on are configuration of a deployment. This page will not invent that configuration. If a design interview drifts into exporter YAML, it has left the problem. The problem is which signals you emit, which labels you allow, and which view you open first.
What you open first on a slow checkout. Open the RED view of the checkout route. Rate tells you if traffic changed. Errors tell you whether “slow” is actually “failing.” Duration, at p50 and p99, tells you whether the typical checkout moved or only the tail did, and a deploy marker on the same graph tells you whether it moved when you shipped. You do this before you read a log and before you open a CPU graph, because RED says whether the symptom is real and how wide it is.
Then open one trace of a slow checkout. The long span is the hop. If payment is 1.8 seconds of a 2-second checkout, more CPU on the checkout service will not help, and USE on the checkout host will look calm. If the long span is inside your process and the pool wait is the time, you then open USE for that pool: saturation first, utilization second. Logs come third, and only for the request the trace already identified, when you need the input or the error string that the span did not carry.
The exception is a support ticket that already has a request id. Then the trace for that id is the first click, because the aggregation will not contain the one cart. You still go back to RED before you declare an incident, or you will “fix” a one-off and miss that p99 has been bad for an hour. You do not open CPU first in either path. A slow checkout is a user-facing latency question. CPU is one possible cause, and it is not the one a waiting client produces.
flowchart LR
symptom[Slow checkout]
red[RED for the route]
trace[One slow trace]
logs[Logs for that trace]
use[USE of the waiting resource]
symptom --> red
red --> trace
trace --> logs
trace --> use
Context has to be there before the incident. A trace id generated at the edge, propagated on every downstream call, and written on every log line is what makes the third box reachable from the second. If the id stops at the first process, the payment hop is invisible and the checkout span looks like a slow function.
A worked example
Assumptions: checkout does 200 requests per second, steady. A log line for it is 1 KB if you are disciplined and 20 KB if you dump the cart. A trace you keep is 10 KB. You run 20 instances. The histogram has 12 buckets. Status is collapsed to three classes, not the raw code and not the exception text. A day is 86,400 seconds. These are planning assumptions, not a vendor quote.
What a day of logs costs.
1 day = 86,400 s
requests = 200 * 86,400 = 17,280,000 per day
disciplined line, 1 KB
17,280,000 * 1,000 bytes = 17.3 GB/day
payload line, 20 KB
17.3 GB * 20 = 346 GB/day for this one route
The 1 KB line is a request id, a trace id, the route, the status, and the latency. That is enough to join a metric to a trace. The 20 KB line is how a checkout log becomes a storage project. Multiply by every service that logs the same cart and you have built a second database you did not mean to design. Log the ids and the outcome. Put the breakdown in the trace.
What a user id does to the histogram. Without a user label, the series you actually store:
routes = 1
status classes = 3
instances = 20
buckets = 12
series = 1 * 3 * 20 * 12 = 720
Seven hundred and twenty series for checkout latency is a dashboard. Now add a user id, and assume 1,000,000 distinct users check out at least once in the retention window. Drop the instance label, because someone will try that to “save cardinality,” and it does not save you.
users = 1,000,000
status classes = 3
buckets = 12
series = 1,000,000 * 3 * 12 = 36,000,000
Thirty-six million series, for one route, so that a graph can show one user. The metrics store falls over, or the bill does, and you still cannot read the graph. The one user belonged in a trace or a log looked up by id. The metric’s job was the 720 series: this route, these statuses, these instances, this latency shape.
A label built from a raw URL, a SQL string, or an error message with an embedded id has the same failure mode. The set of values is unbounded, so the set of series is unbounded. Keep labels to things you could print on one page: route template, status class, operation name, instance.
What you keep of the traces. Assume a policy, not a default: keep every error trace, and keep 1 in 100 successful ones. Assume the day’s checkouts include a 1% error rate so the arithmetic is easy to check. That 1% is an assumption of this example.
checkouts per day = 17,280,000
errors kept = 0.01 * 17,280,000 = 172,800
successes kept = 0.01 * the other 99% ≈ 0.01 * 17,107,200 ≈ 171,000
traces kept ≈ 344,000
at 10 KB each ≈ 3.4 GB/day
You kept a few gigabytes and both populations that matter, the failures and a sample of the ordinary. A uniform 1 in 100 with no error bias would have kept about 1,700 of the 172,800 errors and thrown out the incident. Sampling is part of the design. A sample that drops the tail is coordinated omission by another name: the system looks faster because you declined to store the slow calls.
Walking a slow checkout. Suppose RED shows checkout p50 still at 80 ms and p99 moved from 250 ms to 2 s, starting at 14:02, with no change in rate and no change in error rate. The average might have moved from 90 ms to 110 ms, and someone will say it looks fine. One in a hundred checkouts is now two seconds. That is the p99.
You open a trace slower than one second. The checkout span is 2.1 s. The child span “authorize payment” is 1.9 s. The inventory child is 40 ms. USE on the checkout host shows CPU at 30% and no pool saturation, because the worker is blocked on the network, not on a local queue. USE on the payment client’s connection pool shows saturation: waiters, and a checkout time that is almost entirely “waiting for a connection” plus the downstream time. The next click is payment’s RED, not a profiler on checkout. The log line for that trace id confirms the cart was ordinary, so this is not one huge payload. You have spent four views. None of them was a host CPU graph opened at random, and none of them required a per-user metric.
Tradeoffs
| Choice | What you gain | What you spend |
|---|---|---|
| Metrics with a few labels | Fleet-wide rate, errors, and duration at high traffic | You cannot see one user on that graph |
| A user id label on a metric | A graph per user, in theory | Tens of millions of series, and the metrics system falls over |
| A short structured log per request | A join key and an outcome | Still a full day of bytes, so the line has to stay small |
| Logging the whole payload | Easy debugging of one bad cart | Hundreds of gigabytes a day on a single route |
| Every trace kept | A tree for every checkout | Storage you will sample later anyway, under duress |
| Sampled traces, errors and tail kept | You can afford the tree and still catch incidents | A random success may have no trace |
| RED on the service | You see user pain directly | A saturated disk can hide until duration moves |
| USE on the host | You see queues and busy resources | The host can look idle while a dependency holds the time |
| Propagated trace context | One tree across processes | Every hop has to forward it, including the ones you forgot |
| OpenTelemetry as the instrumentation model | One set of signals, any backend | You still have to decide labels, sampling, and the first dashboard |
Pitfalls
- Opening CPU first for a slow checkout. The workers are blocked on payment, utilization is modest, and you spend the incident tuning a machine that is waiting.
- Trusting the mean. p99 moved by a factor of eight and the average moved by a few tens of milliseconds. The mean said the deploy was fine.
- A label per user, per session, per raw URL, or per exception string. Cardinality climbs, scrapes get slow, and then metrics go dark in the incident you needed them for.
- Logs with no trace id. You have a slow span and a million lines, and no way to connect them.
- A trace that starts mid-request because the edge or one client did not propagate context. The slow hop is the one without a parent, so it is invisible, and the visible span looks guilty.
- Sampling successes and errors with the same coin flip. The outage is 1% of traffic and your sample throws most of it away.
- Using logs as the latency dashboard. You aggregate text under pressure and get a worse, slower version of the histogram you refused to emit.
- Treating OpenTelemetry as a badge. The SDK is on, the default labels include a high-cardinality attribute, and you have not drawn the RED view anyone will open at 2 a.m.
In the interview
Say the order. “On a slow checkout I open RED for that route first, duration at p50 and p99 plus errors and rate. Then one slow trace, to see which span has the time. Logs for that trace id if I need the payload. USE only for the resource the trace says is waiting. I do not open CPU first, and I do not put a user id on the histogram.”
Mention cardinality with a number. A handful of labels is hundreds of series. A user id is millions. That is the bottleneck of the observability system itself, and it is a real bottleneck, because a dead metrics system is how an incident goes blind.
Skip exporter configuration, vendor feature names, and a tour of every probe type. The follow-up is usually “how would you find the one user, then?” The answer is a trace id or a request id in the log, not a label. The tradeoff is sampling: you will not have a trace for every success, so you keep the errors and the tail on purpose.
Check yourself
Checkout feels slow and nobody has handed you a request id. What do you open first, and what do you open second?
First, the RED view of the checkout route: rate, errors, and duration at p50 and p99. That tells you whether this is widespread and whether it is slowness, failures, or a traffic shift. Second, a trace of one slow checkout. The long child span names the hop. A CPU graph comes later, and only if that span is burning CPU rather than waiting. A ticket that already contains a request id flips the first click to that trace, and you still confirm the shape on RED before you call it an incident.
A checkout latency histogram has 12 buckets and 3 status classes. You add a user id label and a million users appear in the window. About how many series is that, and where should the user id live instead?
On the order of 1,000,000 times 3 times 12, which is 36 million series, before any other label. That is enough to hurt or take down the metrics store. The user id belongs on a log line or inside a sampled trace, where you look up one request. The metric keeps route, status class, and a small set of instances.
CPU is at 25 percent and checkout p99 is 2 seconds. Payment's span is 1.9 seconds of that. Which USE signal matters, and which view was the wrong first click?
The wrong first click was CPU utilization. The checkout host is idle because it is waiting. The USE signal that matters is saturation of the pool or the connections that are waiting on payment, and the RED view of payment itself. Utilization answers how busy a resource is. Saturation answers whether work is queued behind it. This incident is a queue, or a downstream span, not a hot core.
Why is OpenTelemetry not a configuration guide, and what part of it actually changes the slow-checkout investigation?
It is a shared model of spans, metrics, logs, and the context you pass along a request. Exporter flags and backend endpoints are deployment configuration, and they are not the design. What changes the investigation is the model used well: a propagated trace context so the payment span is a child of checkout, a small set of metric labels so RED is still alive at 200 requests a second, and a trace id on the log line so the third click lands on the same request.
Based on: Google SRE book; OpenTelemetry; Jeff Dean, Numbers Everyone Should Know.