Is there a way to retrieve the local "root" span #7337
-
Is it possible to access the local root span without explicitly storing it in a thread-local or context variable at the beginning of the process? Our goal is to add an attribute to the root span from a point several spans deep in the trace. Related discussion: open-telemetry/opentelemetry-go#3457 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
The Java instrumentation uses https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/LocalRootSpan.java, but this is not part of the core SDK, and so only works if all of your instrumentation is using it. |
Beta Was this translation helpful? Give feedback.
The Java instrumentation uses https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/LocalRootSpan.java, but this is not part of the core SDK, and so only works if all of your instrumentation is using it.