← Lessons

quiz vs the machine

Platinum1810

System Design

The Distributed Tracing for Microservices

Follow one request across many services to find where time goes.

5 min read · advanced · beat Platinum to climb

The visibility gap

In a monolith a stack trace shows a whole request. Across microservices one request hops through many services, and logs scatter. Distributed tracing stitches those hops back into one picture.

Traces and spans

  • A trace represents one end to end request.
  • Each unit of work is a span with a start, end, and parent.
  • A trace id is generated at the edge and propagated in headers through every hop.

Context propagation

Every service must forward the trace id and span context on its outgoing calls. Without propagation the trace breaks into disconnected pieces.

What you get

A trace view shows the call tree and the time each span took, so you can spot the slow hop, see retries, and understand failures that span services.

Sampling

Tracing every request is costly, so systems sample, keeping a fraction of traces while still capturing enough to debug.

Key idea

Distributed tracing propagates a trace id across services and records spans, so one request becomes a single timeline that reveals the slow or failing hop.

Check yourself

Answer to earn rating on the learn ladder.

1. What links spans from different services into one trace?

2. Why do tracing systems use sampling?