Skip to content

TSH-18197 - Propagate trace context on websocket upgrade request #8739

Closed
theJC wants to merge 4 commits intoapollographql:devfrom
theJC:fix/websocket_trace_propagation
Closed

TSH-18197 - Propagate trace context on websocket upgrade request #8739
theJC wants to merge 4 commits intoapollographql:devfrom
theJC:fix/websocket_trace_propagation

Conversation

@theJC
Copy link
Contributor

@theJC theJC commented Dec 9, 2025

TSH-18197

Router does not currently propagate the trace context for websocket connections. This is problematic and prevents important diagnostic and observability capabilities for Router subscriptions.

This simple PR adds propagation to the http request that is used to upgrade to websockets.

I have system tested this with Netflix DGS/Spring Boot based subgraphs with subscriptions instrumented with Datadog's dd-trace-java APM instrumentation library, and verified spans emanated from the subgraph for the subscription are now showing up and are associated with the trace.


Checklist

Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.

  • PR description explains the motivation for the change and relevant context for reviewing
  • PR description links appropriate GitHub/Jira tickets (creating when necessary)
  • Changeset is included for user-facing changes
  • Changes are compatible1
  • Documentation2 completed
  • Performance impact assessed and acceptable
  • Metrics and logs are added3 and documented
  • Tests added and passing4
    • Unit tests
    • Integration tests
    • Manual tests, as necessary

Exceptions

Note any exceptions here

Notes

Footnotes

  1. It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this.

  2. Configuration is an important part of many changes. Where applicable please try to document configuration examples.

  3. A lot of (if not most) features benefit from built-in observability and debug-level logs. Please read this guidance on metrics best-practices.

  4. Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

@theJC theJC marked this pull request as ready for review December 9, 2025 05:48
@theJC theJC requested a review from a team December 9, 2025 05:48
@theJC theJC requested a review from a team as a code owner December 9, 2025 06:12
@theJC theJC changed the title Fix: Propagate trace context on websocket upgrade request Fix: TSH-18197 - Propagate trace context on websocket upgrade request Dec 9, 2025
@theJC theJC changed the title Fix: TSH-18197 - Propagate trace context on websocket upgrade request TSH-18197 - Propagate trace context on websocket upgrade request Dec 9, 2025
@aaronArinder
Copy link
Contributor

heyo @theJC, this is great; thank you! I'm going to fumble around a bit to see if I can't get mergify to copy this branch to the repo so I don't have to clone yours to review locally (as an explanation for the coming noise)

@aaronArinder
Copy link
Contributor

@mergify help

@mergify
Copy link
Contributor

mergify bot commented Dec 9, 2025

help

❌ Sorry but I didn't understand the command. Please consult the commands documentation 📚.

@aaronArinder
Copy link
Contributor

@mergify copy dev

@mergify
Copy link
Contributor

mergify bot commented Dec 9, 2025

copy dev

✅ Pull request copies have been created

Details

@aaronArinder
Copy link
Contributor

nice, that seems to have worked; I'll check it out and review/respond there, but you'll still get credit for the commit

);

// Give the WebSocket connection time to complete the upgrade
tokio::time::sleep(Duration::from_millis(1000)).await;
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of doing this, can we try to pass something like a channel wrapped in a tokio timeout to make sure it won't be flacky ?

Copy link
Contributor

Choose a reason for hiding this comment

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

ack; will do

aaronArinder added a commit that referenced this pull request Dec 10, 2025
…#8739) (#8746)

Co-authored-by: Jon Christiansen <467023+theJC@users.noreply.github.com>
Co-authored-by: Aaron Arinder <aaronarinder@gmail.com>
@aaronArinder
Copy link
Contributor

the mergify pr was merged; closing, thanks @theJC!

@theJC theJC deleted the fix/websocket_trace_propagation branch December 10, 2025 16:28
briannafugate408 pushed a commit that referenced this pull request Jan 9, 2026
…#8739) (#8746)

Co-authored-by: Jon Christiansen <467023+theJC@users.noreply.github.com>
Co-authored-by: Aaron Arinder <aaronarinder@gmail.com>
briannafugate408 pushed a commit that referenced this pull request Jan 21, 2026
…#8739) (#8746)

Co-authored-by: Jon Christiansen <467023+theJC@users.noreply.github.com>
Co-authored-by: Aaron Arinder <aaronarinder@gmail.com>
@abernix abernix mentioned this pull request Jan 27, 2026
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.

3 participants