pypi ddtrace 4.15.0rc1

3 hours ago

Estimated end-of-life date, accurate to within three months: 05-2027

See the support level definitions for more information.

Upgrade Notes

  • LLM Observability
    • The pydantic_ai integration now reports agent configuration using the shared agent manifest schema. framework, name, model, model_settings, instructions, system_prompts and tools keep their names and meaning. New keys are metadata, extra_instructions, capabilities, data_contracts, memory_policies, guardrails and agent_settings.

Deprecation Notes

  • tracing
    • The tracer parameter of ddtrace.runtime.RuntimeMetrics.enable is deprecated and will be removed in a future version. It has no effect.
  • google_cloud_pubsub
    • The DD_GOOGLE_CLOUD_PUBSUB_PROPAGATION_AS_SPAN_LINKS environment variable is deprecated and will be removed in a future release. Add google_cloud_pubsub to the DD_TRACE_PROPAGATION_AS_SPAN_LINKS list instead.

New Features

  • httpx2
    • Adds automatic tracing for synchronous and asynchronous HTTP requests made with httpx2>=2.0.0
  • tracing
    • Adds support for exporting Datadog trace metrics when OTLP trace export is enabled. Set OTEL_TRACES_SPAN_METRICS_ENABLED=true to enable it.
    • Adds support for DD_TRACE_STATS_ADDITIONAL_TAGS, which adds configured span tags to native v0.6 trace stats and OTLP trace metrics.
    • Adds OpenTelemetry thread-context synchronization for applications using Python's built-in asyncio event loop on Linux with Python 3.13 and earlier. This is enabled by default and can be disabled with DD_TRACE_OTEL_CTX_ENABLED=false.
    • When DD_TRACE_OTEL_CTX_ENABLED is true (the default), propagated trace contexts are published to OpenTelemetry thread context records. This lets external readers retain trace and span correlation when no active span object is available.
    • Adds Python 3.14+ support for keeping OpenTelemetry thread-context records synchronized across asynchronous context switches. This behavior is enabled by default and can be disabled by setting DD_TRACE_OTEL_CTX_ENABLED to false.
    • Adds the DD_TRACE_PROPAGATION_AS_SPAN_LINKS environment variable, a comma-separated list of integration names (e.g. google_cloud_pubsub,kafka) for which propagated context is attached as span links instead of a parent-child relationship.
  • profiling
    • This introduces inclusion of birth timestamp to allocation samples.
    • Add experimental native (C/C++) heap profiling for Python processes on Linux (glibc only). Enabled with DD_PROFILING_NATIVE_HEAP_ENABLED=true.
    • Time spent in garbage collection is now tracked by the profiler and appears in flame graphs. It can be enable with DD_PROFILING_STACK_GC_ENABLED=true.
    • It is now possible to set a maximum number of asyncio tasks/greenlets to sample per cycle.
  • AAP
    • Adds SSRF exploit prevention and OWASP API Top 10 security risk analysis for the httpx2 client.
  • ASM
    • Adds SQL injection attack detection and blocking for applications using the aiomysql, aiopg, psycopg async, and MySQL Connector/Python asyncio database drivers.
  • gevent
    • Adds automatic synchronization of OpenTelemetry thread context when gevent switches between greenlets.
  • LLM Observability
    • The Anthropic integration now captures inline base64 image inputs on message requests as image_parts on LLM span messages, so they can be rendered in LLM Observability. Note: images referenced by a URL or a file ID are not captured, and a very large inline image is replaced with a text placeholder.
    • Datasets, experiments, and custom evaluator publishing no longer require DD_APP_KEY on the application when a Datadog Agent is used.
    • The OpenAI integration now captures inline base64 images from message content as image_parts on LLM span messages, for both Chat Completions and the Responses API, so image inputs render in LLM Observability. This also applies to the OpenAI Agents SDK and to the LiteLLM integration, which share the same message extraction. Images referenced by a remote URL or file_id are not fetched and keep their existing text reference. A single inline image whose base64 payload exceeds 4 MiB is left as an [image omitted: too large] marker instead. Note that this budget is per image, not per request: several inline images (or an image alongside inline audio) can still take a span event past the 5 MB per-event limit, at which point the event's input and output are replaced with a placeholder. To stop image bytes from being recorded, register a span processor with LLMObs.register_processor and remove the image_parts key from the messages on span.input.
  • openfeature
    • Datadog now uses a serial id to attribute an exposure to the experiment or holdout that assigned the variant.

Bug Fixes

  • tracing
    • Fixes an issue where untraced work in a reused thread-pool worker could expose stale OpenTelemetry trace context.
    • Fixes an issue where APM Tracing remote configuration is not applied when the environment is configured only on the Datadog Agent.
    • Fixed a memory leak in the HTTP client integrations (aiohttp, httpx, requests, urllib3) where a strong reference to each response object was retained, preventing garbage collection of response bodies and causing linear RSS growth on sequential requests.
    • When DD_TRACE_OTEL_SEMANTICS_ENABLED=true, HTTP client spans now use the HTTP method as their resource name. This keeps the resource name distinct from the operation name and adds method-level information that better aligns with OpenTelemetry semantics; default resource names are unchanged.
    • Fixes an issue where runtime.python.* metrics stopped carrying the dd.internal.entity_id tag after the first flush, even when DD_ENTITY_ID was set. This prevented the Datadog Agent from attaching pod_name and kube_namespace to runtime metrics in Kubernetes.
    • Fixes an issue where runtime metrics (memory RSS, thread count, CPU usage, context switches) reported the parent process's values instead of the current process's values after a fork, for example under a pre-fork server like gunicorn.
    • Fixes an issue where the Datadog environment is not set from the deployment.environment.name attribute in OTEL_RESOURCE_ATTRIBUTES.
  • LLM Observability
    • fixes an issue where _DD_TRACE_WRITER_ADDITIONAL_HEADERS header values containing a whitespace (for example Bearer <token>) were incorrectly parsed, resulting in a truncated header value that caused LLM Observability spans to be dropped.
    • Fixes an issue where token counts were not captured properly on LLM spans generated via the Claude Agent SDK integration. The integration now reads the accurate per-turn token counts from the SDK's streaming events, leaving the caller's message stream unchanged. This also enables token counts on claude-agent-sdk versions prior to 0.1.49, which do not report usage on the assistant message. Note that explicitly setting include_partial_messages=False on ClaudeAgentOptions opts out of this behavior and will result in inaccurate per-turn output token counts.
    • Fixes an issue where spans created under an auto-instrumented agent span (CrewAI, Google ADK, LangGraph, LlamaIndex, Amazon Bedrock Agents, Claude Agent SDK, and OpenAI Agents) were not attributed to that agent, leaving agent_attribution missing or pointing at the wrong ancestor.
    • Fixes missing Prompt Experimentation exposures when DD_FEATURE_FLAGS_CONFIGURATION_SOURCE is set to agentless or remote_config.
    • Fixes an issue where the agentless exporter dropped traces due to non-JSON-serializable objects being stored on a span. All LLM Observability span data is now made JSON-serializable before the span is submitted. Non-string span tag keys, span metric keys, and agent versions supplied via LLMObs.annotate(agent=...) are also now coerced to strings.
    • Fixes an issue where an inline base64 image sent in message content to the OpenAI Responses API (including through the OpenAI Agents SDK) was recorded as the entire base64 data URL inside the message text, producing unreadable multi-megabyte span content.
    • Fixes an issue where an inline base64 image passed as a reusable-prompt variable to the OpenAI Responses API was recorded as the entire base64 data URL on the span. Such a variable is now recorded as [image]; remote URL and file_id references are unchanged.
    • Fixes an issue where OpenAI Responses API image-generation results and computer-use screenshots were recorded as a stringified dump of the whole response item, which embedded the image's base64 payload in the output message. They are now recorded as an [image] marker, or as the screenshot's URL when it is a remote reference.
  • AAP
    • Fixes an issue where memory usage grows over time when AAP is enabled for applications making traced outbound HTTP requests.
    • Fixes an issue where setting DD_APPSEC_RULES to an empty value prevents AppSec rules from being updated through remote configuration.
    • Fixes an issue where exploit prevention misses command injection attempts when subprocess commands are passed as tuples.
  • ASM
    • Fixes an issue where exceptions raised by open() or pathlib.Path.open() are reported with a corrupted traceback when Exploit Prevention is enabled, showing a duplicated caller frame and omitting the frame that actually raised.
  • gevent
    • Fixes an issue where context propagation bypasses a custom context provider configured on the tracer.
  • google-adk
    • Fixes an AttributeError on google-adk >= 2.7.0 caused by the removal of __call_tool_live. Applications with LLM Observability enabled failed to start.
    • Fixes an issue on google-adk < 2.7.0 where streaming tool call spans recorded no output.
  • Code Security (IAST)
    • Fixes a SystemError raised inside an instrumented request when an operation handled a container holding an object that cannot be hashed, such as the cookie objects Django builds in HttpResponse.set_cookie, and fixes the same error when a regular expression matched against a bytearray.
    • Fixes a NameError raised from application code that calls eval() when the wrapt C extension is unavailable and its pure-Python implementation is used, which caused Code Security to resolve the wrong caller scope.
  • openfeature
    • This fix resolves an issue where replacing the feature flag configuration could leave a forked worker process (for example under gunicorn or uWSGI) with no configuration, so every subsequent flag evaluation returned the caller-provided default with the PROVIDER_NOT_READY error code.
    • This fix resolves an issue where an invalid value for a numeric Feature Flagging environment variable raised an exception while importing ddtrace.openfeature, preventing the application from starting. Such values are now logged and the documented default is used instead.
  • otel
    • Fixes an issue where OTLP gRPC exporter requests are incorrectly traced when OpenTelemetry logs or metrics collection is enabled with opentelemetry-exporter-otlp-proto-grpc 1.34.0 or later.
  • profiling
    • Fixes an issue where asyncio tasks can be duplicated in profiles on Python 3.14, causing inflated task counts and wall time and increased profiler CPU usage.
    • Fixes an issue where asyncio task samples could be reported with the coroutine frames at the top of the stack and the calling frames duplicated underneath them.
    • Fixes an issue where untraced work is attributed to the endpoint of a previously finished trace on the same thread.
    • Fast memory copy is now automatically disabled when Python is running as an embedded interpreter.
    • A rare crash happening when using gevent has been fixed.
  • snowflake
    • Fixes an issue where traced cursor calls fail when command is passed as a keyword argument to execute or executemany.
  • vllm
    • Fixes an issue where the integration failed to instrument vLLM >= 0.14.0 with ModuleNotFoundError: No module named 'vllm.v1.engine.processor', silently disabling all vLLM tracing and metrics.
  • code origin for spans
    • prevent view or traced functions from raising an exception in situations where their number is large.
  • CI visibility
    • Fixes an issue where test sessions running with pytest-xdist on shallow Git checkouts can spend excessive time unshallowing the repository and may fail or time out during collection.

Don't miss a new ddtrace release

NewReleases is sending notifications on new releases.