Skip to content

Support W3C baggage propagation across reactor-netty connect hand-off#12027

Open
mcculls wants to merge 1 commit into
masterfrom
mcculls/fix-reactor-w3c-propagation
Open

Support W3C baggage propagation across reactor-netty connect hand-off#12027
mcculls wants to merge 1 commit into
masterfrom
mcculls/fix-reactor-w3c-propagation

Conversation

@mcculls

@mcculls mcculls commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

Support W3C baggage propagation across reactor-netty connect hand-off

Motivation

The connect-span path carried only the active AgentSpan across the subscription -> I/O thread hand-off, dropping the rest of the Datadog Context (including baggage). Capture the full Context instead and build the continuation directly via Context.capture().

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@mcculls mcculls added type: bug fix Bug fix inst: reactor Reactor instrumentation labels Jul 22, 2026
@mcculls
mcculls force-pushed the mcculls/fix-reactor-w3c-propagation branch from 8f932ee to e984025 Compare July 22, 2026 11:19
The connect-span path carried only the active AgentSpan across the
subscription -> I/O thread hand-off, dropping the rest of the Datadog
Context (including baggage). Capture the full Context instead and
build the continuation directly via Context.capture().

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mcculls
mcculls force-pushed the mcculls/fix-reactor-w3c-propagation branch from e984025 to 3c15da8 Compare July 22, 2026 11:19
@mcculls
mcculls requested a review from Copilot July 22, 2026 11:20
@mcculls

mcculls commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes loss of W3C baggage during the Reactor Netty “connect” subscription → I/O thread hand-off by propagating the full Datadog Context (not just the active span) and capturing the continuation from that context.

Changes:

  • Store the full Datadog Context in Reactor’s ContextView during connect setup.
  • Build the connect-parent continuation via Context.capture() and transfer it to the Netty channel attribute.
  • Add a regression test asserting the outgoing request includes the W3C baggage header.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
dd-java-agent/instrumentation/reactor-netty-1.0/src/main/java/datadog/trace/instrumentation/reactor/netty/CaptureConnectSpan.java Captures and stores the full Datadog Context (instead of only activeSpan()) into the Reactor context for the connect path.
dd-java-agent/instrumentation/reactor-netty-1.0/src/main/java/datadog/trace/instrumentation/reactor/netty/TransferConnectSpan.java Transfers a ContextContinuation created from the captured Context onto the Netty channel attribute, preserving baggage and other context entries.
dd-java-agent/instrumentation/reactor-netty-1.0/src/test/java/ReactorNettyBaggagePropagationTest.java Adds a regression test verifying W3C baggage header propagation on an outgoing Reactor Netty request.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c15da8bd2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 65.66% (+8.27%)

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

@mcculls
mcculls marked this pull request as ready for review July 22, 2026 11:49
@mcculls
mcculls requested a review from a team as a code owner July 22, 2026 11:49
@mcculls
mcculls requested review from ygree and removed request for a team July 22, 2026 11:49
@dd-octo-sts dd-octo-sts Bot added the tag: ai generated Largely based on code generated by an AI or LLM label Jul 22, 2026
@mcculls
mcculls requested a review from jordan-wong July 22, 2026 11:49

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datadog Autotest: PASS

More details

The PR correctly fixes W3C baggage propagation across reactor-netty's thread hand-off by capturing the full Context instead of just the active span. This ensures baggage (and any other context data) survives the subscription → I/O thread transition. The new test validates baggage appears in outgoing request headers. The fix improves on the old code by also handling baggage-only scenarios.

Was this helpful? React 👍 or 👎

📊 Validated against 5 scenarios · Open Bits AI session

🤖 Datadog Autotest · Commit 3c15da8 · What is Autotest? · Any feedback? Reach out in #autotest

@mcculls mcculls added type: feature Enhancements and improvements and removed type: bug fix Bug fix labels Jul 22, 2026
@mcculls mcculls changed the title Fix W3C baggage propagation across reactor-netty connect hand-off Support W3C baggage propagation across reactor-netty connect hand-off Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

inst: reactor Reactor instrumentation tag: ai generated Largely based on code generated by an AI or LLM type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants