v4.0.0rc1
Breaking Changes📦 datadog-sdkView on GitHub →
⚠ 27 breaking✨ 6 features🐛 4 fixes⚡ 1 deprecations🔧 56 symbols
Summary
This major release introduces significant API breaking changes, including the removal of Python 3.8 support, deprecated methods, and configuration variables. New features focus on AAP, profiling enhancements, and LLM Observability updates, while Django tracing defaults to a minimal mode.
⚠️ Breaking Changes
- Support for Python 3.8 is removed. Upgrade to Python 3.9 or newer.
- Support for the ddtrace.Pin object is dropped for mongoengine. Mongoengine is now supported only through the pymongo integration.
- Deprecated entry points for `pytest_benchmark` and `pytest_bdd` integrations in CI Visibility are removed. These are now supported by the regular `pytest` integration.
- The deprecated environment variable `DD_DYNAMIC_INSTRUMENTATION_UPLOAD_FLUSH_INTERVAL` is removed.
- The deprecated environment variable `DD_EXCEPTION_DEBUGGING_ENABLED` is removed.
- `Span.set_tag_str` is removed; use `Span.set_tag` instead.
- `Span.set_struct_tag` is removed.
- `Span.get_struct_tag` is removed.
- `Span._pprint` is removed.
- The `Span.finished` setter is removed; use the `Span.finish()` method instead.
- `Tracer.on_start_span` method is removed.
- `Tracer.deregister_on_start_span` method is removed.
- `ddtrace.trace.Pin` is removed.
- `Span.finish_with_ancestors` is removed with no replacement.
- Type signatures for several Span methods have changed: `set_tag` now expects `value: Optional[str] = None`, `get_tag` returns `Optional[str]`, `set_tags` expects `tags: dict[str, str]`, `get_tags` returns `dict[str, str]`, `set_metric` expects `value: int | float`, `get_metric` returns `Optional[int | float]`, `set_metrics` expects `metrics: Dict[str, int | float]`, and `get_metrics` returns `dict[str, int | float]`.
- `Span.record_exception` no longer accepts `timestamp` and `escaped` parameters.
- Manual LLM Observability instrumentation methods (`LLMObs.annotate()`, `LLMObs.export_span()`, etc.) now raise exceptions instead of logging errors.
- `LLMObs.submit_evaluation_for()` is removed; use `LLMObs.submit_evaluation()` instead. The argument `span_context` must be renamed to `span`.
- The V1 stack profiler is removed. `DD_PROFILING_STACK_V2_ENABLED` is removed.
- The deprecated `freezegun` integration is removed.
- The deprecated `opentracer` package is removed.
- The `google_generativeai` integration is removed; use the `google_genai` integration instead.
- Streamed chat/completions token counts will no longer be computed using `tiktoken` by default; token counts must be explicitly provided in the OpenAI response or by setting `stream_options={\"include_usage\": True}` in the request.
- The default tracing behavior for Django is upgraded to enable minimal tracing mode (`DD_DJANGO_TRACING_MINIMAL` defaults to `true`), disabling Django ORM, cache, and template instrumentation by default.
- 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
- Ensure your Python version is 3.9 or newer.
- If using mongoengine, rely on the `pymongo` integration instead of direct `ddtrace.Pin` usage.
- Update any code using removed Span methods like `set_tag_str`, `set_struct_tag`, `get_struct_tag`, or the `finished` setter.
- Update calls to `LLMObs.submit_evaluation_for(...)` to use `LLMObs.submit_evaluation(...)` and rename the `span_context` argument to `span`.
- If you relied on Django ORM, cache, or template instrumentation being enabled by default, set `DD_DJANGO_TRACING_MINIMAL=false` or explicitly enable database, cache, or template instrumentation via environment variables.
- If using streamed OpenAI requests and requiring accurate token counts, set `stream_options={\"include_usage\": True}` in the OpenAI request.
✨ New Features
- AAP introduces security response id for easy identification of blocking responses.
- API Security schema collection is now supported in AWS Lambda behind an Application Load Balancer or Lambda Function URL service where the endpoint cannot be reliably known.
- AppSec instrumentation for downstream request is now enabled by default for `urllib3` and `requests` without requiring APM instrumentation for `urllib3`.
- Profiling now supports `threading.RLock` in addition to `threading.Lock`.
- LLM Observability allows optionally pulling previous dataset versions by passing the `version` argument to `LLMObs.pull_dataset`.
- LLM Observability Datasets now have `version` and `latest_version` properties.
🐛 Bug Fixes
- Resolved an issue in CI Visibility where fetching repo tags while unshallowing caused performance issues for repos with many tags.
- Resolved performance issue affecting coverage collection for Python 3.12+ in CI Visibility.
- Resolved an issue where payload size statistics were not being sent to the backend for Data Streams Monitoring (DSM).
- Resolved an issue where forksafe locks used patched threading primitives from the profiling module.
🔧 Affected Symbols
ddtracePython 3.8mongoengineddtrace.Pinpymongopytest_benchmarkpytest_bddpytestDD_DYNAMIC_INSTRUMENTATION_UPLOAD_FLUSH_INTERVALDD_EXCEPTION_DEBUGGING_ENABLEDSpan.set_tag_strSpan.set_tagSpan.set_struct_tagSpan.get_struct_tagSpan._pprintSpan.finishedSpan.finish()Tracer.on_start_spanTracer.deregister_on_start_spanddtrace.trace.PinSpan.finish_with_ancestorsSpan.set_tagSpan.get_tagSpan.set_tagsSpan.get_tagsSpan.set_metricSpan.get_metricSpan.set_metricsSpan.get_metricsSpan.record_exceptionLLMObs.annotateLLMObs.export_spanLLMObs.submit_evaluationLLMObs.inject_distributed_headersLLMObs.activate_distributed_headersLLMObs.submit_evaluation_forDD_PROFILING_STACK_V2_ENABLEDfreezegunopentracergoogle_generativeaigoogle_genaiopenaitiktokenDD_DJANGO_TRACING_MINIMALDD_DJANGO_INSTRUMENT_DATABASESDD_DJANGO_INSTRUMENT_CACHESDD_DJANGO_INSTRUMENT_TEMPLATESpsycopgMySQLdbsqlite3redismemcachedJinja2ddtrace.settingsHttpPropagator.injectDEFAULT_RUNTIME_METRICS_INTERVAL⚡ Deprecations
- Support for Python 3.9 is deprecated as Python 3.9 has reached its end-of-life.