Honor single-trace WebSocket configuration for locally initiated spans - #12391
Draft
lrwh wants to merge 1 commit into
Draft
Honor single-trace WebSocket configuration for locally initiated spans#12391lrwh wants to merge 1 commit into
lrwh wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Does This Do
When
DD_TRACE_WEBSOCKET_MESSAGES_SEPARATE_TRACES=false, start locally initiatedwebsocket.sendandwebsocket.closespans as children of the WebSocket handshake span.The default
separate.traces=truebehavior remains unchanged: locally initiated spans follow the active context and link back to the handshake span.The shared WebSocket assertions and both Javax/Jakarta regression suites now cover locally initiated send and close spans in single-trace mode.
Motivation
Solves #12390.
The single-trace configuration already places receive and peer-initiated close spans on the handshake trace, but locally initiated send and close spans ignored it. Without an active application span they became roots of unrelated traces; with an active span they joined that span's trace instead.
Additional Notes
Validation:
./gradlew :dd-java-agent:instrumentation:websocket:javax-websocket-1.0:test --tests '*WebsocketTest' :dd-java-agent:instrumentation:websocket:jakarta-websocket-2.0:test --tests '*WebsocketTest' --no-daemongit diff --check datadog/master...HEADThe local root
spotlessChecktask could not complete becausespotlessInternalRegisterDependenciesfailed to provision external Eclipse P2 dependencies. No formatting changes were produced, and the targeted WebSocket tests compile and pass.No new configuration or instrumentation module is introduced; this aligns the existing implementation with the documented configuration semantics.
Contributor Checklist
type: bug fix,inst: websocket, andtag: ai generatedlabels (external contributors cannot apply repository labels)solvesJira ticket: N/A (external contributor)