3.5+ are supported. For a full list of supported libraries, visit the Compatibility Requirements page.
If you already have a Datadog account you can find step-by-step instructions in our in-app guides for either host-based or container-based set ups.
Next, install the Datadog Tracing library,
ddtrace, using pip:
pip install ddtrace
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
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:
|Enable debug logging in the tracer.|
|Override the modules patched for this application execution. It should follow the format: |
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.
|Set the application’s environment, for example: |
|The service name to be used for this application. The value is passed through when setting up middleware for web framework integrations like Pylons, Flask, or Django. For tracing without a web integration, it is recommended that you set the service name in code. Available in version 0.38+.|
|Set the application’s version, for example: |
|A list of default tags to be added to every span, profile, and runtime metric, for example: |
|Enable web framework and library instrumentation. When |
|Override the address of the trace Agent host that the default tracer attempts to submit traces to.|
|Override the port that the default tracer submit traces to.|
|The URL of the Trace Agent that the tracer submits to. Takes priority over hostname and port, if set. Supports Unix Domain Sockets in combination with the |
|Enable Priority Sampling.|
|Enable connecting logs and trace injection.|
|Enable App Analytics globally for web integrations.|
|Enable App Analytics for a specific integration. Example: |
Configure your application level tracers to submit traces to a custom Agent hostname. The Python Tracing Module automatically looks for and initializes with the ENV variables
But you can also set the hostname and port in code:
import os from ddtrace import tracer tracer.configure( hostname="custom-hostname", port="1234", )