v4.0.0rc2
Breaking Changes📦 datadog-sdk
⚠ 22 breaking✨ 7 features🐛 1 fixes⚡ 1 deprecations🔧 42 symbols
Summary
This major release introduces significant breaking changes, including the removal of Python 3.8 support and deprecated APIs, while adding new features like OpenFeature provider support and enhanced LLM Observability capabilities.
⚠️ Breaking Changes
- Support for ddtrace with Python 3.8 is removed. Use ddtrace 4.x with Python 3.9 or newer.
- 32-bit linux is no longer supported. Please contact us if this blocks upgrading dd-trace-py.
- Support for the ddtrace.Pin object with mongoengine is dropped. The ddtrace library no longer directly supports mongoengine; it will be supported through the pymongo integration.
- Removed deprecated entry points for the pytest_benchmark and pytest_bdd CI Visibility integrations. These plugins are now supported by the regular pytest integration.
- Removed the deprecated DD_DYNAMIC_INSTRUMENTATION_UPLOAD_FLUSH_INTERVAL variable.
- Removed the deprecated DD_EXCEPTION_DEBUGGING_ENABLED variable for exception replay.
- Removed deprecated tracing methods: Span.set_tag_str (use Span.set_tag), Span.set_struct_tag, Span.get_struct_tag, Span._pprint, Span.finished setter (use Span.finish()), Tracer.on_start_span, Tracer.deregister_on_start_span, ddtrace.trace.Pin, and Span.finish_with_ancestors (no replacement).
- Type signatures for several Span methods changed: Span.set_tag, Span.get_tag, Span.set_tags, Span.get_tags, Span.set_metric, Span.get_metric, Span.set_metrics, Span.get_metrics. Check new signatures (e.g., Span.set_tag now expects Optional[str] for value).
- Span.record_exception's timestamp and escaped parameters are removed.
- Manual LLM Observability instrumentation methods (LLMObs.annotate, LLMObs.export_span, LLMObs.submit_evaluation, LLMObs.inject_distributed_headers, LLMObs.activate_distributed_headers) now raise exceptions instead of logging.
- LLMObs.submit_evaluation_for has been removed; use LLMObs.submit_evaluation instead. For migration, rename the method call and change the argument name from span_context to span.
- The V1 stack profiler is removed. V2 is now default, and DD_PROFILING_STACK_V2_ENABLED is removed.
- The deprecated freezegun integration is removed.
- The deprecated opentracer package is removed.
- The aioredis integration has been removed.
- The google_generativeai integration has been removed. Use the google_genai library and corresponding integration instead.
- Streamed chat/completions will no longer compute token counts using tiktoken by default; token counts will be estimated unless explicitly provided in the OpenAI response object or stream_options={"include_usage": True} is set.
- Django tracing default behavior is upgraded to enable minimal tracing mode (DD_DJANGO_TRACING_MINIMAL defaults to true), disabling Django ORM, cache, and template instrumentation by default. To restore full instrumentation, set DD_DJANGO_TRACING_MINIMAL=false or enable specific features.
- When DD_DJANGO_INSTRUMENT_DATABASES=true, database instrumentation now merges tags into driver spans instead of creating duplicate Django database spans.
- The ddtrace.settings package is removed. Use environment variables to adjust settings.
- The deprecated non_active_span parameter to HttpPropagator.inject is removed.
- The deprecated environment variable DEFAULT_RUNTIME_METRICS_INTERVAL is removed.
Migration Steps
- If using Python 3.8, upgrade to Python 3.9 or newer.
- If using mongoengine, be aware that direct ddtrace support is dropped; tracing relies on the pymongo integration.
- Review code for usage of removed Span methods like Span.set_tag_str, Span.set_struct_tag, Span.get_struct_tag, Span.finished setter, and update accordingly.
- Update calls to Span.set_tag, Span.get_tag, Span.set_tags, Span.get_tags, Span.set_metric, Span.get_metric, Span.set_metrics, and Span.get_metrics to match the new type signatures.
- Update calls to Span.record_exception to remove timestamp and escaped parameters.
- For LLMObs manual instrumentation, replace calls to LLMObs.submit_evaluation_for(...) with LLMObs.submit_evaluation(span={...}, ...) and rename the context argument.
- Remove usage of DD_PROFILING_STACK_V2_ENABLED environment variable.
- Remove usage of the deprecated freezegun integration.
- Remove usage of the deprecated opentracer package.
- Remove usage of the aioredis integration.
- If using google_generativeai, migrate to the google_genai library and corresponding integration.
- For streamed OpenAI requests, if accurate token metrics are required, set stream_options={"include_usage": True} in the OpenAI request.
- For Django users, review DD_DJANGO_TRACING_MINIMAL setting. If you require Django ORM, cache, or template instrumentation, set DD_DJANGO_TRACING_MINIMAL=false or enable specific features like DD_DJANGO_INSTRUMENT_DATABASES=true.
- Stop using the ddtrace.settings package and migrate configuration to environment variables.
- Remove usage of the non_active_span parameter in HttpPropagator.inject calls.
- Remove usage of the DEFAULT_RUNTIME_METRICS_INTERVAL environment variable.
✨ New Features
- dd-trace-py now includes an OpenFeature provider implementation, enabling feature flag evaluation through the OpenFeature API.
- AAP: Introduces security response id for easy identification of blocking responses.
- AAP: API Security schema collection is now supported in AWS Lambda behind an Application Load Balancer or the Lambda Function URL service where the endpoint cannot be reliably known.
- AAP: AppSec instrumentation for downstream request is now enabled by default for urllib3 and requests.
- Profiling: Add support for threading.RLock (reentrant lock) profiling.
- LLM Observability: Previous dataset versions can be optionally pulled by passing the version argument to LLMObs.pull_dataset.
- LLM Observability: Datasets have new properties version and latest_version.
🐛 Bug Fixes
- CI Visibility: This fi... [truncated]
🔧 Affected Symbols
ddtrace.Pinmongoenginepytest_benchmarkpytest_bddDD_DYNAMIC_INSTRUMENTATION_UPLOAD_FLUSH_INTERVALDD_EXCEPTION_DEBUGGING_ENABLEDSpan.set_tag_strSpan.set_tagSpan.set_struct_tagSpan.get_struct_tagSpan._pprintSpan.finished setterSpan.finish()Tracer.on_start_spanTracer.deregister_on_start_spanSpan.record_exceptionLLMObs.annotateLLMObs.export_spanLLMObs.submit_evaluationLLMObs.submit_evaluation_forLLMObs.inject_distributed_headersLLMObs.activate_distributed_headersDD_PROFILING_STACK_V2_ENABLEDfreezegunopentraceraioredisgoogle_generativeaigoogle_genaitiktokenDD_DJANGO_TRACING_MINIMALDD_DJANGO_INSTRUMENT_DATABASESDD_DJANGO_INSTRUMENT_CACHESDD_DJANGO_INSTRUMENT_TEMPLATESpsycopgMySQLdbsqlite3redismemcachedJinja2ddtrace.settingsHttpPropagator.injectDEFAULT_RUNTIME_METRICS_INTERVAL⚡ Deprecations
- Support for ddtrace with Python 3.9 is deprecated after Python 3.9 reached its end-of-life.