What Distributed Tracing Actually Is

How 40 spans emitted independently by 23 processes on 23 machines, each unaware of the others, are reassembled into one request's causal tree — and why the economics of keeping that tree is the hardest engineering problem in the whole system, not the assembling.

The Problem It Deletes: Tail Amplification

Take the checkout from the Central Question: 23 services, slow for 0.1% of users. Every team opens their dashboard. Every p99 is inside its SLO. Nobody is lying, and nobody can help you — because a fan-out request waits for the slowest backend, not the average one.

If a parent makes N parallel calls and each backend independently has probability q of landing in its own slow tail, then the chance the request hits at least one tail event is:

P(request sees ≥ 1 tail event) = 1 − (1 − q)N

Plug in q = 0.01 — "each backend's p99," the thing every dashboard shows you — and the numbers turn ugly faster than intuition expects:

Backends touched (N)P(≥ 1 backend in its p99 tail)What the dashboards say
11.0%p99 = p99. The dashboard is the truth.
54.9%All green
109.6%All green
2018.2%All green
2320.6%All green
5039.5%All green

Read the N=20 row again. Nearly one request in five touches a p99 event while every component reports 99% health. That's why "is service X slow?" is the wrong question and "where did this request's 312 ms go?" is the right one — and only a per-request call graph answers the second.

Two things the formula glosses over:

  1. It assumes backends fail independently. They don't. They share a Postgres, they all link the library that just paused for GC, they sit on the same rack as a noisy neighbor. So slowness clusters: most of the time things are a little better than the table says, and when they're bad, many backends are slow at once. Real tail trouble shows up as a cliff, not a drizzle.

  2. It only covers parallel calls — where the parent waits for the slowest child, so one bad draw sets the latency. If the calls run one after another, the times add up instead and a single slow hop matters less. But that's also the easy case: one 200 ms hop in a chain jumps out of a trace immediately, even though an aggregate still hides it.

Twenty-one healthy p99s, one unhealthy request — the gateway waits on the slowest draw, not the mean
Twenty-one healthy p99s, one unhealthy request — the gateway waits on the slowest draw, not the mean

Where It Came From: Dapper

Nearly every modern tracer is a descendant of Dapper (Google Technical Report dapper-2010-1, April 2010, Sigelman et al.). Four of its decisions are still doing work in OpenTelemetry fifteen years later.

  1. Miss a service and the trace is worth much less. Dapper's goal was to be everywhere, always on — the paper warns that "the usefulness of a tracing infrastructure can be severely impacted if even small parts of the system are not being monitored." One uninstrumented hop breaks the chain (see The Trace).

  2. Instrument the shared libraries, not each app. Dapper hooked the threading, control-flow, and RPC code every service already used, so app teams got tracing without writing any. The whole thing was under 1000 lines of C++ and under 800 of Java. OpenTelemetry's auto-instrumentation is the same bet (see Instrumentation).

  3. Keep the data model tiny. A span was a name, its own id, its parent's id, and some key/value annotations. That's it. An OTel span (see The Span) adds a kind, typed values, and 128-bit trace ids — nothing conceptually new.

  4. Sampling was there on day one. It was not a cost optimization bolted on later, and that's the point people get wrong. It's the spine of the parts from Head-Based Sampling to What It Costs.

On that last point: Dapper's first production version already kept only 1 trace in every 1024. It had to. The paper measures a websearch cluster and finds tracing every request cost +16.3% average latency — versus +4.12% at 1 in 8, +2.12% at 1 in 16, and effectively zero at 1 in 1024. Three sampling stages ended up stacked on each other:

StageWhat it doesWhy it exists
Fixed rate, in the appKeep 1 trace in 1024. The root service decides, and everyone downstream follows.Caps what tracing costs a busy service — creating spans and writing them to local disk isn't free.
Adaptive rate, in the appAim for a target number of traces per second instead of a fixed fraction. The rate actually used is saved with the trace, so later analysis can correct for it.A service handling 30 requests/sec gets almost nothing at 1 in 1024. This lets quiet services trace nearly everything without anyone hand-tuning them.
Second cut, in the pipelineHash the trace id to a number between 0 and 1 and drop the span if it's above a threshold.App config is slow to roll out everywhere, so Google deliberately traced a bit more than storage could take and trimmed the rest with one knob. Hashing the trace id — not the span id — means a whole trace is kept or dropped together, never half of one. That's the Head-Based Sampling part's consistency rule, already solved in 2010.

What It Is Not

People thinkActually
"It's just logging with a request ID"A request ID gets you a pile of log lines. A trace gets you a shape: who called whom, and how long each call took. Grep can show you that payments logged something during your request. Only a trace shows you that the gateway sat waiting on payments for 200 ms, and whether that wait actually delayed the response (see Reading a Trace). The shape is the whole point.
"It's the third pillar, equal to metrics"They get expensive for opposite reasons. A metric's cost grows with how many distinct label values you use, no matter how much traffic you have — adding user_id as a label is a classic way to take down a Prometheus. A span's cost grows with how many requests you trace, no matter how many attributes each one carries — adding user.id costs ~30 bytes on a row you were writing anyway. So traces answer "why was this one request slow" and metrics answer "what's the rate right now, across everything." Neither can do the other's job.
"It's a profiler"A trace sees the gaps between calls, not what happens inside a function. A 201 ms hole in a parent span with no children under it tells you the time was spent locally and nothing at all about which line spent it. Profiling fills that in; it's the companion tool, not the rival (see Where Tracing Stops).
"It's basically free"Dapper measured +16.3% latency when tracing every request — and that's before you pay for the network, the collectors, and the index (see What It Costs). Tracing is affordable only because you throw nearly all of it away.
"It tells you the cause"It tells you where the time went and what the call graph looked like. That usually makes the cause obvious — but the last step is still yours.

The "Three Pillars," Fairly

The phrase comes from Peter Bourgon's February 2017 post Metrics, tracing, and logging. His point was that the three overlap — he drew a Venn diagram. The industry heard "three separate things" and turned it into three products, three agents, and three bills. It's less wrong than it is an org chart — though OpenTelemetry does ship three signals with three pipelines, and most runbooks are still written that way.

The direction people have been moving is simpler: emit one rich event per unit of work, and treat metrics and traces as different views of that same stream. That's a smaller leap than it sounds, because an OTel span is already such an event — a timestamped record with whatever key/values you attach. Two id fields (see The Span) and a backend that joins on them (see The Trace) are the only things that make it a trace instead of a log. Whether you compute metrics up front or by scanning spans later is an engineering call (see What It Costs, Trace Storage), not a worldview.

The organizing line for this entire guide: tracing's data model is a causal graph, but every system that transports, samples, and stores it is a per-span pipeline that does not know the graph exists. Orphan spans (see The Trace), trace-ID-aware load balancing (see The Collector), tail-sampling buffers (see Tail-Based Sampling), and index explosion (see Trace Storage) are all that same mismatch surfacing somewhere new.

Dapper, in production"over two years" as of April 2010 — i.e. since ~2008
Bytes per span426 B average, across Dapper's whole repository
Volume at Google, 2010> 1 TB of sampled trace data per day
Ingest latencymedian < 15 s; p98 < 2 min ~75% of the time, hours otherwise
Span create/destroy204 ns root, 176 ns non-root (2.2 GHz x86)
Unsampled annotation~9 ns — a thread-local lookup
  • Guarantees: For a request whose trace was kept and whose services were all instrumented, you get the causal structure of that one execution: who called whom, in what order, with what concurrency, and how long each hop took. That is a fact about an individual request that no aggregate can reconstruct.
  • Does not guarantee: That the interesting request was kept (see Head-Based Sampling, Tail-Based Sampling), that every hop appears (see The Trace), that timestamps across hosts are comparable (see The Trace), or that the data model is cheap to store and index (see What It Costs, Trace Storage). Tracing buys you per-request truth and bills you in volume.