Introductionedit

Welcome to the APM Java Agent documentation.

Elastic APM automatically measures the performance of your application and tracks errors. For example, it records spans for database queries and transactions for incoming HTTP requests. See Supported technologiesedit to learn about which frameworks and technologies the Elastic APM Java agent supports out-of-the-box.

Spans are grouped in transactions - by default one for each incoming HTTP request. But it’s possible to create custom transactions not associated with an HTTP request.

By default the agent comes with support for common frameworks out-of-the-box. To instrument other events, you can use custom spans. For information about custom spans, see the public api documentation.

The agent is only one of multiple components you need to get started with APM. Please also have a look at the documentation for

Get startededit

The first step in getting started with the Elastic APM Java agent ist to download the latest release of the agent jar file from maven central.

Note

Don’t declare a dependency to the agent in your application.

Configurationedit

Once you are set with instrumenting your favorite framework, see the configuration guide on how to configure Elastic APM.

Add javaagent flagedit

When starting your application, add the JVM flag -javaagent:/path/to/elastic-apm-agent-<version>.jar

Add javaagent flag for a Spring Boot applicationedit

Start your spring application and add the -javaagent JVM flag:

java -javaagent:/path/to/elastic-apm-agent-<version>.jar -jar my-spring-boot-application.jar

Add javaagent flag for Apache Tomcatedit

Create $CATALINA_BASE/bin/setenv.sh (or modify if the file already exists).

Add the following line:

setenv.sh. 

export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/path/to/elastic-apm-agent-<version>.jar"

Supported technologiesedit

The Elastic APM Java agent automatically instruments various APIs, frameworks and application servers. This section lists all supported technologies.

If your favorite technology is not supported yet, you can vote for it by participating in our survey. We will use the results to add support for the most requested technologies.

Another option is to get involved in the development of the agent. See the contributing guide for more details.

Java versionsedit

Vendor

Supported versions

Oracle JDK

7, 8, 9, 10

Open JDK

7, 8, 9, 10

IBM J9 VM

8

APIsedit

API

Supported versions

Description

JDBC

4.1+

The agent automatically creates DB spans for all your JDBC queries. This includes JDBC queries executed by O/R mappers like Hibernate.

Servlet API

3+

A transaction will be created for all incoming HTTP requests to your Servlet API-based application.

Frameworksedit

Framework

Supported versions

Description

Spring Web MVC

4.x, 5.x

If you are using Spring MVC (for example with Spring Boot), the transactions are named based on your controllers (ControllerClass#controllerMethod).

Spring Boot

1.5+, 2.x

Supports embedded Tomcat, Jetty and Undertow

Application Servers/Servlet Containersedit

The Elastic APM Java agent has generic support for the Servlet API 3+. However, some servers require special handling. The servers listed here are tested by an integration test suite to make sure Elastic APM is compatible with them. Other Servlet 3+ compliant servers will most likely work as well.

Server

Supported versions

Tomcat

7.x, 8.5.x, 9.x

WildFly

8-13

Jetty (only the ServletContextHandler is supported)

9.2, 9.3, 9.4

WebSphere

8.5.5, 18.0.x

Undertow Servlet

1.4