Prelude
The Datadog APM Python team is happy to announce the release of v2.0.0 of ddtrace. This release drops support for Python 2.7, 3.5, and 3.6. This release adds support for Python 3.12.
<div class="important">
<div class="title">
Important
</div>
If you are on version of Python not supported by v2, we will continue to maintain the ddtrace v1 with bug fixes.
</div>
<div class="note">
<div class="title">
Note
</div>
Before upgrading to v2.0.0, we recommend users install `ddtrace~=1.20.0` and enable deprecation warnings. All removals to the library interface and environment variables in v2 were deprecated in the 1.x release line.
</div>
<div class="note">
<div class="title">
Note
</div>
The changes to environment variables apply only to the configuration of the ddtrace library and not the Datadog Agent.
</div>
Upgrading summary
Functionality changes
The default logging configuration functionality of ddtrace has been changed to avoid conflicting with application logging configurations. `DD_CALL_BASIC_CONFIG` has been removed and the ddtrace logger will log to stdout by default, or a log file as specified using `DD_TRACE_LOG_FILE`.
Setting the environment variable `DD_TRACE_PROPAGATION_STYLE='b3'`, which previously enabled `b3multi` now enables `b3 single header`. `b3 single header` still works but is deprecated for `b3`. Simplified: `b3` used to enable `b3multi`, but now enables `b3 single header` to better align with Opentelemetry's terms.
Removed deprecated environment variables
These environment variables have been removed. In all cases the same functionality is provided by other environment variables and replacements are provided as recommended actions for upgrading.
| Variable | Replacement | Note |
|--------------------------------------------|--------------------------------------------|-----------------------------------------------------|
| `DD_GEVENT_PATCH_ALL` | None | `📝<remove-dd-gevent-patch-all>` |
| `DD_AWS_TAG_ALL_PARAMS` | None | `📝<remove-aws-tag-all-params>` |
| `DD_REMOTECONFIG_POLL_SECONDS` | `DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS` | `📝<rename-remote-config-poll-seconds>` |
| `DD_CALL_BASIC_CONFIG` | None | `📝<remove-basic-config>` |
| `DD_TRACE_OBFUSCATION_QUERY_STRING_PATERN` | `DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP` | `📝<remove-trace-obfuscation-query-string-pattern>` |
Removed deprecated library interfaces
These methods and module attributes have been removed. Where the same functionality is provided by a different public method or module attribute, a recommended action is provided for upgrading. In a few limited cases, because the interface was no longer used or had been moved to the internal interface, it was removed and so no action is provided for upgrading.
| Module | Method/Attribute | Note |
|-----------------------------------|---------------------------------|----------------------------------------------------|
| `ddtrace.constants` | `APPSEC_ENABLED` | `📝<remove-appsec-private-constants>` |
| | `APPSEC_JSON` | `📝<remove-appsec-private-constants>` |
| | `APPSEC_EVENT_RULE_VERSION` | `📝<remove-appsec-private-constants>` |
| | `APPSEC_EVENT_RULE_ERRORS` | `📝<remove-appsec-private-constants>` |
| | `APPSEC_EVENT_RULE_LOADED` | `📝<remove-appsec-private-constants>` |
| | `APPSEC_EVENT_RULE_ERROR_COUNT` | `📝<remove-appsec-private-constants>` |
| | `APPSEC_WAF_DURATION` | `📝<remove-appsec-private-constants>` |
| | `APPSEC_WAF_DURATION_EXT` | `📝<remove-appsec-private-constants>` |
| | `APPSEC_WAF_TIMEOUTS` | `📝<remove-appsec-private-constants>` |
| | `APPSEC_WAF_VERSION` | `📝<remove-appsec-private-constants>` |
| | `APPSEC_ORIGIN_VALUE` | `📝<remove-appsec-private-constants>` |
| | `APPSEC_BLOCKED` | `📝<remove-appsec-private-constants>` |
| | `IAST_JSON` | `📝<remove-appsec-private-constants>` |
| | `IAST_ENABLED` | `📝<remove-appsec-private-constants>` |
| | `IAST_CONTEXT_KEY` | `📝<remove-appsec-private-constants>` |
| `ddtrace.contrib.fastapi.patch` | `span_modifier` | `📝<remove-fastapi-starlette-span-modifier>` |
| | `aggregate_resources` | `📝<remove-fastapi-starlette-aggregate-resources>` |
| `ddtrace.contrib.starlette.patch` | `span_modifier` | `📝<remove-fastapi-starlette-span-modifier>` |
| | `aggregate_resources` | `📝<remove-fastapi-starlette-aggregate-resources>` |
| | `get_resource` | `📝<remove-fastapi-starlette-span-modifier>` |
| `ddtrace.contrib.grpc.constants` | `GRPC_PORT_KEY` | `📝<remove-grpc-port-key>` |
| `ddtrace.ext.cassandra` | `ROW_COUNT` | `📝<remove-cassandra-row-count>` |
| `ddtrace.ext.mongo` | `ROWS` | `📝<remove-mongo-row-count>` |
| `ddtrace.ext.sql` | `ROWS` | `📝<remove-sql-row-count>` |
| `ddtrace.filters` | `TraceCiVisibilityFilter` | `📝<remove-trace-ci-visibility-filter>` |
| `ddtrace.tracer` | `DD_LOG_FORMAT` | `📝<remove-dd-log-format>` |
Upgrade Notes
- <div id="remove-dd-gevent-patch-all">
`DD_GEVENT_PATCH_ALL` is removed. There is no special configuration necessary to make ddtrace work with gevent if using ddtrace-run.
</div>
- <div id="remove-aws-tag-all-params">
`DD_AWS_TAG_ALL_PARAMS` is removed. The boto/botocore/aiobotocore integrations no longer collect all API parameters by default.
</div>
- <div id="rename-remote-config-poll-seconds">
`DD_REMOTECONFIG_POLL_SECONDS` is removed. Use the environment variable `DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS` instead.
</div>
- <div id="remove-appsec-private-constants">
`APPSEC_ENABLED`, `APPSEC_JSON`, `APPSEC_EVENT_RULE_VERSION`, `APPSEC_EVENT_RULE_ERRORS`, `APPSEC_EVENT_RULE_LOADED`, `APPSEC_EVENT_RULE_ERROR_COUNT`, `APPSEC_WAF_DURATION`, `APPSEC_WAF_DURATION_EXT`, `APPSEC_WAF_TIMEOUTS`, `APPSEC_WAF_VERSION`, `APPSEC_ORIGIN_VALUE`, `APPSEC_BLOCKED`, `IAST_JSON`, `IAST_ENABLED`, `IAST_CONTEXT_KEY` are removed. This should not affect existing code as these deprecated ASM constants were meant for private use only.
</div>
- <div id="remove-fastapi-starlette-span-modifier">
`ddtrace.contrib.starlette.get_resource`, `ddtrace.contrib.starlette.span_modifier`, and `ddtrace.contrib.fastapi.span_modifier` are removed. The starlette and fastapi integrations now provide the full route and not just the mounted route for sub-applications.
</div>
- <div id="remove-fastapi-starlette-aggregate-resources">
`ddtrace.contrib.starlette.config['aggregate_resources']` and `ddtrace.contrib.fastapi.config['aggregate_resources']` are removed. The starlette and fastapi integrations no longer have the option to `aggregate_resources`, as it now occurs by default.
</div>
- <div id="remove-grpc-port-key">
`ddtrace.contrib.grpc.constants.GRPC_PORT_KEY` is removed. Use `ddtrace.ext.net.TARGET_PORT` instead.
</div>
- <div id="remove-cassandra-row-count">
`ddtrace.ext.cassandra.ROW_COUNT` is removed. Use `ddtrace.ext.db.ROWCOUNT` instead.
</div>
- <div id="remove-mongo-row-count">
`ddtrace.ext.mongo.ROW_COUNT` is removed. Use `ddtrace.ext.db.ROWCOUNT` instead.
</div>
- <div id="remove-sql-row-count">
`ddtrace.ext.sql.ROW_COUNT` is removed. Use `ddtrace.ext.db.ROWCOUNT` instead.
</div>
- <div id="remove-trace-ci-visibility-filter">
`ddtrace.filters.TraceCiVisibilityFilter` is removed.
</div>
- <div id="remove-dd-log-format">
`ddtrace.tracer.DD_LOG_FORMAT` is removed. As an alternative, please follow the log injection formatting as provided in the [log injection docs](https://ddtrace.readthedocs.io/en/stable/advanced_usage.html#update-log-format).
</div>
- <div id="remove-basic-config">
`DD_CALL_BASIC_CONFIG` is removed. There is no special configuration necessary to replace `DD_CALL_BASIC_CONFIG`. The ddtrace logger will log to stdout by default or additionally to a file specified by `DD_TRACE_LOG_FILE`.
</div>
- <div id="remove-trace-obfuscation-query-string-pattern">
`DD_TRACE_OBFUSCATION_QUERY_STRING_PATTERN` is removed. Use `DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP` instead.
</div>
New Features
- Adds support for Python 3.12.
Known Issues
- aiohttp: Python 3.12 is not supported.
- aiohttp-jinja: Python 3.12 is not supported.
- aiobotocore: Python 3.12 is not supported.
- asm: IAST for Python 3.12 is not supported.
- flask-caching: Python 3.12 is not supported.
- openai/langchain: Python 3.12 is not supported.
- opentelemetry-api: Python 3.12 is not supported.
- opentracing: Python 3.12 is not supported.
- pyramid: Python 3.12 is not supported.
- pynamodb: Python 3.12 is not supported.
- redis/redis-py-cluster: Python 3.12 is not supported.
---