Datadog APM Python tracing library. Current version: 4.6.4 (Mar 2026). Three breaking major versions since 2023: v2 (dropped Python 2.7/3.5/3.6, removed DD_CALL_BASIC_CONFIG), v3 (dropped Python 3.7, removed deprecated config names), v4 (dropped Python 3.8, removed Pin class, removed Span.set_tag_str, removed ddtrace.settings package). Preferred usage is ddtrace-run CLI wrapper — NOT importing patch_all() in code. Requires Datadog Agent running separately. Auto-instrumentation patches libraries at import time.
pip install ddtraceVerified import paths — ran on the pinned version, not inferred.
ddtrace — auto-instrumentation via ddtrace-run and custom spans.
v4 requires Python 3.9+. v3 requires Python 3.8+. v2 requires Python 3.7+.
Remove Pin usage. Configure integrations via environment variables or ddtrace.config instead.
Use span.set_tag('key', 'value') for all tag types.Use environment variables (DD_TRACE_*, DD_SERVICE, etc.) for configuration.
Use ddtrace-run CLI wrapper which handles import order automatically.
Remove DD_CALL_BASIC_CONFIG from environment. ddtrace now logs to stdout by default.
Run Datadog Agent before starting app. Verify with: ddtrace-run --info. Override with DD_AGENT_HOST and DD_TRACE_AGENT_PORT.
Set DD_SERVICE=my-service DD_ENV=production DD_VERSION=1.0.0 before running.
Use `ddtrace.patch_all()` to instrument all available integrations, or specify individual integrations using `ddtrace.patch(integration_name=True, ...)`.
Use ddtrace.patch_all() to instrument all available integrations, or ddtrace.patch('integration_name') for specific ones.