WebSocket locally initiated spans ignore single-trace configuration
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 75/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- java
調査の方向性
WebsocketDecorator.onFrameStart から開始し、traceStarter と useDedicatedTraces の分岐がローカルで開始された操作の span コンテキストをどのように選択するかを追跡します。DD_TRACE_WEBSOCKET_MESSAGES_SEPARATE_TRACES=false を指定して Jakarta WebSocket のケースを再現し、websocket.send と websocket.close がハンドシェイクの trace を共有することを確認します。その一方で、デフォルトの true の動作は変更されないことも確認します。
索引モデルが issue の本文から書いたものです。
説明
Tracer Version(s)
1.65.1 and current master (a1b6599a5f9f8d803cfac89fa1c3befe41b8c33f)
Java Version(s)
Oracle JDK 21.0.3
JVM Vendor
Oracle JDK
Bug Report
When DD_TRACE_WEBSOCKET_MESSAGES_SEPARATE_TRACES=false, received messages and peer-initiated close spans use the handshake span context, but locally initiated websocket.send and websocket.close spans still use the currently active context.
If there is no active span when Session.close() or RemoteEndpoint.send*() is called, those spans become roots of new traces. If another business span is active, they join that trace instead. In both cases they have a different trace ID from the WebSocket handshake.
This behavior comes from WebsocketDecorator.onFrameStart: the useDedicatedTraces setting is only checked when traceStarter is true. The traceStarter == false branch always calls startSpan(..., operationName) without the handshake context.
This was reproduced with Jakarta WebSocket and Tyrus 2.2.0, but the behavior is in the shared WebSocket decorator and is not Tyrus-specific.
The current result for one short-lived connection is:
websocket.open trace=A
websocket.receive trace=A
websocket.send trace=B
websocket.close trace=C
Expected Behavior
The Java configuration documentation says that setting DD_TRACE_WEBSOCKET_MESSAGES_SEPARATE_TRACES=false causes all spans captured during the session to be in the same trace. Locally initiated send and close spans should therefore use the handshake trace as well:
websocket.open trace=A
websocket.receive trace=A
websocket.send trace=A
websocket.close trace=A
When the setting remains at its default value of true, the existing behavior of outgoing operations following the current trace and linking to the handshake should remain unchanged.
Documentation: https://docs.datadoghq.com/tracing/trace_collection/library_config/java/#websocket_messages
Reproduction Code
Session session = client.connectToServer(endpoint, config, uri);
session.getBasicRemote().sendText("hello");
session.close(new CloseReason(CloseReason.CloseCodes.NORMAL_CLOSURE, "done"));
Run without an active application span around sendText and close, with:
DD_TRACE_WEBSOCKET_MESSAGES_SEPARATE_TRACES=false
DD_TRACE_WEBSOCKET_MESSAGES_ENABLED=true
Compare the trace IDs of the handshake, receive, send, and close spans.
- 主要言語
- Java
- スター
- 736
- フォーク
- 364
- 平均マージ
- 3日 13時間
- マージ済み PR(30日)
- 213
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DataDog/dd-trace-java のほかの issue
-
type: bug report
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
DataDog/dd-trace-java#12818 ·
メンテナーはふだん 2 日以内に返信
-
Update DEFAULT_HTTP_CLIENT_ERROR_STATUSES to include 5xx status codes再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンtype: feature request
難易度 1/5 1〜3時間 初心者へのやさしさ 70/100
DataDog/dd-trace-java#10245 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Startup ~2x slower with AOT class linking: agent retransforms ~22k preloaded classes (JDK 25, 1.67.0)対応中かも @mcculls が 1 日前に担当しました。 オープンtype: bug report
DataDog/dd-trace-java#12795 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
gRPC server instrumentations (grpc-1.5, armeria-grpc) don't make extracted W3C baggage current in the handler対応中かも @mcculls が 12 日前に担当しました。 オープンcomp: context propagation inst: grpc type: feature request
難易度 3/5 1〜2日 初心者へのやさしさ 78/100
DataDog/dd-trace-java#12654 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 62/100
DataDog/dd-trace-java#12608 ·
メンテナーはふだん 2 日以内に返信
DataDog/dd-trace-java の issue をすべて見る
似ている issue
-
[BUG] 订单:会员凭订单号即可取消其他会员的待付款订单(取消接口不校验订单归属)対応中かも @dadiyang が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
macrozheng/mall#1016 ·
-
[Bug] The producer summary counts an unreported client version as a second version and warns about a version mix対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
apache/rocketmq-dashboard#6110 ·
メンテナーはふだん 4 日以内に返信
-
Python 3.15 support対応中かも @amnesiaof が今日担当しました。 オープンL: python L: python:uv
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
dependabot/dependabot-core#16524 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
`Processing lsp` never exits and leaves orphaned processes対応中かも @overcast302 が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
processing/processing4#1578 · コメント 1 件 ·
-
bug needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
PlayersCommittee/gemp-swccg-public#1174 ·
メンテナーはふだん 2 日以内に返信