Join us at the Dash conference! July 16-17, NYC

APM Setup

This documentation covers Agent v6 only, to know how to set up APM tracing with Agent v5, refer to the dedicated APM with Agent v5 doc.

Setup process

With Datadog’s infrastructure monitoring, metrics are sent to the Agent, which then forwards them to Datadog. Similarly, tracing metrics are also sent to the Agent: the application code instrumentation flushes to the Agent every second (see here for the Python client for instance) and the Agent flushes to the Datadog API every 10 seconds.

To start tracing your application:

  1. Install the Datadog Agent: Install and configure the latest Datadog Agent. (On macOS, install and run the Trace Agent in addition to the Datadog Agent. See the macOS Trace Agent documentation for more information).

  2. Enable trace collection for the Datadog Agent. See below dedicated instructions.

  3. Configure your environment: An environment is a mandatory primary tag used to scope a whole Datadog APM application. A common use case is to disaggregate metrics from stage environments such as production, staging, and pre-production. Learn how to configure primary tags.

  4. Instrument your application:

To instrument an application written in a language that does not yet have official library support, visit the list of community tracing libraries.

Finally, start monitoring your app’s performance: within a few minutes of running APM, your services will appear in the APM home page. See Using the APM UI to learn more.

Agent configuration

Trace collection

To enable trace collection for your Agent, update the apm_config key in your Agent datadog.yaml main configuration file:

  enabled: true

Reference the dedicated documentation to setup tracing with Docker.

Find below the list of all available parameters for your datadog.yaml configuration file:

File setting Type Description
enabled boolean When set to true, the Datadog Agent accepts trace metrics. Default value is true.
apm_dd_url string Datadog API endpoint where traces are sent.
env string Default environment to which traces should be registered under (e.g. staging, production, etc..).
extra_sample_rate float Use this setting to adjust the trace sample rate. The value should be a float between 0 (no sampling) and 1 (normal sampling). Default value is 1.
max_traces_per_second float Maximum number of traces to sample per second. Set to 0 to disable the limit (not recommended). The default value is 10.
ignore_resources list A list of resources that the Agent should ignore.
log_file string Location of the log file.
replace_tags list A list of tag replacement rules. Read more about scrubbing sensitive data with replace rules.
receiver_port number Port that the Datadog Agent’s trace receiver listen on. Default value is 8126.
apm_non_local_traffic boolean Set to true to allow the Agent to receive outside connections, and then listen on all interfaces.
max_memory float Maximum memory that the Agent is allowed to occupy. When this is exceeded the process is killed.
max_cpu_percent float Maximum CPU percentage that the Agent should use. The Agent automatically adjusts its pre-sampling rate to stay below this number.

To get a an overview of all the possible settings for APM, take a look at the Agent’s datadog.example.yaml configuration file. For more information about the Datadog Agent, see the dedicated doc page or refer to the datadog.yaml templates.

Further Reading