Interface AgentExtension

All Superinterfaces:
io.opentelemetry.javaagent.extension.Ordered
All Known Implementing Classes:
InstrumentationLoader

public interface AgentExtension extends io.opentelemetry.javaagent.extension.Ordered
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

    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. instrumentation).
    Returns the name of the extension.

    Methods inherited from interface io.opentelemetry.javaagent.extension.Ordered

    order
  • Method Details

    • 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.