pypi ddtrace 4.6.0rc1

16 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
    • Experiments spans now contain config from the experiment initialization, allowing for searching of relevant spans using the experiment config.
    • Experiments spans now contain the tags from the dataset records, allowing for searching of relevant spans using the dataset record tags.

Deprecation Notes

  • tracing
    • The type annotation for Span.parent_id will change from Optional[int] to int in v5.0.0.

New Features

  • LLM Observability
    • This introduces LLMObs.get_prompt() to retrieve managed prompts from Datadog's Prompt Registry. The method returns a ManagedPrompt object with a format()
      method for variable substitution. Prompt updates propagate to running applications within the cache TTL (default: 60 seconds).
      Use with annotation_context or annotate to correlate prompts with LLM spans:

      prompt = LLMObs.get_prompt("greeting")
      variables = {"user": "Alice"}
      with LLMObs.annotation_context(prompt=prompt.to_annotation_dict(**variables)):
          openai.chat.completions.create(messages=prompt.format(**variables))
    • experiments propagate canonical_ids from dataset records to the corresponding experiments span when present. The canonical_ids are only guaranteed to be available after calling pull_dataset.

    • LLMObs.create_dataset supports a bulk_upload parameter to control data uploading behavior. Both LLMObs.create_dataset and LLMObs.create_dataset_from_csv supports users specifying the deduplicate parameter.

    • Subset of dataset records can now be pulled with tags by using the tags argument to LLMObs.pull_dataset, provided in a list of strings of key value pairs: LLMObs.pull_dataset(dataset_name="my-dataset", tags=["env:prod", "version:1.0"])

Bug Fixes

  • LLM Observability
    • Fix data duplication issue when uploading > 5MB datasets via LLMObs.create_dataset.
  • ai_guard
    • Fix TypeError while processing failed AI Guard responses, leading to overriding the original error.
  • openai_agents
    • Fixes an AttributeError on openai-agents >= 0.8.0 caused by the removal of AgentRunner._run_single_turn.
  • profiling
    • A bug which could prevent Profiling from being enabled when the library is installed through Single Step Instrumentation was fixed.
    • This fixes an issue where the profiler was patching the gevent module unnecessarily even when the profiler was not enabled.
  • data_streams
    • Add kafka_cluster_id tag to Kafka offset/backlog tracking for confluent-kafka. Previously, cluster ID was only included in DSM checkpoint edge tags (produce/consume) but missing from offset commit and produce offset backlogs. This ensures correct attribution of backlog data to specific Kafka clusters when multiple clusters share topic names.

Other Changes

  • profiling
    • reduces code provenance CPU overhead when using fork-based frameworks like gunicorn and uWSGI.

Don't miss a new ddtrace release

NewReleases is sending notifications on new releases.