Distributed Tracing
In one line
Distributed tracing tracks a request across services — shows the full path, timing, and causality of each step.
In simple words
Distributed tracing follows a single user request as it travels across multiple microservices. It creates a trace — a tree of spans where each span represents one operation.
Each span records: operation name, service, start time, duration, tags, parent span. This lets you see the full path, which service is the bottleneck, and where errors occurred.
Tools: Jaeger, Zipkin. Standard: OpenTelemetry.
Example
const tracer = trace.getTracer('my-app');
return tracer.startActiveSpan('handleRequest', async (root) => {
const user = await tracer.startActiveSpan('db.getUser', async (s) => {
const r = await db.query('SELECT * FROM users WHERE id=?', id); s.end(); return r;
});
root.end(); return user;
});Each operation gets a span. The root span is the request; child spans are the DB query and API call. The trace shows which span is slowest.
Common confusions
Confused with: Logging
The difference: Logs record individual events in one service. Distributed traces follow a single request across ALL services. Logs are per-service; traces are cross-service.
Related terms
Related Resources
Related Lessons
- Distributed Tracing
Distributed tracing.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.