How to access Context values in the application that were set in the agent via a custom TextMapPropagator? #1847
Unanswered
brenlong83
asked this question in
Q&A
Replies: 1 comment
-
hi @brenlong83! I'd recommend asking this question in https://github.com/open-telemetry/opentelemetry-java-instrumentation |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have implemented a custom
TextMapPropagator
as a Java agent extension to propagate an access token across several micro services. That all works as expected.Now the interesting part, in some of the micro services we need to introspect the token.
The problem we are facing is the
ContextKey
doesn't match between the app definition and the agent definition asContextKey
is compared for equality by reference. Since the class is effectively duplicated in two class loaders (app/agent) the references don't match so from the application perspective the key is never set. It's frustrating because if we log theContext
object we see the token right there, only it's not accessible.What would be the recommended method to get app access to something that was originally set in the
Context
from the agent?Beta Was this translation helpful? Give feedback.
All reactions