Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Fix duplicate trace (#15931)

Katsuhiro Muto75b5624b32ec
diff --git a/litellm/integrations/opentelemetry.py b/litellm/integrations/opentelemetry.py
index 267a63be5c2..11f2c6b2618 100644
--- a/litellm/integrations/opentelemetry.py
+++ b/litellm/integrations/opentelemetry.py
@@ -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):