Interface AgentExtension


  • public interface AgentExtension
    An AgentExtension provides a way to modify/enrich the OpenTelemetry Javaagent behavior. It can be an InstrumentationModule or a completely custom implementation. Because an extension can heavily modify the javaagent's behavior extreme caution is advised.

    This is a service provider interface that requires implementations to be registered in a provider-configuration file stored in the META-INF/services resource directory.

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      net.bytebuddy.agent.builder.AgentBuilder extend​(net.bytebuddy.agent.builder.AgentBuilder agentBuilder)
      Extend the passed agentBuilder with custom logic (e.g.
      String extensionName()
      Returns the name of the extension.
      default int order()
      Returns the order of adding extensions to the javaagent.
    • Method Detail

      • extend

        net.bytebuddy.agent.builder.AgentBuilder extend​(net.bytebuddy.agent.builder.AgentBuilder agentBuilder)
        Extend the passed agentBuilder with custom logic (e.g. instrumentation).
        Returns:
        The customized agent. Note that this method MUST return a non-null AgentBuilder instance that contains all customizations defined in this extension.
      • extensionName

        String extensionName()
        Returns the name of the extension. It does not have to be unique, but it should be human-readable: javaagent uses the extension name in its logs.
      • order

        default int order()
        Returns the order of adding extensions to the javaagent. Higher values are added later, for example: an extension with order=1 will run after an extension with order=0.