Events describe occurrences; spans describe operations
How correlated event records differ from causally linked trace spans, and why adding trace identifiers to logs does not create a distributed trace. · advanced
A structured log record describes an event using explicit fields: for example, event=payment_retry, attempt=2, and trace_id=T. Structure makes events filterable and comparable. It does not require the record to identify an enclosing operation, its parent, or its duration.
A span represents an operation with an identity and a time interval. Its trace identifier associates it with a trace; its span identifier distinguishes that operation. Parent references connect child operations to their callers, while span links can express additional relationships, including those needed for some asynchronous workflows. These relationships describe execution structure rather than merely grouping records.
The distinction is the data model, not JSON versus another encoding. Logs can contain durations, and spans can contain timestamped events. A log-based system could reconstruct spans if it deliberately captured and interpreted the necessary operation identities, boundaries, and relationships—but adding a shared identifier alone supplies none of that structure.
| Property | Structured log record | Trace span |
|---|---|---|
| Primary unit | An event | An operation |
| Time representation | Event timestamp | Start and end |
| Identity | Application-defined fields | Trace and span IDs |
| Relationship model | Shared fields enable joins | Parent references and links |