Upgrade Notes
- LLM Observability:
- Deprecates the
ml_appargument andDD_LLMOBS_ML_APPenvironment variable, which will be removed in the next major version of ddtrace. Useagent_serviceandDD_SERVICEinstead to group traces belonging to a root agentic service (i.e. previously known as ML application).
- Deprecates the
Deprecation Notes
-
AI Guard:
- The public SDK has moved from the
ddtrace.appsec.ai_guardpackage to the top-levelddtrace.aiguardpackage. Importing fromddtrace.appsec.ai_guardis deprecated, now emits addtrace.DDTraceDeprecationWarning, and will be removed in 5.0.0. As an alternative, update imports such asfrom ddtrace.appsec.ai_guard import AIGuardClienttofrom ddtrace.aiguard import AIGuardClient. The Strands Agents classes are the exception: import them fromddtrace.aiguard.integrations.strands(AIGuardStrandsPluginandAIGuardStrandsHookProviderare not re-exported from the top-level package).
- The public SDK has moved from the
-
pytest:
- The legacy pytest plugin (
ddtrace/contrib/internal/pytest) is deprecated and will be removed in ddtrace 5.0.0. This plugin is active only whenDD_PYTEST_USE_NEW_PLUGINis explicitly set tofalseor0. The new pytest plugin (ddtrace/testing/internal/pytest) is already the default. To migrate, remove theDD_PYTEST_USE_NEW_PLUGINenvironment variable from your configuration.
- The legacy pytest plugin (
-
LLM Observability:
- The
labelparameter ofLLMObs.get_prompt()andLLMObs.refresh_prompt()is deprecated. SetDD_ENVinstead; the prompt version is resolved for that environment. - Managed prompts no longer expose deprecated deployment label metadata. #19047
- The
New Features
-
Tracing:
- Trace and span IDs are now generated more safely in AWS Lambda MicroVM environments, reducing the risk of duplicate IDs. No configuration is required. #18017
- Adds OpenTelemetry thread-context publication on Linux, enabling compatible profiling tools to correlate samples with the active trace and span.
- Adds
DD_TRACE_OTEL_SEMANTICS_ENABLEDto opt in to OpenTelemetry trace semantics for spans created through OpenTelemetry APIs and for OpenTelemetry Protocol (OTLP) trace export.
-
AI Guard:
- This introduces per-integration kill-switch environment variables, extending the existing
DD_AI_GUARD_OPENAI_ENABLEDswitch to the Anthropic and LangChain auto-instrumentations:DD_AI_GUARD_ANTHROPIC_ENABLEDandDD_AI_GUARD_LANGCHAIN_ENABLED(bothtrueby default). Set either tofalseto disable AI Guard for that specific provider/framework without affecting other integrations or requiring a tracer version rollback.
- This introduces per-integration kill-switch environment variables, extending the existing
-
AAP:
- Add support for the
DD_APPSEC_AGENTIC_ONBOARDINGenvironment variable. Its value is reported verbatim in configuration telemetry, letting Datadog record that a service was onboarded through the agentic onboarding solution.
- Add support for the
-
LLM Observability:
- Added
DD_BOTOCORE_BEDROCK_RESOLVE_INFERENCE_PROFILE(defaultfalse). When enabled, Bedrock calls using an application-inference-profile ARN asmodelIdresolve the underlying foundation model, so the span reports the real model and cost populates. RequiresDD_LLMOBS_ENABLED=trueandbedrock:GetInferenceProfileIAM permission. - This introduces capture of session metadata (session id, user id, and app name) from the Google ADK
Sessionobject on LLM Observability spans. - Spans generated under an agent are now automatically attributed to their nearest agent ancestor, both within a single process and across service boundaries. This enables the Datadog backend to group and display spans by the agent that produced them.
- Added
agent_serviceas a preferred alias for theml_appargument across SDK methods (LLMObs.enable(...), span constructors, decorators,submit_evaluation(...),get_spans(...), andpublish_evaluator(...)). When provided,agent_servicetakes precedence over the deprecatedml_appargument and overservice. When neitheragent_servicenorml_appis set, application identity continues to resolve from a propagated parent value, thenDD_LLMOBS_ML_APP, thenDD_SERVICE. - Auto-instrumented LLM integrations now automatically link Datadog Managed Prompts retrieved with
LLMObs.get_prompt()and rendered with.format()to the resulting LLM span. LLMObs.get_prompt()now resolves environment-scoped prompt versions and supports targeting for A/B testing. SetDD_ENVto select the version for that environment. The signature is now keyword-only afterprompt_idand acceptstargeting_key(sticky bucketing) and**attributes(targeting rules). #18127- Adds a
versionargument toLLMObs.get_prompt()for retrieving an exact prompt version. #19050 - This introduces support for attaching images to messages on LLM spans. Input and output messages annotated via
LLMObs.annotatenow accept an optionalimage_partsfield, a list of images each with amime_typeand either inline base64contentor anattachment_key. This lets images be collected and rendered in LLM Observability. - The OpenAI integration now automatically instruments the Realtime API (
client.realtime.connect(...), both sync and async). Each conversation turn is captured as anllmspan with the user and assistant transcripts, audio, token usage, and any tool calls (function and MCP), grouped per connection so the whole conversation is traced end to end. Realtime instrumentation can be disabled on its own, without affecting the rest of the OpenAI integration, by settingDD_OPENAI_REALTIME_ENABLED=false. - Adds prompt management methods to
LLMObsfor creating, updating, deleting, and listing prompts and prompt versions in the prompt registry. #18186 - Adds the
env_idsargument to prompt creation and version update methods, allowing prompt versions to be deployed to feature-flag environments. session_idnow propagates to following spans in a trace. Ifsession_idis set explicitly on a span, this will take precedence over the inherited or propagated value.- Adds support for submitting LLM Observability spans for synchronous and asynchronous streaming chat completion calls using the
mistralaiclient.
- Added
-
CI visibility:
- Adds
DD_CODE_COVERAGE_FLAGSto group and filter uploaded code coverage reports.
- Adds
-
Crashtracking:
- Unhandled Python exceptions are now reported through the crashtracker, providing crash reports with exception type, message, and Python stack trace in addition to the existing native signal-based crash reporting.
-
Stats computation:
- Enables obfuscation by default. Stats computation itself remains enabled by default only on Python 3.14 and above.
-
Profiling:
- Exception profiling is now enabled by default when the profiler is active on Python 3.12+. Exception profiling samples raised exceptions to help identify error hotspots in your application. Exception profiling is not available on Python < 3.12 and free-threaded builds.
- Exception profiling now captures the full Python call stack at the point of the raise, instead capturing the exception traceback at the point where the exception is handled. This provides richer context including the complete call chain leading to the exception, consistent with how wall-time and CPU profiles capture stacks.
-
openfeature:
- Adds experimental APM span enrichment for the Feature Flagging and Experimentation (FFE) OpenFeature provider. When
DD_EXPERIMENTAL_FLAGGING_PROVIDER_SPAN_ENRICHMENT_ENABLED=true, the provider attaches feature-flag evaluation metadata (ffe_flags_enc,ffe_subjects_enc, andffe_runtime_defaults) to the root APM span so traces and errors can be filtered by active flag variant. This is off by default and, when disabled, adds no per-span overhead. - The experimental OpenFeature provider now reports aggregated server-side flag evaluations to Datadog (the EVP
flagevaluationtrack), lighting up server-side flag-evaluation observability. The existingfeature_flag.evaluationsOpenTelemetry metric behavior is unchanged. The new emission is gated byDD_FLAGGING_EVALUATION_COUNTS_ENABLED(default enabled).
- Adds experimental APM span enrichment for the Feature Flagging and Experimentation (FFE) OpenFeature provider. When
-
mistralai:
- Adds support for tracing synchronous and asynchronous streaming chat completion calls using the
mistralaiclient.
- Adds support for tracing synchronous and asynchronous streaming chat completion calls using the
-
Profiling:
- Work offloaded by an asyncio task to a ThreadPoolExecutor is now labeled with the originating task.
- Native frames collected by the profiler are now attributed to third-party code in the code provenance view, rather than appearing as application code.
Bug Fixes
-
aiohttp:
- Fixes a
TypeError: 'tuple' object does not support item assignmentraised when passing headers as a sequence of(key, value)tuples (aiohttp'sLooseHeaderstype) to request methods such asgetorpost.
- Fixes a
-
aws_durable_execution_sdk_python:
- This fix resolves an issue where a replayed durable operation that had failed permanently reported an incorrect
aws.durable.replayedvalue and anaws.durable.operation_attemptone higher than its original execution.
- This fix resolves an issue where a replayed durable operation that had failed permanently reported an incorrect
-
CI Visibility:
- This fix resolves an issue where the Datadog UI showed
No extra information availablewhen viewing details about why a test was skipped by Intelligent Test Runner, due to missing ITR correlation ID on test or suite events. - Fixed an issue on Python 3.12+ where enabling coverage report upload (
DD_CIVISIBILITY_CODE_COVERAGE_REPORT_UPLOAD_ENABLED=true) alongside Test Impact Analysis caused per-test coverage data to be silently empty. The two features can now be enabled together. - Fixes an issue where pytest suites using suite-level Intelligent Test Runner skipping could still skip individual tests when the suite contains an unskippable test marker.
- This fix resolves an issue where the Datadog UI showed
-
LLM Observability:
- This fix resolves a token double-counting issue in the Claude Agent SDK integration. When the Claude Agent SDK split a single model turn into multiple
AssistantMessagechunks that share amessage_id, the integration emitted onellmspan per chunk and counted the turn's token usage multiple times. Chunks sharing amessage_idare now merged into a singlellmspan with the usage counted once. This applies toclaude-agent-sdk0.1.51 and later, which exposemessage_id; earlier versions retain the previous behavior. - Fixes an issue where the LangChain integration failed to submit traced chat model stream spans that completed without yielding any chunks.
- This fix resolves an issue where the
google_adkintegration dropped an agent span (loggingmissing span kind in span context) and orphaned its child spans when a Gemini response part could not be parsed. The span kind is now set before input/output extraction, so a parsing failure degrades to empty input/output instead of dropping the span. - This fix resolves an issue where the Google GenAI and
google_adkintegrations rendered unhandled Gemini response parts (such asinline_data,file_data, empty parts, or thought-signature parts) as a confusingUnsupported file typeplaceholder. These parts now produce a concise summary or empty content. - Fixes
LLMObs.submit_evaluation()incorrectly tagging evaluations withsource:otelbased on the globalDD_TRACE_OTEL_ENABLEDflag. The tag is now controlled by theis_otelfield on theExportedLLMObsSpandictionary:Truefor OTel gen.ai instrumented spans,Falsefor Datadog LLMObs spans.LLMObs.export_span()sets this field automatically. - Resolves an issue where OpenRouter requests made through the LiteLLM integration produced no span when the OpenAI integration was also enabled.
- Resolve an issue where the Pydantic AI integration failed to submit spans with JSON serialization errors when an agent's
model_settingscontained non-JSON-serializable provider sentinel values.
- This fix resolves a token double-counting issue in the Claude Agent SDK integration. When the Claude Agent SDK split a single model turn into multiple
-
Tracing:
- When APM tracing is disabled, all spans are now tagged as APM-disabled instead of only the local root span, so inferred services are no longer metered as having APM enabled.
- Fixes an issue in applications that fork where the security agent could read stale process metadata, preventing security signals from being correlated with APM traces.
-
flask:
- Fix span
resourceremaining as the raw URL path when a worker is killed beforestart_responseruns (e.g. gunicorn--timeout). The route pattern is now populated fromrequest.url_ruleduringpreprocess_request.
- Fix span
-
Code Security (IAST):
- Fixes an issue where taint tracking could abort the Python process when old-style
%string formatting handled tainted text containing literal IAST evidence marker delimiters. - This fix scopes
copy_ranges_from_stringsandcopy_and_shift_ranges_from_stringsto the active request slot, matching the scoped taint read path. Previously these copy helpers resolved the taint map by scanning all request slots, so a concurrent or still-open request could capture the derived taint and the current request would miss the transformed tainted input. - A crash occurring when using
uvloophas been fixed. - A an issue where container values could not go unscanned has been fixed.
- Resolve a weak-hash false positive reported on ddtrace's own code when IAST and the live debugger (Symbol Database) are both enabled.
- Fixes an issue where taint tracking could abort the Python process when old-style
-
langchain:
- Fixes an issue where a LangChain-wrapped Google GenAI (Gemini) chat model produced two
llm-kind LLM Observability spans for a single call when thelangchainandgoogle_genaiintegrations were both enabled, causing downstream cost and token metrics to be double-counted.
- Fixes an issue where a LangChain-wrapped Google GenAI (Gemini) chat model produced two
-
openfeature:
- This fix resolves an issue where the feature flagging provider failed to load with
openfeature-sdk0.10.0 or later.
- This fix resolves an issue where the feature flagging provider failed to load with
-
AAP:
- Reduces noisy warning logs from exploit prevention (RASP) checks running outside of a request context.
-
Fixed an issue that could have caused the internal symbol DB component to restart in nested fork child processes, potentially leading to high memory usage.
-
Fix crashes in uwsgi worker when exiting from SIGTERM.
-
openai_agents:
- This fix resolves an issue where the integration stopped capturing the agent manifest on
openai-agents >= 0.8.0. The integration now instruments those versions, restoring agent manifest capture.
- This fix resolves an issue where the integration stopped capturing the agent manifest on
-
profiling:
- Fixes the stack profiler tearing down an alternate signal stack it did not allocate (for example one installed by the application or the crash tracker), which could disable that component's fault handling.
- Fixes the stack profiler disabling another component's alternate signal stack at thread teardown when that stack had replaced the profiler's own.
- Fixes inconsistent handling of
DD_PROFILING_MAX_FRAMESby clamping it before stack collection so samples stay within the backend's 600-location limit.
Other Changes
- botocore:
- Improves the performance of AWS payload tagging by compiling each JSONPath redaction expression once and reusing it, instead of rebuilding the JSONPath parser and re-parsing every redaction path on each instrumented AWS API call. This reduces CPU overhead when
DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGINGorDD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGINGis enabled.
- Improves the performance of AWS payload tagging by compiling each JSONPath redaction expression once and reusing it, instead of rebuilding the JSONPath parser and re-parsing every redaction path on each instrumented AWS API call. This reduces CPU overhead when