Package io.opentelemetry.javaagent
Class OpenTelemetryAgent
java.lang.Object
io.opentelemetry.javaagent.OpenTelemetryAgent
Premain-Class for the OpenTelemetry Java agent.
The bootstrap process of the agent is somewhat complicated and care has to be taken to make sure things do not get broken by accident.
JVM loads this class onto app's class loader, afterwards agent needs to inject its classes onto bootstrap classpath. This leads to this class being visible on bootstrap. This in turn means that this class may be loaded again on bootstrap by accident if we ever reference it after bootstrap has been setup.
In order to avoid this we need to make sure we do a few things:
- Do as little as possible here
- Never reference this class after we have setup bootstrap and jumped over to 'real' agent code
- Do not store any static data in this class
- Do dot touch any logging facilities here so we can configure them later
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
agentmain
(String agentArgs, Instrumentation inst) static void
Main entry point.static void
premain
(String agentArgs, Instrumentation inst)
-
Method Details
-
premain
-
agentmain
-
main
Main entry point.- Parameters:
args
- command line arguments
-