Skip to content

How to communicate between agent context and application context #7485

Discussion options

You must be logged in to vote

Hey @wallezhang ,

The javaagent should propagate context automatically over threads in most cases (e.g. Context.current() called in a Runnable should return the context captured at the time when the runnable was submitted to an executor). Does that not work for you?

I create a new context in my application by Context.current(), and set this new context into a Map for cross thread communication. While read the context from Map by the agent instrumentation in another thread, a ClassCastException is thrown: class io.opentelemetry.javaagent.instrumentation.opentelemetryapi.context.AgentContextWrapper cannot be cast to class io.opentelemetry.javaagent.shaded.io.opentelemetry.context.Context.

T…

Replies: 1 comment 11 replies

Comment options

You must be logged in to vote
11 replies
@mateuszrzeszutek
Comment options

@wallezhang
Comment options

@wallezhang
Comment options

@mateuszrzeszutek
Comment options

@wallezhang
Comment options

Answer selected by wallezhang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants