Course contentsShow
← Cloud and Infrastructure
Lesson 2084 of 2,98944. Observability - TracingFree lesson

Baggage and Cross-Cutting Concerns

Using baggage to propagate non-trace data across service boundaries for correlation and filtering purposes.

Baggage and Cross-Cutting Concerns

What You'll Learn

You'll learn how to use OpenTelemetry baggage to propagate business context and metadata across distributed service boundaries without cluttering your traces.

What is Baggage?

Baggage is a mechanism for carrying key-value pairs alongside your trace context as requests flow through your distributed system. Unlike span attributes that attach to specific spans, baggage travels with the request and remains accessible to every downstream service without being tied to tracing data.

Think of baggage like luggage tags on a suitcase traveling through airports. The tag (baggage) moves with the suitcase (request) through every checkpoint (service), allowing handlers at any location to read important information without opening the suitcase itself.

Cross-Cutting Concerns

Cross-cutting concerns are aspects of your system that affect multiple services but aren't part of core business logic—things like user IDs, tenant identifiers, feature flags, or experiment cohorts. Baggage solves the problem of propagating these values without:

  • Modifying every API contract to include them
  • Adding them to every span as attributes (which inflates trace storage)
  • Losing context when crossing service boundaries

Common Use Cases

Filtering and correlation: Attach a user_tier=premium baggage item to filter logs or traces for premium customers across all services, even those that don't directly know about user tiers.

Multi-tenancy: Propagate tenant_id so every service can log, filter, or apply policies without explicit parameter passing.

Feature flags: Carry experiment identifiers so downstream services can make conditional decisions.

Important Constraints

Baggage travels with every request, so keep items small and few. Unlike span attributes stored in your backend, baggage consumes network bandwidth and memory at runtime across all hops.

Key Takeaway: Baggage lets you propagate lightweight, non-trace metadata across service boundaries for correlation and filtering, solving cross-cutting concerns without polluting your trace data or API contracts.