Plugin API
Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud. Availability This functionality is generally available and ready for production usage. The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability This functionality is generally available and ready for production usage. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes. The Elastic APM Java agent enables you to trace the execution of operations in your Java applications, sending performance metrics and errors to the Elastic APM Server. Availability This functionality is generally available and ready for production usage. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
Serverless Observability
Generally available
Stack
Generally available
APM Agent Java
Generally available
The plugin API of the Elastic APM Java agent lets you add custom instrumentation to the agent, which the agent will automatically apply the same way as it applies the internally defined instrumentation.
The plugin API is the OpenTelemetry API, plus a dependency to the Plugin SDK (apm-agent-plugin-sdk), and requires a version 1.31.0+ agent.
<dependency>
<groupId>co.elastic.apm</groupId>
<artifactId>apm-agent-plugin-sdk</artifactId>
<version>${elastic-apm.version}</version>
</dependency>
compile "co.elastic.apm:apm-agent-plugin-sdk:$elasticApmVersion"
Replace the version placeholders with the latest version from maven central:
An example repo and an article provide a detailed example of adding custom instrumentation for an application to the agent. An overview is
- subclass
co.elastic.apm.agent.sdk.ElasticApmInstrumentation - specify matchers the define which classes and methods will be instrumented
- add an instrumentation advice implementation
- create a
META-INF/services/co.elastic.apm.agent.sdk.ElasticApmInstrumentationfile which lists the fully qualified instrumentation class names, one class name per line - create a plugin jar that includes the instrumentation classes, the
co.elastic.apm.agent.sdk.ElasticApmInstrumentationfile, and any dependencies (apart from the agent itself, though including the plugin API as shown above) - start your application with the agent as normal, but additionally with the plugins_dir configuration option set to a directory which includes the created plugin jar (and which should only hold plugin jars, as the agent will attempt to load any jar in that directory).
To help our community, we’ve provided a page where you can list plugins you create that you think the community can use.