Configuration

ddtrace can be configured using environment variables. They are listed below:

Variable Name

Type

Default value

Description

DD_ENV

String

Set an application’s environment e.g. prod, pre-prod, staging. Added in v0.36.0. See Unified Service Tagging for more information.

DD_SERVICE

String

(autodetected)

Set the service name to be used for this application. A default is provided for these integrations: Bottle, Flask, Grpc, Pyramid, Pylons, Tornado, Celery, Django and Falcon. Added in v0.36.0. See Unified Service Tagging for more information.

DD_SERVICE_MAPPING

String

Define service name mappings to allow renaming services in traces, e.g. postgres:postgresql,defaultdb:postgresql.

DD_TAGS

String

Set global tags to be attached to every span. Value must be either comma or space separated. e.g. key1:value1,key2,value2 or key1:value key2:value2. Comma separated support added in v0.38.0 and space separated support added in v0.48.0.

DD_VERSION

String

Set an application’s version in traces and logs e.g. 1.2.3, 6c44da20, 2020.02.13. Generally set along with DD_SERVICE. Added in v0.36.0. See Unified Service Tagging for more information.

DD_SITE

String

datadoghq.com

Specify which site to use for uploading profiles. Set to datadoghq.eu to use EU site.

DD_TRACE_ENABLED

Boolean

True

Enable sending of spans to the Agent. Note that instrumentation will still be installed and spans will be generated. Added in v0.41.0 (formerly named DATADOG_TRACE_ENABLED).

DD_TRACE_DEBUG

Boolean

False

Enables debug logging in the tracer. Setting this flag will cause the library to create a root logging handler if one does not already exist. Added in v0.41.0 (formerly named DATADOG_TRACE_DEBUG).

DD_TRACE_<INTEGRATION>_ENABLED

Boolean

True

Enables <INTEGRATION> to be patched. For example, DD_TRACE_DJANGO_ENABLED=false will disable the Django integration from being installed. Added in v0.41.0.

DATADOG_PATCH_MODULES

String

Override the modules patched for this execution of the program. Must be a list in the module1:boolean,module2:boolean format. For example, boto:true,redis:false.

DD_LOGS_INJECTION

Boolean

True

Enables Logs Injection.

DD_CALL_BASIC_CONFIG

Boolean

True

Controls whether logging.basicConfig is called in ddtrace-run or when debug mode is enabled.

DD_TRACE_AGENT_URL

URL

http://localhost:8126

The URL to use to connect the Datadog agent. The url can starts with http:// to connect using HTTP or with unix:// to use a Unix Domain Socket.

DD_TRACE_AGENT_TIMEOUT_SECONDS

Float

2.0

The timeout in float to use to connect to the Datadog agent.

DD_TRACE_WRITER_BUFFER_SIZE_BYTES

Int

8000000

The max size in bytes of traces to buffer between flushes to the agent.

DD_TRACE_WRITER_MAX_PAYLOAD_SIZE_BYTES

Int

8000000

The max size in bytes of each payload sent to the trace agent. If max payload size is less than buffer size, multiple payloads will be sent to the trace agent.

DD_TRACE_WRITER_INTERVAL_SECONDS

Float

1.0

The time between each flush of traces to the trace agent.

DD_TRACE_STARTUP_LOGS

Boolean

False

Enable or disable start up diagnostic logging.

DD_TRACE_SAMPLE_RATE

Float

1.0

A float, f, 0.0 <= f <= 1.0. f*100% of traces will be sampled.

DD_PROFILING_ENABLED

Boolean

False

Enable Datadog profiling when using ddtrace-run.

DD_PROFILING_API_TIMEOUT

Float

10

The timeout in seconds before dropping events if the HTTP API does not reply.

DD_PROFILING_MAX_TIME_USAGE_PCT

Float

1

The percentage of maximum time the stack profiler can use when computing statistics. Must be greater than 0 and lesser or equal to 100.

DD_PROFILING_MAX_FRAMES

Integer

64

The maximum number of frames to capture in stack execution tracing.

DD_PROFILING_HEAP_ENABLED

Boolean

False

Whether to enable the heap memory profiler.

DD_PROFILING_CAPTURE_PCT

Float

2

The percentage of events that should be captured (e.g. memory allocation). Greater values reduce the program execution speed. Must be greater than 0 lesser or equal to 100.

DD_PROFILING_UPLOAD_INTERVAL

Float

60

The interval in seconds to wait before flushing out recorded events.

DD_PROFILING_IGNORE_PROFILER

Boolean

False

Deprecated: whether to ignore the profiler in the generated data.

DD_PROFILING_TAGS

String

The tags to apply to uploaded profile. Must be a list in the key1:value,key2:value2 format.