Fix duplicate trace (#15931)

Co-authored-by: eycjur <eycjur@example.com>
This commit is contained in:
Katsuhiro Muto 2025-10-27 02:12:04 +09:00 committed by GitHub
parent 70650a044c
commit 75b5624b32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -186,9 +186,11 @@ class OpenTelemetry(CustomLogger):
)
return
# Add Otel as a service callback
if "otel" not in litellm.service_callback:
litellm.service_callback.append("otel")
# Add self as a service callback
if "otel" not in litellm.service_callback and all(
not isinstance(cb, OpenTelemetry) for cb in litellm.service_callback
):
litellm.service_callback.append(self)
setattr(proxy_server, "open_telemetry_logger", self)
def _init_tracing(self, tracer_provider):