Class ElasticApmAttacher

java.lang.Object
co.elastic.apm.attach.ElasticApmAttacher

public class ElasticApmAttacher extends Object
Attaches the Elastic Apm agent to the current or a remote JVM
  • Constructor Details

    • ElasticApmAttacher

      public ElasticApmAttacher()
  • Method Details

    • attach

      public static void attach()
      Attaches the Elastic Apm agent to the current JVM.

      This method may only be invoked once.

      Tries to load elasticapm.properties from the classpath, if exists.

      Throws:
      IllegalStateException - if there was a problem while attaching the agent to this VM
    • attach

      public static void attach(String propertiesLocation)
      Attaches the Elastic Apm agent to the current JVM.

      This method may only be invoked once.

      Parameters:
      propertiesLocation - the location within the classpath which contains the agent configuration properties file
      Throws:
      IllegalStateException - if there was a problem while attaching the agent to this VM
      Since:
      1.11.0
    • attach

      public static void attach(Map<String,String> configuration)
      Attaches the Elastic Apm agent to the current JVM.

      This method may only be invoked once.

      Parameters:
      configuration - the agent configuration
      Throws:
      IllegalStateException - if there was a problem while attaching the agent to this VM
    • attach

      public static void attach(String pid, Map<String,String> configuration)
      Attaches the agent to a remote JVM
      Parameters:
      pid - the PID of the JVM the agent should be attached on
      configuration - the agent configuration
    • attach

      public static void attach(String pid, Map<String,String> configuration, File agentJarFile)
      Attaches the agent to a remote JVM
      Parameters:
      pid - the PID of the JVM the agent should be attached on
      configuration - the agent configuration
      agentJarFile - the agent jar file
    • attach

      @Deprecated public static void attach(String pid, String agentArgs)
      Deprecated.
      Attaches the agent to a remote JVM
      Parameters:
      pid - the PID of the JVM the agent should be attached on
      agentArgs - the agent arguments
    • getBundledAgentJarFile

      public static File getBundledAgentJarFile()