JUnit4 suite-level TestExecutionListener callbacks see no active span under Bazel
メンテナーはふだん 2 日以内に返信
@daniel-mohedano がすでに取り組んでいます。
2026年7月8日 から。
評価
この issue はまだ評価されていません。
説明
Tracer Version(s)
1.63.1, 1.62.0
Java Version(s)
21.0.6
JVM Vendor
Azul Zing / Zulu
Bug Report
We attach custom test metadata to CI Visibility spans via a org.junit.platform.launcher.TestExecutionListener registered on the JUnit Platform Launcher (tried both META-INF/services auto-registration and explicit registerTestExecutionListeners()). This listener calls GlobalTracer.get().activeSpan() inside executionStarted/executionFinished to tag the currently-active span.
For JUnit4 tests bridged through junit-vintage-engine:
Method-level spans: activeSpan() resolves correctly and our tags apply.
Suite-level (container) spans, under Bazel: activeSpan() is reliably null at both executionStarted and executionFinished, even though the suite span itself is still created and reported to Datadog correctly (correct duration/status/etc — just without our tags).
We have a separate, non-Bazel test runner that invokes the exact same JUnit Platform Launcher API directly (LauncherFactory.openSession(), explicit listener registration, selectClass(...)) and registers an equivalent listener doing the same activeSpan() lookup — and it successfully tags suite-level spans in production. So this isn't a general limitation of the plain Launcher API path; something about the Bazel environment specifically prevents the suite span from being visible as "active" to an external TestExecutionListener.
What we've ruled out
We suspected a version regression between 1.62.0 and 1.63.1 (a bytecode diff showed 1.63.1 removed a lazy-suite-autostart fallback from JUnit4TracingListener that existed in 1.62.0, landing in the same PR that added Bazel-wrapper-specific suite-event handling). We tested this directly: swapped Bazel's agent from 1.63.1 down to 1.62.0 for the same test class, same Bazel launch setup. Result: activeSpan() is still null for the suite container on 1.62.0 too.
Expected Behavior
A suite-level TestExecutionListener callback should be able to observe the active suite span via GlobalTracer.get().activeSpan() under Bazel, consistent with how it behaves for the same JUnit Platform Launcher API used outside Bazel.
Reproduction Code
- A JUnit4 test class run via junit-vintage-engine under the JUnit Platform Launcher, under Bazel, with a custom main_class = "org.junit.platform.console.ConsoleLauncher" (i.e., not Bazel's native BazelTestRunner/RunNotifierWrapper).
- Register a TestExecutionListener that calls GlobalTracer.get().activeSpan() inside executionStarted/executionFinished for container-type TestIdentifiers.
- Observed on both dd-java-agent 1.62.0 and 1.63.1: activeSpan() is null for the suite container, both at start and finish.
- The equivalent pattern (plain Launcher API, explicit listener registration) works outside Bazel in our environment, on 1.62.0.
- 主要言語
- Java
- スター
- 736
- フォーク
- 364
- 平均マージ
- 3日 9時間
- マージ済み PR(30日)
- 219
環境構築
- 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 · リアクション 3 件 ·
メンテナーはふだん 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 日以内に返信
-
dd-trace-ot 1.67.x: NoClassDefFoundError `ddtrot/dd/trace/api/llmobs/LLMObs`対応中かも @amarziali が今日担当しました。 オープンtype: bug report
DataDog/dd-trace-java#12857 · リアクション 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
type: feature request
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
DataDog/dd-trace-java#12838 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
Startup ~2x slower with AOT class linking: agent retransforms ~22k preloaded classes (JDK 25, 1.67.0)対応中かも @mcculls が 6 日前に担当しました。 オープンtype: bug report
DataDog/dd-trace-java#12795 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
DataDog/dd-trace-java の issue をすべて見る
似ている issue
-
RRateLimiter acquire methods accept negative permits and raise available permits above the rate.オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 4 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
krahets/hello-algo#1993 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
NationalSecurityAgency/ghidra#9884 ·
メンテナーはふだん 2 日以内に返信
-
Status: Pending Review Type: Feature Request
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
OpenRefine/OpenRefine#8019 ·
メンテナーはふだん 1 日以内に返信
-
`timer` rule rejects dates the engine accepts対応中かも @MFA-G が今日担当しました。 オープンbug ready
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
camunda/bpmnlint-plugin-camunda-compat#281 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信