What fields does an OpenTelemetry span carry?
BeginnerConceptTracing & OpenTelemetry
Answer
| Field | Purpose |
|---|---|
trace_id, span_id, parent_span_id |
Identity and tree structure |
name |
Low-cardinality operation name, e.g. GET /users/{id} |
kind |
SERVER, CLIENT, PRODUCER, CONSUMER, INTERNAL |
start_time, end_time |
Nanosecond timestamps |
attributes |
Key/value pairs, e.g. http.request.method, db.system |
events |
Timestamped annotations inside the span (e.g. an exception) |
links |
References to spans in other traces |
status |
Unset, Ok or Error with an optional message |
The span also inherits resource attributes (service.name, k8s.pod.name) from the SDK that produced it. In production we keep high-cardinality values (user ID, order ID) in attributes, never in the span name.
More on Tracing & OpenTelemetry
What is distributed tracing, and what are a trace, a span and a span context?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