OpenTelemetry context propagation with W3C TraceContext

OpenTelemetry context propagation with W3C TraceContext keeps a trace connected across services, queues and vendors. This page covers the default propagator, mixing B3 or vendor headers during migration, and where traces usually break.

On this page

How OpenTelemetry context propagation keeps traces connected

Context propagation is the mechanism that carries a trace's identity from one process to the next, so spans created in different services, over a network call or through a message queue still belong to the same trace. Without it, each service records its own disconnected fragments and the team cannot follow a request end to end. You need to plan it when you first instrument more than one service, and again whenever a new hop appears, such as a queue, a gateway, a third-party API or a second vendor's SDK.

OpenTelemetry context propagation lets traces, metrics and logs be correlated across process and network boundaries. The default propagator uses the headers defined by the W3C TraceContext specification, so a service instrumented with OpenTelemetry sends and reads trace context in that standard format without extra configuration. The key point for planning is that correlation depends on every hop reading and writing the same headers. A service that drops them, a proxy that rewrites them or a client library that uses a different format will split the trace at that point, even when each individual SDK is working correctly.

Before you build, inventory the boundaries your requests cross and confirm, for each one, whether the framework, HTTP client, message library and API gateway you use propagate W3C TraceContext by default. Check the propagator setting in each SDK and in any component that sits in the path, including your load balancers and gateways, and confirm with the vendor or project documentation what each one does with incoming trace headers. Record the gaps before rollout, because they are the places where traces will break once telemetry is live.

Propagator options and when each fits

This table compares the propagation formats you are likely to meet on a context propagation project, with the situations where each fits and its main trade-off. Read each row against the services and vendors in your own estate, then confirm the propagator setting in your SDK documentation before you change it.

PropagatorWhen it fitsMain trade-off
W3C TraceContext (default)Greenfield services and any estate where every service and vendor can read the standard traceparent and tracestate headersOlder services or gateways that only understand B3 or a vendor header will not join the trace without a bridge
B3 single headerServices already instrumented with Zipkin-style tracing that pass one compact b3 headerCarries trace identifiers only in a vendor-neutral but older format, so it needs explicit configuration alongside TraceContext during migration
B3 multi-headerLegacy Zipkin-style services and proxies that read separate X-B3 headersMore headers on every request, and more places where a proxy may strip or rename them
W3C BaggagePassing business context such as tenant or request class across services alongside the traceBaggage is not a trace ID carrier and adds header size on every hop, so keep values small and avoid sensitive data
Vendor-specific headersA single vendor's proprietary tracing headers that its agents require end to endLocks propagation to that vendor, and other services or gateways will drop the context unless you add a mapping
Multiple propagators in one SDKMixed fleets during migration, where some services emit one format and others read anotherSeveral formats can produce duplicate or conflicting context, so test which span links to which parent
Gateways and message queuesAny hop that rewrites headers or moves context into message attributesEach hop must carry the chosen format explicitly, and queues often need custom carrier code

How to roll out propagation across services

This sequence moves propagation from an inventory of every hop to a verified trace that crosses a service boundary, so each later service joins the rollout on a path already proven. Each step ends with a check that tells the team whether the context actually survived the hop.

  1. Inventory every hop in the request path

    The platform or architecture team lists every place a request or message can lose context: HTTP clients and servers, API gateways and load balancers, service meshes, message brokers, scheduled jobs, serverless entry points and third-party vendor calls. For each hop, record the protocol, the owning team and whether the component passes unknown headers through unchanged. The step is done when the list covers every path a customer request can take, and each entry names an owner. Gateways and brokers are the hops most often missed, so confirm them with the teams that run them.

  2. Choose the propagator set for each SDK

    Decide which propagators each SDK will use. The default propagator uses the W3C TraceContext headers, so most rollouts start there. If services still emit B3 or a vendor header, add those propagators temporarily so both formats are read and written during migration. Confirm the exact configuration keys in the documentation for each SDK and language in use, because the setting names differ. The step is done when a written table maps each service to its propagator set and each SDK's configuration is reviewed by the owning team.

  3. Enable propagation on one service pair

    Pick two services that call each other directly, ideally one with a well-understood HTTP client and one with a server framework the team already knows. Enable instrumentation for both, deploy to a non-production environment, and send a test request through the pair. Avoid changing gateways or brokers in this step so that any failure has a small number of possible causes. The step is done when the test request completes and both services emit spans.

  4. Confirm the traceparent header on outbound calls

    Inspect the outbound request from the calling service, using a debugging proxy, a request log or a test endpoint that echoes headers. Check that a traceparent header is present, that its trace ID matches the active span, and that the header is not stripped or rewritten by a client library, proxy or sidecar. If the header is missing, check whether the HTTP client instrumentation is enabled and whether an older library is overwriting headers. The step is done when a captured outbound request shows a valid traceparent value on every call in the test.

  5. Verify downstream spans share the parent

    In the tracing backend, open the test trace and confirm that the server span in the receiving service has the client span from the caller as its parent, and that both share one trace ID. This is the check that proves the boundary was crossed. If the downstream service starts a new trace, look for a second propagator mismatch, a framework that starts its own root span before the extractor runs, or a proxy that drops the header. The step is done when one trace ID appears in both services and the parent relationship is visible in the trace view.

  6. Extend the rollout hop by hop

    Add the next hop in the inventory, such as a gateway, a message broker or a second service, and repeat the header and parent checks for that hop before moving on. For queues, verify that the context is written into message headers or attributes and extracted by the consumer, and that the consumer's span links or parents to the producer as intended. Vendor calls need the same check, and some external services will not accept or return trace headers, which should be recorded as a known gap. The step is done when each hop in the inventory has a passing check or a documented exception.

  7. Retire legacy propagators after cutover

    When every service and hop emits and reads the W3C TraceContext headers, remove the temporary B3 or vendor propagators from SDK configuration and redeploy. Run the same header and parent checks on a sample of production traffic after the change, and watch for traces that break at a point you thought was migrated. Keep the propagator table current so that new services start with the agreed set. The step is done when the legacy formats are no longer emitted or read, and the sampled production traces show one trace ID across each boundary.

How context moves from one service to the next

The trace starts at the client request, which reaches the API gateway and gets a traceparent header injected by the instrumented edge. The gateway calls the order service, which extracts that context and continues the same trace. When the service publishes to a message queue, the producer injects the context into message metadata, and the consumer extracts it before starting its span. A legacy B3 service or vendor agent sits on one leg of the path, where a mismatch in propagators is the most common place the trace breaks. Check each hand-off, not just the first and last span.

Context injected at each hop and extracted on the receiving side, with a legacy B3 leg.

Where propagation usually breaks

Most broken traces are not bugs in OpenTelemetry itself. They happen at the edges where a request leaves one process and enters another, and where a component between them drops or rewrites the headers that carry trace identity. Each card below names a break point, the symptom it produces, and the check to run before you blame the SDK.

Gateways and proxies strip headers

Load balancers, API gateways, service meshes and WAFs sometimes remove or rewrite headers they do not recognize. The traceparent and tracestate headers defined by W3C TraceContext can be dropped this way, so each service starts a new root trace. The symptom is many single-span traces where you expect one request path. Check the raw headers at each hop, and confirm your proxy forwards both headers unchanged, including on retries and redirects.

Context propagation docs

Message queues drop metadata

Producers must write trace context into message headers or attributes, and consumers must read it back. Many queue clients or bridge libraries copy only the payload, or the broker discards custom headers on redelivery or dead-letter routing. The symptom is a consumer span that appears as an unrelated trace, or no link to the producing request at all. Check that the producer injects context on every publish path and that the consumer extracts it before starting its span.

Async jobs and thread pools lose context

Context is usually stored per thread or per async task. When work moves to a worker pool, a scheduled job or a callback that runs later, the active span is often missing, so the child work starts a fresh trace. The symptom is database or HTTP spans with no parent under a request span. Check that your runtime's context wrapper is applied to executors and callbacks, and that the context is captured when the task is created, not when it runs.

Mixed propagators during migration

Services still on B3 or vendor-specific headers cannot read W3C traceparent unless both formats are configured, and the reverse is also true. A composite propagator that injects and extracts several formats keeps traces joined during the transition. The symptom is traces that split at the boundary between an upgraded and a legacy service. Check the configured propagator list on both sides and confirm which header format each hop actually sends.

Propagator concepts

Third-party SaaS calls leave the trace

Calls to payment processors, identity providers and other SaaS APIs usually do not return your trace headers, and the vendor may not propagate them. Your client span ends at the boundary, and any work the vendor does is invisible to you. The symptom is a long external span with no child spans from the provider. Check whether the vendor documents W3C TraceContext support, and whether your client span records the peer service and error status so the gap is visible.

Browser and mobile clients start unlinked traces

Frontend code or mobile apps often start their own traces without forwarding context to the backend, or they send headers that CORS rules block. The symptom is backend traces that begin at the API with no user action or page load upstream. Check that your CORS policy allows the traceparent and tracestate request headers, that the client instrumentation injects them into API calls, and that the browser exposes response headers you need for correlation.

Running B3 or vendor headers alongside W3C TraceContext

The main risk in a staged rollout is a split trace. When some services emit only legacy headers such as B3 or a vendor-specific header, and others emit only traceparent, the backend receives spans that carry different trace IDs for the same request. Each side looks healthy on its own, but the request appears as two unrelated traces. The fix is to run more than one propagator during the transition. Services should extract every format they might receive and inject every format their downstream callers still need, so the trace identifier survives every hop regardless of which side of the migration the next service is on. In the OpenTelemetry SDKs this is configured through the propagator list, typically set with the OTEL_PROPAGATORS environment variable, where you name tracecontext first and add b3 or b3multi or your vendor format after it. Confirm the exact propagator names and their behavior for each language SDK you run against the current documentation before you write the configuration.

Migrate the edges and shared libraries first, then the leaves. Ingress proxies, API gateways, message producers and the HTTP client or messaging library wrappers your teams share are the places where headers are read and written most often, so changing them first moves the most traffic onto the new format at once. Services that sit deep in a call chain can follow, because the multi-propagator setup keeps their traces joined in the meantime. Work from the outside in, and make the gateway and shared libraries accept both formats before anything starts injecting only traceparent. Reversing the order, with leaf services switched first, usually means those services emit headers that the edge still drops or rewrites, and the trace breaks at the first hop. Your gateway configuration, ingress annotations and any custom proxies belong in the inventory, because they often strip unknown headers by default.

Confirm that no trace is split before removing the legacy format. Check the backend for root spans whose parent span belongs to a service that was already migrated, and for requests that show two trace IDs on the same entry point. Sampling the same request path through each migrated and unmigrated service helps. Once the checks are clean for the full traffic mix, including queues, batch jobs and calls to third-party vendors, you can remove the legacy propagator from each service. Keep the extract side of the legacy format a little longer than the inject side, since callers outside your control may still send old headers. Expect the verification step to be the longest part of the work, and ask any implementation partner to state how they will prove the join rate, not only that the configuration was deployed. The Migrating to OpenTelemetry content group covers the compatibility paths in more depth.

Security and privacy considerations for trace headers

Trace headers and baggage travel with every request, so they cross trust boundaries that a single service never sees. The four cards below cover what leaves your network, what should never be placed in context, where inbound context should be trusted or discarded, and how sensitive attributes are removed before telemetry is exported.

Outbound headers reach external parties

When an outbound HTTP call or message carries traceparent and baggage, the trace ID and any baggage entries leave your environment with it. A partner API, SaaS webhook or payment provider sees the identifiers and whatever key-value pairs you attached. Before enabling propagation on an external client, list the destinations, confirm which ones your data agreements allow to receive trace identifiers, and disable propagation for the rest in the SDK or HTTP client configuration.

Context propagation docs

Sensitive values in baggage

Baggage is designed to carry values between services, and it is copied into every downstream request that propagates it. Account numbers, email addresses, session tokens or national identifiers placed in baggage spread to every hop, every queue and every external party on the path. Keep baggage to low-sensitivity routing values such as tenant tier or feature flag, and review new baggage keys in code review the same way you review logged fields.

Gateways that trust inbound context

An edge gateway or load balancer that accepts traceparent from the public internet lets any caller pick the trace ID that your internal spans join. That can pollute traces, inject misleading baggage, or create a path for attacker-controlled values to reach internal dashboards. Decide per entry point whether to accept inbound context from trusted upstreams only, or to strip inbound trace headers and start a new trace at the boundary. Test both behaviors with a crafted request.

Redaction before export

Span attributes, span events and log records often capture URLs, query strings and headers that contain regulated data, even when the application never meant to log them. OpenTelemetry's security guidance describes the redaction processor as the way to remove sensitive attributes in the Collector before data is exported. Run it in the pipeline, test it with sample payloads, and confirm that the Collector configuration holding its rules is stored with encryption and access control.

Collector security practices

Questions teams ask before propagation work

How much effort does a context propagation rollout take?

Effort depends mostly on how many services, languages, queues and vendors carry requests end to end, because every hop is a place where the trace context can be dropped. A rollout across a few services in one language with synchronous HTTP calls is far smaller than one spanning many runtimes, message brokers, batch jobs and third-party APIs. The main drivers are:

  • The number of services and whether they share libraries or frameworks that already propagate context.
  • The number of languages and runtimes, since each needs its SDK or instrumentation configured and tested.
  • Asynchronous paths such as queues, event streams and scheduled jobs, which need the context carried inside message metadata.
  • External vendors and gateways, which may strip or rewrite headers you do not control.

Ask any partner to break the estimate down by these four drivers.

Can our own team handle propagation work in-house?

Yes, if you have engineers who own the services involved, can change shared libraries and can test cross-service requests in a non-production environment. Propagation is mostly configuration and library work, but it touches code in every service, so it needs owners who know each service's HTTP clients, queue producers and consumers. Teams without that coverage often find that the hard part is coordinating changes across owners rather than the propagator setting itself. A partner usually adds value by mapping the request paths, writing the test plan and handling the hops nobody on the team owns. Compare that against the time your owners can release from product work.

What do we need to provide for a propagation project?

You need named service owners for each system on a request path, access to gateways and proxies that sit between services, and a test environment where traffic resembles production. Owners confirm which clients and consumers exist and approve changes to their code and deployment. Gateway access matters because load balancers, API gateways and service meshes can drop or rewrite the traceparent and tracestate headers, and someone must be able to inspect and adjust their settings. A test environment lets you send requests through the full path before changing production. Ask the partner to list these inputs in the written scope before work starts.

Do we have to remove B3 headers to finish the migration?

No, you do not have to remove B3 headers immediately, but you do need a deliberate plan for mixed headers during the transition. The OpenTelemetry default propagator uses the headers defined by the W3C TraceContext specification, and teams often keep B3 propagation enabled alongside it while older services are still sending B3. Running both lets traces continue across old and new services during the cutover. The risk is that a service configured for only one format breaks the chain at the boundary. Remove B3 only after you have confirmed that no service on any path still depends on it, including queues and third-party integrations.

How do we confirm that traces are intact across services?

Confirm it by sending test requests through each path and checking that every span shares one trace ID from the entry point to the last downstream call. Look for the traceparent header on each outgoing request, and check that receiving services create child spans rather than new root traces. Test the paths that most often break: asynchronous message consumers, retries, batch jobs and calls routed through a gateway. Repeat the checks after each deployment, because a library upgrade or a new proxy can silently change behavior. Record the results per path so the owners can see which hops are verified and which are still open.

What is one-time work and what recurs after propagation is live?

The initial mapping, instrumentation changes, header handling at gateways and the first round of verification are one-time work. Recurring work includes checking new services and queues against the propagation standard, retesting paths after library and gateway upgrades, and watching for traces that break when teams change routing or vendors. Ongoing ownership usually sits with the platform or observability team, with each service owner responsible for keeping their hops correct. Ask any partner which items are included in the fixed scope and which would move to a support arrangement, and get both written down.

What DeployOpen scopes for a propagation project

A fixed-scope propagation engagement starts with a service inventory, not a code change. DeployOpen works with your team to list every service, worker, queue consumer, scheduled job, gateway and outbound vendor call that should carry trace context, and records which ones already emit spans, which use an older tracing library, and which sit behind a proxy or message broker that may drop headers. That inventory becomes the basis for the propagator decisions: whether the W3C TraceContext default is enough everywhere, which services must also read or write B3 or vendor headers during a migration, and where the propagator setting is configured in each runtime. Your architects confirm the decisions in writing before any instrumentation changes begin.

The build phase covers the instrumentation changes the decisions require: propagator configuration in each SDK or agent, explicit context extraction and injection for asynchronous work such as queue producers and consumers, and changes to the proxies, load balancers or gateways that strip or rewrite the traceparent and tracestate headers. Verification is part of the scope. DeployOpen defines test traces that cross each boundary in the inventory, checks that parent and child spans share one trace ID in your back end, and records the cases that still break. The deliverables typically include the propagator configuration as code, the verification results, an updated inventory and a handover session with your platform and service owners. Scope, deliverables and timelines are agreed in writing before work starts, and a quote follows from that written scope.

When you request a quote, ask the provider to name the services and boundaries covered, which propagators are in scope and for how long, who performs the changes in your repositories and pipelines, what evidence is delivered, and whether retesting after a later SDK upgrade is included or billed separately. Confirm the support model after handover, since header behavior can change when a proxy, broker or vendor SDK is upgraded. The OpenTelemetry context propagation documentation is a useful reference for your architects while they review the proposed scope.

How DeployOpen scopes, delivers and supports OpenTelemetry propagation

DeployOpen starts by mapping every hop where a request, message or job crosses a process, queue or vendor boundary, then agrees the propagation work in a written scope. The build, tests and handover run inside your own infrastructure, so your teams keep the trace context configuration they will operate.

How we scope

  • We map services, queues, gateways and third-party calls where trace context must pass
  • We record which propagators each service sends and reads today, including any B3 or vendor headers
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts

How we build

  • We configure the W3C TraceContext propagator consistently across SDKs and Collector pipelines in your environment
  • We set up a dual-propagation plan for migration, with a defined window for legacy headers
  • We test propagation at each boundary, including message headers and asynchronous jobs, and document the results

How we hand over

  • We deliver a propagation map, configuration files and a runbook that names each boundary and its owner
  • We document the known breakpoints, such as proxies that strip headers and clients that drop baggage
  • We walk your engineers through verification steps so they can recheck traces after future changes

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers
  • Retainers can cover re-verification after SDK, Collector or gateway upgrades
  • We can retest propagation when new services or vendors join the trace path

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.