Instrument applications

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 Send data to Elasticsearch.

Step 1: Install APM agents

edit

APM agents are written in the same language as your service. To monitor a new service, you must install the agent and configure it with a service name, APM Server URL, and Secret token or API key.

  • Service name: Service names are used to differentiate data from each of your services. Elastic APM includes the service name field on every document that it saves in Elasticsearch. If you change the service name after using Elastic APM, you will see the old service name and the new service name as two separate services. Make sure you choose a good service name before you get started.

    The service name can only contain alphanumeric characters, spaces, underscores, and dashes (must match ^[a-zA-Z0-9 _-]+$).

  • APM Server URL: The host and port that APM Server listens for events on.
  • Secret token or API key: Authentication method for Agent/Server communication. See secure communication with APM Agents to learn more.

Select your service’s language for installation instructions:

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.