Interview Prep/Monitoring & Observability/Tracing and OpenTelemetry

How do you pass a tenant ID from the gateway to every downstream span without changing every service?

IntermediateScenarioTracing and OpenTelemetry
Answer

Situation read → You want a business attribute on all spans for filtering by customer.

What I'd do →

  1. At the gateway, set W3C baggage (baggage: tenant.id=acme).
  2. Instrumented services propagate baggage automatically.
  3. Add a span processor (e.g. baggage span processor in the SDK contrib packages) to copy baggage entries to span attributes.
  4. Never put secrets or PII in baggage; it travels in headers, including to third parties if not stripped.

Why → Baggage propagates with the trace context, so one change at the edge reaches all services.

Interview tip → Strip baggage at egress to external APIs.

All Monitoring & Observability questions Roadmap: Logging & tracing

More on Tracing and OpenTelemetry