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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Supper OTLP standard environment variables for configuration (#10813)
Damien Pontifex63a4287bff28
diff --git a/docs/my-website/docs/observability/opentelemetry_integration.md b/docs/my-website/docs/observability/opentelemetry_integration.mdindex 5df82c93c87..958c33f18e6 100644--- a/docs/my-website/docs/observability/opentelemetry_integration.md+++ b/docs/my-website/docs/observability/opentelemetry_integration.md@@ -34,8 +34,9 @@ OTEL_HEADERS="Authorization=Bearer%20<your-api-key>"<TabItem value="otel-col" label="Log to OTEL HTTP Collector">```shell-OTEL_EXPORTER="otlp_http"-OTEL_ENDPOINT="http://0.0.0.0:4318"+OTEL_EXPORTER_OTLP_ENDPOINT="http://0.0.0.0:4318"+OTEL_EXPORTER_OTLP_PROTOCOL=http/json+OTEL_EXPORTER_OTLP_HEADERS="api-key=key,other-config-value=value"```</TabItem>@@ -43,8 +44,9 @@ OTEL_ENDPOINT="http://0.0.0.0:4318"<TabItem value="otel-col-grpc" label="Log to OTEL GRPC Collector">```shell-OTEL_EXPORTER="otlp_grpc"-OTEL_ENDPOINT="http://0.0.0.0:4317"+OTEL_EXPORTER_OTLP_ENDPOINT="http://0.0.0.0:4318"+OTEL_EXPORTER_OTLP_PROTOCOL=grpc+OTEL_EXPORTER_OTLP_HEADERS="api-key=key,other-config-value=value"```</TabItem>@@ -98,7 +100,7 @@ LiteLLM emits the user_api_key_metadata- user_id- team_id-for successful + failed requests+for successful + failed requestsclick under `litellm_request` in the tracediff --git a/litellm/integrations/opentelemetry.py b/litellm/integrations/opentelemetry.pyindex 01be466dff1..270e55da66c 100644--- a/litellm/integrations/opentelemetry.py+++ b/litellm/integrations/opentelemetry.py@@ -63,14 +63,16 @@ class OpenTelemetryConfig:InMemorySpanExporter,)- if os.getenv("OTEL_EXPORTER") == "in_memory":+ exporter=os.getenv("OTEL_EXPORTER_OTLP_PROTOCOL", os.getenv("OTEL_EXPORTER", "console"))+ endpoint=os.getenv("OTEL_EXPORTER_OTLP_ENDPOINT", os.getenv("OTEL_ENDPOINT"))+ headers=os.getenv("OTEL_EXPORTER_OTLP_HEADERS", os.getenv("OTEL_HEADERS")) # example: OTEL_HEADERS=x-honeycomb-team=B85YgLm96***"++ if exporter == "in_memory":return cls(exporter=InMemorySpanExporter())return cls(- exporter=os.getenv("OTEL_EXPORTER", "console"),- endpoint=os.getenv("OTEL_ENDPOINT"),- headers=os.getenv(- "OTEL_HEADERS"- ), # example: OTEL_HEADERS=x-honeycomb-team=B85YgLm96***"+ exporter=exporter,+ endpoint=endpoint,+ headers=headers, # example: OTEL_HEADERS=x-honeycomb-team=B85YgLm96***")@@ -854,7 +856,7 @@ class OpenTelemetry(CustomLogger):self.OTEL_EXPORTER,)return BatchSpanProcessor(ConsoleSpanExporter())- elif self.OTEL_EXPORTER == "otlp_http":+ elif self.OTEL_EXPORTER == "otlp_http" or self.OTEL_EXPORTER == "http/protobuf" or self.OTEL_EXPORTER == "http/json":verbose_logger.debug("OpenTelemetry: intiializing http exporter. Value of OTEL_EXPORTER: %s",self.OTEL_EXPORTER,@@ -864,7 +866,7 @@ class OpenTelemetry(CustomLogger):endpoint=self.OTEL_ENDPOINT, headers=_split_otel_headers),)- elif self.OTEL_EXPORTER == "otlp_grpc":+ elif self.OTEL_EXPORTER == "otlp_grpc" or self.OTEL_EXPORTER == "grpc":verbose_logger.debug("OpenTelemetry: intiializing grpc exporter. Value of OTEL_EXPORTER: %s",self.OTEL_EXPORTER,