Instrument applications with APM

edit

Elastic APM monitors software services and applications in real time, collects unhandled errors and exceptions, and automatically picks up basic host-level metrics and agent specific metrics.

If you haven’t already, you need to install Elasticsearch for storing and searching your data, Kibana for visualizing and managing it, and APM Server. For more information, see Spin up the Elastic Stack.

Step 1: Install APM agents
edit

Download the APM agent

Download the agent jar from Maven Central. Do not add the agent as a dependency to your application.

Start your application with the javaagent flag

Add the -javaagent flag and configure the agent with system properties.

  • Set required service name
  • Set custom APM Server URL (default: http://localhost:8200)
  • Set the base package of your application
java -javaagent:/path/to/elastic-apm-agent-<version>.jar \
     -Delastic.apm.service_name=my-application \
     -Delastic.apm.server_urls=http://localhost:8200 \
     -Delastic.apm.secret_token= \
     -Delastic.apm.application_packages=org.example \
     -jar my-application.jar

Learn more in the agent reference

Step 2: Configure APM
edit

Now that you’re up and running with Elastic APM, you may want to adjust some configuration settings. Luckily, there are many different ways to tweak and tune the Elastic ecosystem to adapt it to your needs.

Configure APM Agents

Central configuration allows you to fine-tune your agent configuration from within the APM app. Changes are automatically propagated to your APM agents, and there’s no need to redeploy.

A select number of configuration options are supported. See Agent configuration in Kibana for more information and a configuration reference.

Configure APM Server

If you’re running APM Server in Elastic cloud, you can configure your own user settings right in the Elasticsearch Service Console. Any changes are automatically appended to the apm-server.yml configuration file for your instance.

Full details are available in the APM user settings documentation.

Step 3: View your data in Kibana
edit

To view the Observability Overview page:

  1. Launch Kibana:

    1. Log in to your Elastic Cloud account.
    2. Navigate to the Kibana endpoint in your deployment.
  2. In the side navigation, select Observability, and click Overview.