{"library":"ddtrace","type":"library","category":null,"description":"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.","language":"python","status":"active","version":"4.6.4","tags":["datadog","ddtrace","apm","tracing","observability","python","monitoring"],"last_verified":"Tue Jun 09","install":[{"cmd":"pip install ddtrace","imports":["# Preferred: use ddtrace-run CLI wrapper\n# This patches libraries at startup before your code imports them\n\n# Set env vars:\n# DD_SERVICE=my-service\n# DD_ENV=production\n# DD_VERSION=1.0.0\n# DD_AGENT_HOST=localhost  (default)\n# DD_TRACE_AGENT_PORT=8126  (default)\n\n# Run your app:\n# ddtrace-run python app.py\n# ddtrace-run gunicorn app:application\n# ddtrace-run uvicorn app:app\n\n# Verify config:\n# ddtrace-run --info","from ddtrace import tracer\n\n# Custom span\nwith tracer.trace('my.operation', service='my-service', resource='checkout') as span:\n    span.set_tag('user.id', '123')\n    span.set_tag('order.id', 'ord-456')\n    # do work\n\n# Decorator\nfrom ddtrace import tracer\n\n@tracer.wrap(service='my-service', resource='process_payment')\ndef process_payment(order_id):\n    pass\n\n# Error tracking\ntry:\n    risky_operation()\nexcept Exception as e:\n    span.error = 1\n    span.set_tag('error.msg', str(e))\n    raise"]}],"homepage":"https://www.datadoghq.com/","github":"https://github.com/DataDog/dd-trace-py","docs":"https://ddtrace.readthedocs.io/en/stable/","changelog":"https://github.com/DataDog/dd-trace-py/releases","pypi":"https://pypi.org/project/ddtrace/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"compatibility":{"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":6.9,"avg_import_s":null,"wheel_type":"wheel"},"url":"https://checklist.day/v1/registry/ddtrace/compatibility"}}