JUnit4 suite-level TestExecutionListener callbacks see no active span under Bazel
I maintainer di solito rispondono entro 2 giorni
@daniel-mohedano ci sta già lavorando.
Dal 8/7/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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.
- Lingua principale
- Java
- Stelle
- 737
- Fork
- 362
- Merge medio
- 3g 18h
- PR unite (30g)
- 180
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di DataDog/dd-trace-java
-
Update DEFAULT_HTTP_CLIENT_ERROR_STATUSES to include 5xx status codesForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertatype: feature request
Difficoltà 1/5 1-3 ore Idoneità per principianti 70/100
DataDog/dd-trace-java#10245 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
gRPC server instrumentations (grpc-1.5, armeria-grpc) don't make extracted W3C baggage current in the handlerForse già presa @mcculls l’ha presa 7 giorni fa. Apertacomp: context propagation inst: grpc type: feature request
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
DataDog/dd-trace-java#12654 · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 62/100
DataDog/dd-trace-java#12608 ·
I maintainer di solito rispondono entro 2 giorni
-
type: bug report
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
DataDog/dd-trace-java#12597 ·
I maintainer di solito rispondono entro 2 giorni
-
Queueing-time profiler aborts the whole instrumentation install under a JDK 24+ AOT cache (zero spans); disabling that one feature is enoughForse già presa @mcculls l’ha presa 14 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
DataDog/dd-trace-java#12540 · 5 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di DataDog/dd-trace-java
Issue simili
-
[destination-snowflake] Custom domains rejected unlike source connectionsForse già presa @kuza55 l’ha presa oggi. Apertaautoteam community connectors/destination/snowflake team/use
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
area-dashboard
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
component/operate kind/feature-request
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Forge coverage prompts carry text the agent cannot act onForse già presa @graalvmbot l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
oracle/graalvm-reachability-metadata#10572 ·
I maintainer di solito rispondono entro 1 giorno
-
Bundled migration plansAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
IBM/sample-app-mod#55 ·