← Lessons

quiz vs the machine

Gold1360

System Design

Span Attributes and Events

The structured key value data and timestamped points that turn a span into a rich story.

4 min read · core · beat Gold to climb

Beyond Timing

A span on its own tells you a name and duration. Attributes and events add the detail that makes a span debuggable.

Attributes

Attributes are key value pairs describing the span, such as the HTTP method, the status code, or the database statement. Good practice is to use semantic conventions, agreed names like http status code, so tools can interpret them automatically.

  • Keep cardinality sane; a user id as an attribute can explode storage.
  • Prefer stable conventional keys over ad hoc names.

Events

An event is a timestamped point inside a span, marking something that happened at a moment rather than over a duration. A common use is recording an exception, with the error message and stack as event attributes.

Together these let you answer not just how long but what and why. A slow span with an exception event and a status attribute points straight at the failure.

Key idea

Attributes are key value descriptions of a span and events are timestamped points inside it, together turning a timed span into a debuggable record.

Check yourself

Answer to earn rating on the learn ladder.

1. What is a span event?

2. Why avoid high cardinality attributes like raw user ids?