← Lessons

quiz vs the machine

Silver1050

System Design

The Trace and Span Model

How a single request becomes a tree of timed work units that you can read end to end.

4 min read · intro · beat Silver to climb

What a Trace Is

A trace records the full journey of one request as it moves through many services. It is the top level container that ties everything together with a shared trace id.

Spans Are the Building Blocks

A span is a single named unit of work, like a database query or an HTTP call. Each span carries:

  • A span id and the parent span id that links it to its caller.
  • A start time and duration.
  • A name, a status, and attributes describing the work.

Because each span points at its parent, the spans form a tree. The first span is the root span, and its children fan out as the request touches more services.

Reading the Tree

When you lay spans on a timeline you see where time went. A wide span means slow work. Gaps between spans hint at queueing or network delay.

This shared structure is what lets one request be reconstructed across dozens of machines that never share memory.

Key idea

A trace is a tree of spans sharing one trace id, where each span is a timed unit of work linked to its parent.

Check yourself

Answer to earn rating on the learn ladder.

1. What links a child span to its caller?

2. What does a single span represent?