Trace, Span, and Service: Core Concepts

A trace represents a complete request or transaction as it moves through various services in a distributed system. It contains multiple spans, each representing a single unit of work within a service. A service is any independently deployable component that handles part of the transaction.

Trace

A trace is a collection of spans that together show the journey of a request across services. - Begins at the entry point (frontend, API gateway, etc.) - Captures timings, metadata, and flow - Enables end-to-end latency and performance analysis

Span

A span represents an individual operation within a service. - Contains start/end time, tags, and context - May be a parent (calling operation) or child (called operation) - Includes metadata: http.status_code, db.statement, etc.

Service

A service is a logically grouped unit of software with a network endpoint. - Examples: payment-service, auth-service, inventory-db - Services generate spans, send traces, and are the main units of observability

Relationships

  • One trace = many spans

  • Spans form a DAG (Directed Acyclic Graph)

  • Each span is assigned to a service