Automatic Instrumentation

Overview

Automatic instrumentation allows you to create spans automatically for your application. It allows you to capture observability data from a wide range of standard operations and popular frameworks with minimal manual intervention. You can automatically instrument your application when you install the Datadog Agent with Single Step Instrumentation or when you manually add Datadog tracing libraries to your code.

Use cases

Some situations when you might use automatic instrumentation include:

  • Capturing essential observability data across common libraries and languages with minimal configuration.
  • Enabling real-time monitoring with pre-configured settings for immediate insights into application performance.
  • Simplifying the observability setup for projects where custom instrumentation is not required.

Getting started

Follow the relevant documentation for your automatic instrumentation approach to learn more:

If you install or update a Datadog Agent with the Enable APM Instrumentation (beta) option selected, the Agent is installed and configured to enable APM. This allows you to automatically instrument your application, without any additional installation or configuration steps.

To get started, read the Single Step Instrumentation documentation.

To automatically instrument your application with Datadog libraries:

  1. Install and configure the Agent.
  2. Add the Datadog tracing library to your code.

Install and configure the Agent

Install and configure the Datadog Agent to receive traces from your instrumented application. By default, the Datadog Agent is configured to receive traces in your datadog.yaml file under apm_config with enabled: true and listens for trace data at http://localhost:8126.

For containerized environments, follow the links below to enable trace collection within the Datadog Agent.

Containers

  1. Set apm_non_local_traffic: true in the apm_config section of your main datadog.yaml configuration file.
  2. See the specific setup instructions to ensure that the Agent is configured to receive traces in a containerized environment:
Docker
Kubernetes
Amazon ECS
ECS Fargate

  1. The trace client attempts to send traces to the Unix domain socket /var/run/datadog/apm.socket by default. If the socket does not exist, traces are sent to http://localhost:8126.

    If a different socket, host, or port is required, use the DD_TRACE_AGENT_URL environment variable. For example:

    DD_TRACE_AGENT_URL=http://custom-hostname:1234
    DD_TRACE_AGENT_URL=unix:///var/run/datadog/apm.socket
    

    Similarly, the trace client attempts to send stats to the /var/run/datadog/dsd.socket Unix domain socket. If the socket does not exist, then stats are sent to http://localhost:8125.

  1. Set DD_SITE in the Datadog Agent to to ensure the Agent sends data to the right Datadog location.

AWS Lambda

To set up Datadog APM in AWS Lambda, see the Tracing Serverless Functions documentation.

Other environments

Tracing is available for several other environments, such as Heroku, Cloud Foundry, AWS Elastic Beanstalk, and Azure App Service.

For other environments, see the Integrations documentation for that environment and contact support if you are encountering any setup issues.

Instrument your application

Set up your application to send traces using one of the following official Datadog tracing libraries:

Java
Python
Ruby
go
Node.js
PHP
C++
.Net
.Net
Android
iOS

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

Further reading

Additional helpful documentation, links, and articles:

PREVIEWING: brett0000FF/node-compatibility