Search

Search IconIcon to open search

Context Propagation

Last updatedUpdated: by Jakub Žovák · 2 min read

Properties
created 14.04.2026, 17:00
modified 26.07.2026, 13:29
published Empty
topics Distributed Tracing, Observability
authors Empty
ai-assisted Yes
  • Mechanism for passing trace context (traceId, spanId) across process boundaries ( OTel Context Propagation)
  • Without propagation, each service would start a new independent trace — no end-to-end visibility

# How It Works

  1. Service A starts a span, holds traceId + spanId in local context
  2. Before making an outbound HTTP/gRPC call, A injects context into the request headers
  3. Service B receives the request, extracts context from headers
  4. B creates a new child span using A’s spanId as parentSpanId and the same traceId
  5. The two spans are now linked in the same trace tree

# W3C Trace Context (traceparent)

  • Standard HTTP header for trace propagation ( W3C Trace Context Spec)
  • Format: traceparent: 00-{traceId}-{parentSpanId}-{flags}
    • 00 — version
    • traceId — 32 hex chars (128-bit)
    • parentSpanId — 16 hex chars (64-bit)
    • flags01 = sampled, 00 = not sampled
  • Example
    1
    
    traceparent: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01
    
  • tracestate header — optional vendor-specific metadata alongside traceparent

# Propagation Formats

FormatHeaderNotes
W3C Trace ContexttraceparentOTel default, modern standard
B3 (Zipkin)X-B3-TraceId, X-B3-SpanIdLegacy, widely supported
Jaegeruber-trace-idJaeger-specific
AWS X-RayX-Amzn-Trace-IdAWS services
  • OTel supports multiple propagators simultaneously — useful when integrating with legacy services

# Baggage

  • Alongside trace context, OTel allows propagating arbitrary key-value baggage
  • Propagated via baggage HTTP header
  • Use case: pass user.id or tenant.id through the whole call chain for log correlation
  • Warning: baggage is sent with every outbound request — keep it small