Skip to content

Is there a way to find out if my application is running with the agent already active? #9173

Answered by laurit
evantorrie asked this question in Q&A
Discussion options

You must be logged in to vote

Is there a way for my application to know that the agent is running?

I think the easiest way is to Class.forName("io.opentelemetry.javaagent.OpenTelemetryAgent") or some other class that is present in the agent, and if it is found assume that you are running with the agent.

a) pass the SDK I've configured in my app to the agent to use?

no

b) get a handle to the SDK that the agent instantiates via AutoConfigure?

yes, use GlobalOpenTelemetry.get()

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@evantorrie
Comment options

@trask
Comment options

@evantorrie
Comment options

Answer selected by evantorrie
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants