Inferensys

Glossary

Propagator

A propagator is a component in a distributed tracing library responsible for injecting trace context into outbound requests and extracting it from inbound requests to maintain continuity across services.
Stylish WeWork-like workspace with hot desks and document wall, professional searching through enterprise knowledge base on a mounted ultrawide display, warm industrial pendants overhead.
DISTRIBUTED TRACE COLLECTION

What is a Propagator?

In distributed tracing, a propagator is the library component responsible for managing trace context across service boundaries.

A propagator is a component in a distributed tracing library responsible for injecting trace context into outbound requests and extracting it from inbound requests, following a specific wire format. Its core function is to serialize and deserialize the immutable span context—containing the trace ID, span ID, and sampling flags—into transport-specific headers (like HTTP) or message metadata, enabling distributed context propagation across a system.

Propagators implement standardized formats such as W3C Trace Context or vendor-specific ones like B3 Propagation to ensure interoperability between heterogeneous services. By managing this cross-process handoff, the propagator is the essential mechanism that allows tracing backends to reconstruct a complete, end-to-end trace from individually instrumented spans, forming the foundation for latency analysis and dependency mapping.

DISTRIBUTED TRACE COLLECTION

Core Responsibilities of a Propagator

A propagator is a critical component within a tracing library responsible for managing the flow of trace context across service boundaries. Its primary function is to ensure the continuity of a trace as a request traverses a distributed system.

01

Context Injection

The propagator injects the current trace context into the headers of an outbound request. This context includes the Trace ID, Span ID, and other metadata like trace flags and trace state. The specific headers and their format are dictated by the chosen propagation standard (e.g., traceparent for W3C, X-B3-TraceId for B3). This injection is what allows the next service in the chain to link its work to the ongoing trace.

02

Context Extraction

On the receiving end of a request, the propagator extracts the trace context from the incoming request's headers. It parses the headers according to the expected wire format and reconstructs a SpanContext object. This extracted context is then used to create a child span, ensuring the new operation is correctly parented within the existing trace. If no context is found, the propagator may start a new root trace.

03

Wire Format Compliance

A propagator implements a specific wire format protocol for serializing and deserializing trace context. Common standards include:

  • W3C Trace Context: The modern, vendor-neutral standard using traceparent and tracestate HTTP headers.
  • B3 Propagation: The format used by Zipkin, with headers like X-B3-TraceId and X-B3-SpanId.
  • Jaeger Propagation: Extends B3 with additional headers like uber-trace-id. The propagator must handle edge cases like multi-header formats and malformed data gracefully.
04

Multi-Format Support & Fallback

In heterogeneous environments, services may use different propagation formats. A robust propagator often supports multiple formats simultaneously. It will attempt extraction using a prioritized list of formats (e.g., try W3C first, then B3). Some advanced implementations can even inject context in multiple formats in a single outbound request to ensure compatibility with all downstream services, a pattern known as dual propagation.

05

Baggage Propagation

Beyond basic trace identifiers, many propagators are also responsible for handling distributed baggage. Baggage consists of key-value pairs that are propagated alongside the trace context, allowing user-defined data (e.g., user-id, feature-flag) to be passed transparently through the call chain. The propagator must inject and extract these baggage items according to the protocol's rules, often using a separate header like baggage.

06

Integration with Instrumentation

The propagator does not work in isolation. It is integrated into the tracing SDK's instrumentation for network clients and servers. For example:

  • In an HTTP client interceptor, it calls the inject method before sending the request.
  • In an HTTP server middleware, it calls the extract method as the first operation. This integration is often abstracted by frameworks (like OpenTelemetry's TextMapPropagator interface), allowing developers to swap propagation schemes without changing application code.
DISTRIBUTED TRACE COLLECTION

How Propagators Work in a Trace

A propagator is the core library component responsible for the transparent transmission of trace context across service boundaries, ensuring the continuity of a distributed trace.

A propagator is a component in a tracing library responsible for injecting trace context into outbound requests and extracting it from inbound requests, following a specific wire format. Its primary function is to serialize and deserialize the immutable span context—containing the trace ID, span ID, and sampling flags—into transport-specific headers (e.g., HTTP, gRPC, message queues). This enables distributed context propagation, allowing a single logical trace to be reconstructed from its constituent spans across a network of services.

Propagators implement standardized formats like W3C Trace Context or vendor-specific ones like B3 Propagation. During injection, the propagator encodes the current span's context into carrier headers. Upon extraction at the next service, it decodes these headers to establish the proper parent-child relationship for new spans. This mechanism is decoupled from span creation itself, allowing tracing systems to support multiple propagation formats simultaneously for interoperability in heterogeneous environments.

WIRE FORMAT COMPARISON

Common Trace Context Propagation Formats

A comparison of the primary wire formats used by propagators to inject and extract trace context across service boundaries.

Feature / SpecificationW3C TraceContextZipkin B3Jaeger

Standardization Body

W3C Recommendation

OpenZipkin Community

CNCF (Jaeger Project)

Primary Header(s)

traceparent, tracestate

X-B3-TraceId, X-B3-SpanId, X-B3-Sampled

uber-trace-id

Trace ID Format

32 hex chars (16 bytes), lowercase

32 or 16 hex chars

64-bit unsigned int, hex encoded

Span ID Format

16 hex chars (8 bytes), lowercase

16 hex chars

64-bit unsigned int, hex encoded

Sampling Decision Field

Trace flags (1 byte in traceparent)

X-B3-Sampled (0/1)

Flags byte (in uber-trace-id)

Supports Trace State

Vendor-Specific Extensions

Via tracestate key-value pairs

Via baggage headers (uberctx-*)

Default Propagation Medium

HTTP Headers, gRPC Metadata

HTTP Headers

HTTP Headers

OpenTelemetry SDK Default

IMPLEMENTATION PATTERNS

Propagators in Frameworks and SDKs

A propagator is the component within a tracing library responsible for the serialization and deserialization of trace context across service boundaries. This section details its concrete implementations across major observability frameworks.

01

OpenTelemetry SDK Propagators

The OpenTelemetry SDK provides a pluggable architecture for propagators, implementing the TextMapPropagator interface. Key built-in implementations include:

  • W3C TraceContext Propagator: Handles the traceparent and tracestate headers as per the W3C recommendation.
  • W3C Baggage Propagator: Manages the propagation of correlation context (baggage header).
  • B3 Propagator: Supports the Zipkin-originated B3 Propagation format (single and multi-header variants).
  • Jaeger Propagator: Handles the uber-trace-id header format used by Jaeger. Developers configure the global propagator via GlobalPropagators.set() to define the wire format for their services.
02

The TextMapPropagator Interface

This is the core abstraction for propagators in OpenTelemetry. It defines two critical methods:

  • inject(context, carrier, setter): Injects the current span context (trace ID, span ID, etc.) from the given context.Context into a carrier object (e.g., HTTP request headers). The setter is a callback that knows how to insert a key-value pair into that specific carrier type.
  • extract(context, carrier, getter): Extracts a span context from an incoming carrier (e.g., HTTP response headers) using the provided getter callback. It returns a new context.Context containing the extracted span context, or an invalid one if no context was found. This interface enables propagators to work with any transport (HTTP, gRPC, Kafka, etc.) via carrier-specific getter/setter functions.
03

Propagation in Messaging Systems

Propagators extend beyond HTTP to asynchronous communication. For systems like Apache Kafka, RabbitMQ, or AWS SQS, the trace context is injected into and extracted from message metadata (headers).

  • Carrier: The message's header map.
  • Challenge: Context must survive queueing and processing delays, linking producer and consumer spans across different traces via span links.
  • Implementation: SDKs provide helper getter and setter functions for common messaging clients. For example, the OpenTelemetry Kafka instrumentation uses a propagator to inject context into ProducerRecord.headers.
04

Composite and Custom Propagators

Real-world deployments often require multiple propagation formats.

  • Composite Propagator: Chains several propagators together. The SDK will attempt extraction using each propagator in sequence until one succeeds. This is essential for migrating between formats (e.g., from B3 to W3C) or in heterogeneous environments.
  • Custom Propagator: Organizations can implement the TextMapPropagator interface for proprietary header formats or to add business-specific context to the propagation carrier. This is also used for trace enrichment at the edge by injecting additional metadata (e.g., tenant ID) that downstream services can extract.
05

Propagator Configuration in Agents

Auto-instrumentation agents (e.g., Java Agent, .NET CLR Profiler) handle propagator configuration automatically. They detect common web and RPC frameworks and inject the appropriate instrumentation, using a default propagator (often W3C).

  • Environment Variables: The propagator can be configured via OTEL_PROPAGATORS, accepting values like tracecontext,baggage,b3.
  • Priority: The agent's configured propagator overrides any programmatic setup in the application code, ensuring consistency across a fleet of services instrumented via agents.
06

Propagation in gRPC and RPC Frameworks

gRPC uses HTTP/2 as its transport, so propagation occurs via HTTP headers. However, the integration is framework-specific.

  • OpenTelemetry gRPC Instrumentation: Provides interceptors (ClientInterceptor, ServerInterceptor) that automatically call the configured propagator's inject and extract methods on the gRPC metadata object.
  • Carrier: The Metadata object (key-value pairs).
  • Process: On the client side, the interceptor injects context into outgoing metadata. On the server side, the interceptor extracts context from incoming metadata, creating a proper parent-child relationship between the client and server spans.
PROPAGATOR

Frequently Asked Questions

A propagator is a critical component in distributed tracing responsible for managing the flow of trace context across service boundaries. These questions address its core functions, implementation, and role within modern observability frameworks.

A propagator is a component within a tracing library or SDK responsible for injecting trace context into outbound requests and extracting it from inbound requests, following a specific wire format standard. Its primary function is to ensure the span context—containing the trace ID, span ID, and other diagnostic information—is correctly passed between services, enabling the reconstruction of a complete, end-to-end trace. Without a propagator, spans generated in different services would be uncorrelated, breaking distributed visibility.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.