3.5+ are supported. For a full list of supported libraries, visit the Compatibility Requirements page.
Follow the Quickstart instructions within the Datadog app for the best experience, including:
Otherwise, to begin tracing applications written in Python, install the Datadog Tracing library,
ddtrace, using pip:
pip install ddtrace
Note: This command requires pip version
18.0.0 or greater. For Ubuntu, Debian, or another package manager, update your pip version with the following command:
sudo -H pip3 install --upgrade pip
Then to instrument your Python application use the included
ddtrace-run command. To use it, prefix your Python entry-point command with
For example, if your application is started with
python app.py then:
ddtrace-run python app.py
Install and configure the Datadog Agent to receive traces from your now instrumented application. By default the Datadog Agent is enabled in your
datadog.yaml file under
apm_enabled: true and listens for trace traffic at
localhost:8126. For containerized environments, follow the links below to enable trace collection within the Datadog Agent.
apm_non_local_traffic: true in your main
datadog.yaml configuration file
See the specific setup instructions to ensure that the Agent is configured to receive traces in a containerized environment:
After having instrumented your application, the tracing client sends traces to
localhost:8126 by default. If this is not the correct host and port change it by setting the below env variables:
You can also set the hostname and port in code:
import os from ddtrace import tracer tracer.configure( hostname="custom-hostname", port="1234", )
DD_SITEin 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.
For more advanced usage, configuration, and fine-grain control, see Datadog’s API documentation.
When using ddtrace-run, the following environment variable options can be used:
It is recommended to use
DD_VERSION to set
version for your services. Refer to the Unified Service Tagging documentation for recommendations on how to configure these environment variables.
staging. Learn more about how to setup your environment. Available in version 0.38+.
postgres:postgresql,defaultdb:postgresql. Available in version 0.47+.
2020.02.13. Available in version 0.38+.
layer:api,team:intake. Available in version 0.38+.
false, the application code doesn’t generate any traces.
datadog.yamlfile, or the
Additional helpful documentation, links, and articles: