Untitled Lesson
Skill Matrix
UNLOCK NODES BY LEARNING NEW TAGS.
What specific question does distributed tracing answer that a simple correlation ID threaded through logs cannot answer on its own?
š» Code Challenge | +75 XP
Instrument a request handler with a manual span around a business-logic function (e.g. calculateShippingCost), ensuring the span ends correctly even if the function throws.
A production incident is affecting checkout, but engineers can't determine which of four downstream services involved is actually the bottleneck. Reorder the steps to diagnose it using tracing.
Task: Reorder the blocks in logical sequence to solve the problem.
A.D.A. Interface
Adaptive Didactic Assistant

Pascual Vila
Frontend Instructor // Code Syllabus
The Error //
Wrapping a manual span around code but forgetting to call span.end() on the error path
// Wrong: span never ends if computeShipping() throws
const span = tracer.startSpan("calculateShipping");
const cost = await computeShipping(order);
span.end();
// Correct: always ends, even on error
const span = tracer.startSpan("calculateShipping");
try {
return await computeShipping(order);
} finally {
span.end();
}The Solution //
If a span is only ended in the success path, any request that throws an error before reaching that point leaves the span open forever, corrupting trace data and potentially causing memory issues in the instrumentation library. Always end a span in a finally block so it closes regardless of success or failure.
The Error //
Tracing 100% of requests in a very high-traffic service with no sampling strategy
// Expensive and often unnecessary at high volume
const shouldTrace = true; // 100% of requests, always
// Common pattern: prioritize errors, sample the rest
const shouldTrace = isError || Math.random() < 0.01;The Solution //
Full tracing at high request volumes generates enormous data volume, adding meaningful processing overhead to every request and significant cost/storage burden on the tracing backend. A sampling strategy (e.g. trace all errors, sample a small percentage of successful requests) provides representative visibility at a fraction of the cost.