Get started with traces and APM

edit

Required role

The Admin role or higher is required to send APM data to Elastic. To learn more, refer to Assign user roles and privileges.

In this guide you’ll learn how to collect and send Application Performance Monitoring (APM) data to Elastic, then explore and visualize the data in real time.

Step 1: Add data
edit

You’ll use APM agents to send APM data from your application to Elastic. Elastic offers APM agents written in several languages and supports OpenTelemetry. Which agent you’ll use depends on the language used in your service.

To send APM data to Elastic, you must install an APM agent and configure it to send data to your project:

  1. Create a new Elastic Observability Serverless project, or open an existing one.
  2. To install and configure one or more APM agents, do one of following:

    • In your Observability project, go to Add dataMonitor my application performanceElastic APM and follow the prompts.
    • Use the following instructions:

      1. Install the agent

      Install the APM agent package using go get:

      go get -u go.elastic.co/apm/v2

      2. Configure the agent

      To simplify development and testing, the agent defaults to sending data to Elastic at http://localhost:8200. To send data to an alternative location, you must configure ELASTIC_APM_SERVER_URL.

      # The APM integration host and port
      export ELASTIC_APM_SERVER_URL=
      
      # If you do not specify `ELASTIC_APM_SERVICE_NAME`, the Go agent will use the
      # executable name. For example, if your executable is called "my-app.exe", then your
      # service will be identified as "my-app".
      export ELASTIC_APM_SERVICE_NAME=
      
      # API keys are used to authorize requests to the APM integration
      export ELASTIC_APM_API_KEY=

      3. Instrument your application

      Instrumentation is the process of extending your application’s code to report trace data to Elastic APM. Go applications must be instrumented manually at the source code level. To instrument your applications, use one of the following approaches:

      Learn more in the APM agent reference

      While there are many configuration options, all APM agents require:

      Option Description

      Service name

      The APM integration maps an instrumented service’s name — defined in each APM agent’s configuration — to the index where its data is stored. Service names are case-insensitive and must be unique.

      For example, you cannot have a service named Foo and another named foo. Special characters will be removed from service names and replaced with underscores (_).

      Server URL

      The host and port that the managed intake service listens for events on.

      To find the URL for your project:

      1. Go to the Cloud console.
      2. Next to your project, select Manage.
      3. Next to Endpoints, select View.
      4. Copy the APM endpoint.

      API key

      Authentication method for communication between APM agent and the managed intake service.

      You can create and delete API keys in Applications Settings:

      1. Go to any page in the Applications section of the main menu.
      2. Click Settings in the top bar.
      3. Go to the Agent keys tab.

      Environment

      The name of the environment this service is deployed in, for example "production" or "staging".

      Environments allow you to easily filter data on a global level in the UI. It’s important to be consistent when naming environments across agents.

  3. If you’re using the step-by-step instructions in the UI, after you’ve installed and configured an agent, you can click Check Agent Status to verify that the agent is sending data.

To learn more about APM agents, including how to fine-tune how agents send traces to Elastic, refer to Send APM data to Elastic.

Step 2: View your data
edit

After one or more APM agents are installed and successfully sending data, you can view application performance monitoring data in the UI.

In the Applications section of the main menu, select Service Inventory. This will show a high-level overview of the health and general performance of all your services.

Learn more about visualizing APM data in View and analyze traces.

Not seeing any data? Find helpful tips in Troubleshooting.

Next steps
edit

Now that data is streaming into your project, take your investigation to a deeper level. Learn how to use Elastic’s built-in visualizations for APM data, alert on APM data, or fine-tune how agents send traces to Elastic.