Skip to content

Fix W3C baggage header not propagated on outgoing WebClient (Reactor Netty) requests#11512

Draft
dougqh wants to merge 1 commit into
masterfrom
fix/reactor-netty-baggage-propagation
Draft

Fix W3C baggage header not propagated on outgoing WebClient (Reactor Netty) requests#11512
dougqh wants to merge 1 commit into
masterfrom
fix/reactor-netty-baggage-propagation

Conversation

@dougqh
Copy link
Copy Markdown
Contributor

@dougqh dougqh commented May 30, 2026

Summary

  • CaptureConnectSpan stored only activeSpan() into the Reactor context at subscription time, discarding the full Datadog Context (which carries W3C baggage).
  • TransferConnectSpan then called captureSpan(span) on the Reactor I/O thread where no Datadog scope is active. The resulting continuation held a context of just the span — no baggage.
  • HttpClientRequestTracingHandler then called injectContext(current(), …) and BaggagePropagator.inject() found no Baggage entry, so the baggage header was silently skipped.

Fix: CaptureConnectSpan now also stores Context.current() (the full context including baggage) into the Reactor context alongside the span. TransferConnectSpan uses a new captureSpan(AgentSpan, Context) overload to build the continuation from the captured context, so baggage crosses the async boundary and is injected correctly.

The new overload is wired through AgentTracer, TracerAPI, CoreTracer, and ContinuableScopeManager.

Trace headers (traceparent, x-datadog-*) were unaffected because they come from the span object's trace context, not the thread-local baggage — this explains why those worked while baggage did not.

Fixes #11510

Test plan

Labels

inst:reactor-netty type:bug tag:ai generated

🤖 Generated with Claude Code

…requests

CaptureConnectSpan captured only the active span into the Reactor context at
subscription time, discarding the full Datadog Context (which carries baggage).
TransferConnectSpan then called captureSpan(span) on the Reactor I/O thread where
no Datadog scope is active, so the resulting continuation held a context of just
the span — no baggage.  HttpClientRequestTracingHandler.injectContext(current(),…)
therefore found no Baggage entry and skipped the baggage header.

Fix: CaptureConnectSpan now also stores Context.current() (the full context
including baggage) into the Reactor context alongside the span.
TransferConnectSpan uses the new captureSpan(AgentSpan, Context) overload to
build the continuation from that captured context, so baggage is carried across
the async boundary and injected correctly.

The new overload is wired through AgentTracer, TracerAPI, CoreTracer, and
ContinuableScopeManager.

Fixes: #11510

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@datadog-prod-us1-4
Copy link
Copy Markdown

datadog-prod-us1-4 Bot commented May 30, 2026

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 5 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-java | linux-java-insecure-bank-startup-parallel   View in Datadog   GitLab

🔄 Retry job. This looks flaky and may succeed on retry. Build not found for pipeline 116052216 (HTTP 404) when fetching Datadog Java Agent.

DataDog/apm-reliability/dd-trace-java | java-startup-parallel-check-slo-breaches   View in Datadog   GitLab

🛟 This job is unlikely to succeed on retry. Please review your pipeline configuration. No Markdown threshold comparison report was generated due to missing scenarios.

DataDog/apm-reliability/dd-trace-java | java-startup-parallel-generate-slos   View in Datadog   GitLab

🛟 This job is unlikely to succeed on retry. Please review your pipeline configuration. No matching artifact files found in the specified path: artifacts/slos-*.yaml.

View all 5 failed jobs.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: d61c3e0 | Docs | Datadog PR Page | Give us feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Baggage header not propagated on outgoing WebClient (Reactor Netty) requests

1 participant