Enabling agent breaks nested spans #13919
Unanswered
lassemaatta
asked this question in
Q&A
Replies: 2 comments 3 replies
-
Please provide a minimal sample application that reproduces the issue along with any necessary instructions. |
Beta Was this translation helpful? Give feedback.
2 replies
-
I think I figured out the problem; I guess the Java instrumentation agent creates its own |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm implementing opentelemetry tracing for a clojure web application. I've built the tracing using the various Java classes (
io.opentelemetry.[api, context, sdk, ..].*
) and everything seems to be working fine. When accessing services through HTTP endpoints, I can see the resulting traces in e.g. Jaeger UI and spans are nested nicely. I use aTracer
to get aSpanBuilder
, create aSpan
and finally make it the current span.However, if I include the
opentelemetry-java-instrumentation
agent, I notice a couple of changes. First, the root span is created by the agent from within the Java HTTP server I use the moment a HTTP request arrives, which is nice. Also, I now get spans from my DB driver.Great.
Except, now all my spans are direct descendants of this root span and are no longer nested correctly. In other words, if I previously saw in Jaeger:
Instead, now I get:
Any ideas on how to fix this? I assume this has something to do with context propagation, but I haven't been able to figure what exactly I need to do. I did find some similar discussions related to Kotlin, but I'm doing just basic Java interop here.
Not sure if relevant, but when activating a new
Span
by callingspan.makeCurrent()
it would previously return aio.opentelemetry.context.ThreadLocalContextStorage$ScopeImpl
class. But when the agent is running, the same call returns aio.opentelemetry.context.ThreadLocalContextStorage$NoopScope/INSTANCE
object.Beta Was this translation helpful? Give feedback.
All reactions