Inferensys

Glossary

B3 Propagation

B3 Propagation is a trace context propagation format that uses HTTP headers prefixed with 'X-B3-' to transmit trace and span IDs across service boundaries in a distributed system.
Developer building agentic RAG system, retrieval pipeline diagram on laptop, technical workspace with notes.
TRACE CONTEXT PROPAGATION FORMAT

What is B3 Propagation?

B3 Propagation is a specific HTTP header format for transmitting distributed trace context, originally developed for the Zipkin tracing system.

B3 Propagation is a trace context propagation format that uses HTTP headers prefixed with X-B3- to transmit the identifiers and sampling state necessary for distributed tracing. The core headers are X-B3-TraceId, X-B3-SpanId, and X-B3-Sampled, which carry the trace ID, span ID, and sampling decision, respectively, enabling instrumentation libraries to correlate work across service boundaries. This simple, text-based format was pioneered by Zipkin and became a de facto standard before the W3C Trace Context specification.

In modern observability stacks, B3 is implemented as a propagator within frameworks like OpenTelemetry, allowing for interoperability with legacy systems. While newer standards like W3C Trace Context offer more features, B3 remains widely supported for its simplicity. Its primary function is to ensure end-to-end tracing continuity by injecting context into outbound requests and extracting it from inbound requests, forming a complete trace composed of linked spans.

HEADER REFERENCE

Core B3 Headers

B3 Propagation is a trace context propagation format originally developed by Zipkin, using HTTP headers prefixed with 'X-B3-' to transmit trace and span IDs. These headers are the fundamental building blocks for linking distributed operations.

01

X-B3-TraceId

The X-B3-TraceId header carries a 128-bit or 64-bit globally unique identifier for the entire request trace. This ID is generated by the root service and must be propagated unchanged to all downstream services, enabling the correlation of all spans belonging to a single user request. It is typically represented as a 32-character (128-bit) or 16-character (64-bit) hexadecimal string.

  • Purpose: Uniquely identifies the end-to-end request.
  • Format: 32 or 16 character lowercase hex string (e.g., 463ac35c9f6413ad48485a3953bb6124).
  • Generation: Created once by the initiating service.
02

X-B3-SpanId

The X-B3-SpanId header carries a 64-bit identifier for the current unit of work (span) within a service. Each service creates a new Span ID for its operation. This ID, combined with the Trace ID, uniquely identifies a specific span in the distributed system.

  • Purpose: Identifies a single operation within a service.
  • Format: 16 character lowercase hex string (e.g., a2fb4a1d1a96d312).
  • Parent-Child: The Span ID of a parent span is passed to a child service as the X-B3-ParentSpanId.
03

X-B3-ParentSpanId

The X-B3-ParentSpanId header is optional and is used to explicitly define the parent-child relationship between spans. When a service (the client) calls another service (the server), it includes its own Span ID in this header. The receiving service uses this to link its new span as a child of the caller's span, constructing the trace's call graph.

  • Purpose: Establishes direct parentage between spans.
  • Inclusion: Sent by a calling service to the service it invokes.
  • Absence: If omitted, the receiving span is considered a root span within that trace.
04

X-B3-Sampled

The X-B3-Sampled header communicates the sampling decision for the trace. It is a single-character flag ('1', '0', 'd') that instructs downstream services whether to record and export span data for this request, which is critical for managing telemetry volume and cost.

  • '1': Debug. Record and export this trace, overriding any other sampling configuration.
  • '1': Sample. Record and export this trace.
  • '0': Do not sample. Process the request but do not record/export spans.
  • Decision Point: Typically made by the root service or a gateway.
05

X-B3-Flags

The X-B3-Flags header is used to communicate specific control flags for the trace. The most significant flag is the debug flag, which takes precedence over the X-B3-Sampled header. This header uses a bitmask representation, though it is often seen as a decimal integer ('1' for debug).

  • Debug Flag (bit 0): When set to 1, it forces sampling for the entire trace, regardless of other rules. This is used for actively troubleshooting specific requests.
  • Legacy Use: In older implementations, X-B3-Flags: 1 was equivalent to X-B3-Sampled: 1.
  • Precedence: Debug flag overrides all other sampling configurations.
06

Propagation Mechanics & Interoperability

B3 headers are injected into outbound HTTP requests by a propagator in the tracing SDK and extracted from inbound requests. While a de facto standard, B3 is largely superseded by the vendor-neutral W3C Trace Context standard for better interoperability. Modern systems often support both.

  • Injection/Extraction: Handled automatically by tracing libraries (e.g., OpenTelemetry SDK).
  • Limitation: B3 only supports a single parent, while W3C TraceContext supports multiple linked contexts.
  • Coexistence: Systems can be configured to read both B3 and W3C headers, with a defined precedence order for backward compatibility.
PROPAGATION FORMAT COMPARISON

B3 vs. W3C Trace Context

A technical comparison of two primary wire formats used for propagating distributed trace context across service boundaries.

FeatureB3 PropagationW3C Trace Context

Origin & Standardization

Developed by Zipkin; community-driven de facto standard

W3C Recommendation (formal web standard)

Header Prefix & Style

Uses 'X-B3-' prefix (e.g., X-B3-TraceId)

Uses 'traceparent' and 'tracestate' headers (no 'X-' prefix)

Trace ID Format

16 or 32 character lowercase hex string

32 character lowercase hex string (version 00 of traceparent)

Span ID Format

16 character lowercase hex string

16 character lowercase hex string

Parent Span ID

Separate 'X-B3-ParentSpanId' header

Encoded within the 'traceparent' header value

Sampling Decision

Separate 'X-B3-Sampled' header (0/1 or true/false)

Encoded as flags within the 'traceparent' header value

Debug/Trace Flag

Separate 'X-B3-Flags' header (1 for debug)

Encoded as flags within the 'traceparent' header value

Vendor/System State

Not natively supported; requires custom headers

Dedicated 'tracestate' header for multi-vendor key-value pairs

Primary Use Case

Legacy and Zipkin-centric deployments

Modern, vendor-interoperable systems and OpenTelemetry

OpenTelemetry Default

LEGACY & MODERN ECOSYSTEMS

Where is B3 Propagation Used?

B3 Propagation, as a foundational wire format for trace context, sees use in specific legacy systems, modern observability tools that prioritize compatibility, and environments where its simplicity is advantageous.

02

Legacy Microservices & Brownfield Deployments

In brownfield deployments and legacy microservice architectures built before the W3C Trace Context standard, B3 is often the de facto propagation format. Many older service meshes (like early Linkerd versions) and frameworks (like Spring Cloud Sleuth) defaulted to B3. Migrating these systems can be costly, so B3 remains in active use to maintain backward compatibility and avoid trace breakage.

03

Service Meshes and Proxies

Several service mesh implementations support B3 Propagation for trace context passing, often alongside other formats. For example:

  • Istio can be configured to propagate B3 headers.
  • Envoy proxy includes built-in support for generating and propagating B3 headers. This allows traces to flow seamlessly through the data plane, even if application code is not fully instrumented, providing network-level observability.
04

Multi-Format Observability Pipelines

Modern observability pipelines and backends are designed to handle multiple propagation formats simultaneously. Tools like the OpenTelemetry Collector can receive, parse, and normalize traces using B3, W3C Trace Context, and other formats into a single standard (like OTLP). This allows organizations with heterogeneous systems to maintain a unified view without forcing a immediate, system-wide format change.

05

Cross-Language Tracing Libraries

Many language-specific tracing SDKs and auto-instrumentation agents offer B3 support to ensure interoperability. For instance:

  • The OpenTelemetry SDKs for Java, Go, Python, etc., include B3 propagators.
  • Jaeger client libraries often support B3 alongside their native Uber headers. This ensures that services written in different programming languages can participate in the same trace when B3 is the chosen wire protocol.
06

Context Propagation in Asynchronous & Messaging Systems

B3 headers can be embedded within the metadata of asynchronous messaging systems (like Kafka, RabbitMQ) and RPC frameworks (like gRPC) to propagate trace context across non-HTTP boundaries. While less standardized than HTTP, this practice is used to trace workflows that involve message queues, ensuring the causal chain is not broken by asynchronous processing.

B3 PROPAGATION

Frequently Asked Questions

B3 Propagation is a trace context propagation format originally developed by Zipkin, using HTTP headers prefixed with 'X-B3-' to transmit trace and span IDs. This FAQ addresses common questions about its mechanics, use cases, and relationship to modern standards.

B3 Propagation is a specific wire format for distributed context propagation, using a set of HTTP headers prefixed with X-B3- to transmit trace context between services. It works by having the initiating service (the trace root) generate a Trace ID and initial Span ID, then inject these values into outbound HTTP request headers. Each downstream service extracts these headers, creates a new child span linked to the incoming parent span, and propagates the headers further, thereby stitching together a complete trace across service boundaries.

The core headers are:

  • X-B3-TraceId: The 128-bit or 64-bit globally unique identifier for the trace.
  • X-B3-SpanId: The 64-bit identifier for the current span.
  • X-B3-ParentSpanId: The Span ID of the parent span (omitted for the root span).
  • X-B3-Sampled: A flag (1 or 0) indicating whether the trace should be sampled and recorded.
  • X-B3-Flags: A debug flag that overrides the sampling decision, forcing trace collection.
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.