Installation + Quickstart

Before installing be sure to read through the setup documentation to ensure your environment is ready to receive traces.


Install with pip:

pip install ddtrace

We strongly suggest pinning the version of the library you deploy.



Getting started for tracing is as easy as prefixing your python entry-point command with ddtrace-run.

For example if you start your application with python then run:

ddtrace-run python

For more advanced usage of ddtrace-run refer to the documentation here.

If ddtrace-run isn’t suitable for your application then patch_all can be used:

import ddtrace


For information on how to manually create traces refer to the documentation here.


Profiling can also be auto enabled with ddtrace-run by providing the DD_PROFILING_ENABLED environment variable:

DD_PROFILING_ENABLED=true ddtrace-run python

If ddtrace-run isn’t suitable for your application then can be used:



Almost all configuration of ddtrace can be done via environment variable. See the full list in Configuration.


ddtrace also provides an OpenTracing API to the Datadog tracer so that you can use the Datadog tracer in your OpenTracing-compatible applications.


Include OpenTracing with ddtrace:

$ pip install ddtrace[opentracing]

To include the OpenTracing dependency in your project with ddtrace, ensure you have the following in



The OpenTracing convention for initializing a tracer is to define an initialization method that will configure and instantiate a new tracer and overwrite the global opentracing.tracer reference.

Typically this method looks something like:

from ddtrace.opentracer import Tracer, set_global_tracer

def init_tracer(service_name):
    Initialize a new Datadog opentracer and set it as the
    global tracer.

    This overwrites the opentracing.tracer reference.
    config = {
      'agent_hostname': 'localhost',
      'agent_port': 8126,
    tracer = Tracer(service_name, config=config)
    return tracer

For more advanced usage of OpenTracing in ddtrace refer to the documentation here.