23 / 25 · Operations and recovery
Distributed tracing
Distributed tracing follows one operation across multiple components using linked spans and propagated context. It helps locate time and errors, but traces are sampled evidence, not proof that every request behaved the same way.
What you will practise
- Trace one request
- find the critical path
- protect telemetry data
Before you start: Request duration, span and parallel work.
About 5 minutes · offline-generated English female narration · captions included. Diagrams are conceptual; timings are illustrative.
Download MP4CaptionsListen without the video
Download audioChapters and full transcript
Let us understand distributed tracing. A parcel carries a tracking number through several delivery centres. Each centre records when its part began and ended. You can find where this parcel waited. That does not mean every parcel took the same path, and missing a tracking scan does not prove the parcel disappeared. Distributed tracing follows one operation across multiple components using linked spans and propagated context. It helps locate time and errors, but traces are sampled evidence, not proof that every request behaved the same way.
Follow the normal path. The gateway starts or receives trace context for checkout. Its span represents one part of the operation, not all system traffic. Booking receives compatible context and creates a related span. Without propagation, downstream records can appear as unrelated operations. SeatSpot checkout passes through gateway, booking, database and payment. One total latency number cannot show which hop waited or whether two operations ran in parallel.
Now change one condition. Database and payment calls run in parallel in this teaching example. Their intervals overlap, so adding both durations would overstate wall-clock time. A common misunderstanding is this: A sampled trace proves every request behaved the same way. Sampling selects evidence, not every operation. Missing context also creates incomplete traces. Think about this. A 100 ms database call overlaps a 300 ms payment call, with 40 ms overhead. Is total duration necessarily 440 ms? Pause the video and make your prediction. No. In the simplified parallel example it is about 340 ms. Inspect overlap and missing time rather than summing every child span.
Let us reason with a concrete example. Checkout has a 100 ms database call and a 300 ms provider call in parallel, plus about 40 ms sequential overhead. A simplified total is about 340 ms, not 440 ms. Actual scheduling, serialization and network effects require measured traces. Investigate the critical path and compare slow traces with broader metrics. Do not optimize a fast database span just because it is easiest to see. These figures are teaching examples, not production guarantees.
Turn the idea into a design decision. Instrumentation exports spans to an observability backend. Export buffering, sampling and failures mean a trace view is not a complete audit of every request. Compare the critical path, errors and dependency waits. Combine traces with aggregate metrics to determine whether the visible slow request reflects a widespread problem. When you try the practice task, look for this result. Parallel work overlaps in wall-clock time; sampled traces must be compared with aggregate metrics.
Check your understanding. Do not attach secrets or unnecessary personal data to spans. Keep attribute cardinality, access, sampling and retention within a deliberate observability budget. Here is a challenge. Two 200 ms spans run in parallel inside a 250 ms request. Is the request necessarily missing 150 ms? Pause before the answer. No. Parallel spans overlap, so their sum can exceed wall-clock request duration. Inspect start/end times and the critical path before inferring missing time. For an interview, discuss context propagation, critical paths and useful attributes. Say what you would measure, not only which tool you would buy.
Start with an everyday picture
A parcel carries a tracking number through several delivery centres. Each centre records when its part began and ended. You can find where this parcel waited. That does not mean every parcel took the same path, and missing a tracking scan does not prove the parcel disappeared.
Why SeatSpot needs this
SeatSpot checkout passes through gateway, booking, database and payment. One total latency number cannot show which hop waited or whether two operations ran in parallel.
Trace one step at a time
Move through the diagram at your pace. Teal paths are active; unavailable components are labelled.
Start one operation
The gateway starts or receives trace context for checkout. Its span represents one part of the operation, not all system traffic.
Read all six mechanism steps
Start one operation
The gateway starts or receives trace context for checkout. Its span represents one part of the operation, not all system traffic.
Propagate context
Booking receives compatible context and creates a related span. Without propagation, downstream records can appear as unrelated operations.
Record parallel work
Database and payment calls run in parallel in this teaching example. Their intervals overlap, so adding both durations would overstate wall-clock time.
Collect span evidence
Instrumentation exports spans to an observability backend. Export buffering, sampling and failures mean a trace view is not a complete audit of every request.
Find the slow boundary
Compare the critical path, errors and dependency waits. Combine traces with aggregate metrics to determine whether the visible slow request reflects a widespread problem.
Protect telemetry data
Do not attach secrets or unnecessary personal data to spans. Keep attribute cardinality, access, sampling and retention within a deliberate observability budget.
Pause and make a prediction
A 100 ms database call overlaps a 300 ms payment call, with 40 ms overhead. Is total duration necessarily 440 ms?
Correct a common misunderstanding
Claim to question: A sampled trace proves every request behaved the same way.
Better explanation: Sampling selects evidence, not every operation. Missing context also creates incomplete traces.
Draw a trace timeline
- Draw database from 20 to 120 ms.
- Draw payment from 20 to 320 ms on a second row.
- Add sequential overhead and identify the critical path.
Check what you can explain
This is your self-check, not an automated grade. Try again without the diagram tomorrow.
0 of 3 goals checked. Choose one remaining idea to practise next.
Teach it back
Without looking, explain what this component changes, what it does not solve and what happens if it fails. Use the animation to check your explanation, then switch to Engineering.
Engineering model and trade-offs
A trace groups related spans; spans record operation timing, parent relationships and attributes. Propagate context across HTTP and messaging boundaries using compatible instrumentation. Broken context creates disconnected fragments.
Nested and parallel span durations must not be blindly added. Inspect the critical path and missing time. Sampling affects which requests are visible; pair traces with aggregated metrics and contextual logs.
Avoid secrets, payment data and unnecessary personal identifiers in span attributes. Bound high-cardinality fields and restrict observability access/retention. Instrumenting everything without a budget can add cost and overhead.
Work through an example
Checkout has a 100 ms database call and a 300 ms provider call in parallel, plus about 40 ms sequential overhead.
Reason with the numbers
A simplified total is about 340 ms, not 440 ms. Actual scheduling, serialization and network effects require measured traces.
Make a decision
Investigate the critical path and compare slow traces with broader metrics. Do not optimize a fast database span just because it is easiest to see.
Implementation sketch
trace: checkout
gateway 0–340 ms
booking 10–330 ms
database 20–120 ms
payment 20–320 ms
# database/payment overlap; do not add them blindly.Illustrative timing data, not production telemetry or benchmark results. A real trace also needs propagated identity, errors and instrumentation context.
Where this is used
- Finding bottlenecks in distributed requests.
- Correlating partial failures across service boundaries.
Common mistakes
- Adding parallel durations as if sequential.
- Putting access tokens or card details in attributes.
- Assuming sampled traces represent all traffic.
Practise a reasoned answer
Answer aloud or write notes before opening the reference. These prompts teach reasoning and trade-offs; they are not claimed questions from a particular company.
Logs, metrics or traces?
Choose a practice depth
- Foundation
- Explain a trace ID and linked spans.
- Practical
- Discuss context propagation, critical paths and useful attributes.
- Advanced
- Defend sampling, cardinality, retention, privacy and observability cost.
Self-check rubric
- State the required user outcome and the relevant invariant.
- Explain the normal path and one failure path.
- Name a cost or consistency/latency trade-off.
- Say what you would measure or test before trusting it.
For deeper practice, connect this topic to the previous lesson and identify a shared bottleneck. A longer answer is not automatically a better answer.
Try it before viewing the solution
Two 200 ms spans run in parallel inside a 250 ms request. Is the request necessarily missing 150 ms?
Check one key idea
Your explanation and interview notes
Saved only in this browser when storage is available. Export a backup from the course page before clearing browser data or moving devices.
Loading your local notes…
Official references and next reading
The explanation, fictional examples and animations are original teaching material. Vendor behavior depends on the specific product/version; use its documentation before deploying.