From 20bcd775c4ab2cd48751f54b9ee980a29caa9109 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Fri, 19 Jun 2026 06:00:05 +0000 Subject: [PATCH] fix(completion): keep @tracer.wrap() on completion, not the dispatch context The dispatch-extraction refactor inserted _CompletionDispatchContext and its helpers between `return entry` and `completion`, which left completion's @tracer.wrap() decorator stranded on the new frozen dataclass. That silently dropped the tracing span from completion, the library's hottest entrypoint, and instead had ddtrace wrap the dataclass constructor (replacing the class with a function wrapper at runtime). Restore the decorator above @client on completion, matching litellm_internal_staging, and remove it from the dataclass. --- litellm/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/main.py b/litellm/main.py index b41a222bfe4..9f69d9c9875 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -1085,7 +1085,6 @@ def _build_custom_pricing_entry( return entry -@tracer.wrap() @dataclass(frozen=True, slots=True) class _CompletionDispatchContext: _azure_detection_model: str @@ -5011,6 +5010,7 @@ def _complete_langflow(ctx: _CompletionDispatchContext): return response +@tracer.wrap() @client def completion( # type: ignore model: str,