Sending Traces to Datadog

Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.

To configure your application to send traces to Datadog:

Step 1 - Configure the Datadog Agent for APM

Beta: You can enable APM when installing the Agent with Single Step APM Instrumentation. Run a one-line install command to automatically enable APM and instrument all of your services on your Linux host, VM, or container.

If you don’t use Single Step APM Instrumentation, APM-specific configurations are required on both the Tracer and Agent to ensure that traces can be received from certain environment types, such as containerized or serverless. Ensure you have followed instructions for both components.

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.

  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.

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

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.

Step 2 - Instrument your application

When you add the Datadog tracing library to your code, it instruments the service and sends traces to the Datadog Agent. The Agent then sends the traces to the Datadog backend to be displayed in the UI.

The APM pipeline

Depending on the programming language and infrastructure you use, you have the following options to instrument your application:

Option 1 - Auto-instrument your application

For Kubernetes, hosts, and containers, you can auto-instrument your application by injecting the tracing library into your application. For more information and instructions, read Injecting Libraries Locally.

  • For Kubernetes, you can inject the library into applications written in Java, Python, Ruby (Beta), Node.js, and .NET.
  • Beta: For Linux hosts and containers, you can inject the library into applications written in Java, Python, Node.js, and .NET.

Option 2 - Manually instrument your application

For setup instructions, select your language:

Java
Python
Ruby
Go
Node.js
PHP
C++
.Net
.Net

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

Option 3 - Auto-instrument your application from the Datadog UI

This feature is in private beta.

For Kubernetes, you can inject the Java, Python, and Node.js tracing libraries from the Datadog UI.

For more information and instructions, read Injecting Libraries Remotely.

APM setup tutorials

The following tutorials guide you through setting up distributed tracing for a sample application on various infrastructure scenarios, with both automatic and custom instrumentation, using the direct method (Option 2):


Further reading

Documentation, liens et articles supplémentaires utiles: