What is distributed tracing, and what are a trace, a span and a span context?
BeginnerConceptTracing & OpenTelemetry
Answer
Distributed tracing records the path of one request as it crosses services, queues and databases, so you can see where the time went and where it failed.
- Trace: the whole request, identified by a 128-bit
trace_id. - Span: one unit of work inside it (an HTTP handler, a SQL query, a Kafka publish), with a start time, duration and a 64-bit
span_id. - Span context: the small, immutable part that travels between processes:
trace_id,span_id, trace flags (sampled or not) and trace state.
Spans point to their parent span, which is how the backend rebuilds the tree (the "waterfall" view). Metrics tell you that p99 is high; a trace tells you which hop made it high.
More on Tracing & OpenTelemetry
What fields does an OpenTelemetry span carry?BeginnerWhat are span kinds and why do they matter?IntermediateWhat does the W3C `traceparent` header look like?IntermediateWhat is baggage, and how is it different from span attributes?IntermediateWhat is OpenTelemetry and what are its main parts?BeginnerWhy does OpenTelemetry separate the API from the SDK?Advanced