Class OpenTelemetryAgent


  • public class OpenTelemetryAgent
    extends java.lang.Object
    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 classloader, 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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void agentmain​(java.lang.String agentArgs, java.lang.instrument.Instrumentation inst)  
      static void main​(java.lang.String... args)
      Main entry point.
      static void premain​(java.lang.String agentArgs, java.lang.instrument.Instrumentation inst)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OpenTelemetryAgent

        public OpenTelemetryAgent()
    • Method Detail

      • premain

        public static void premain​(java.lang.String agentArgs,
                                   java.lang.instrument.Instrumentation inst)
      • agentmain

        public static void agentmain​(java.lang.String agentArgs,
                                     java.lang.instrument.Instrumentation inst)
      • main

        public static void main​(java.lang.String... args)
        Main entry point.
        Parameters:
        args - command line agruments