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
ensure datadog llm obs ignores dd base url override
Yuta Saito72f424c71903
diff --git a/litellm/integrations/datadog/datadog_llm_obs.py b/litellm/integrations/datadog/datadog_llm_obs.pyindex b44762d0af8..938ad33f297 100644--- a/litellm/integrations/datadog/datadog_llm_obs.py+++ b/litellm/integrations/datadog/datadog_llm_obs.py@@ -56,11 +56,6 @@ class DataDogLLMObsLogger(DataDogLogger, CustomBatchLogger):f"https://api.{self.DD_SITE}/api/intake/llm-obs/v1/trace/spans")- # testing base url- dd_base_url = os.getenv("DD_BASE_URL")- if dd_base_url:- self.intake_url = f"{dd_base_url}/api/intake/llm-obs/v1/trace/spans"-asyncio.create_task(self.periodic_flush())self.flush_lock = asyncio.Lock()self.log_queue: List[LLMObsPayload] = []diff --git a/tests/test_litellm/integrations/datadog/test_datadog_llm_observability.py b/tests/test_litellm/integrations/datadog/test_datadog_llm_observability.pyindex 464cb0026e5..c26ea885fa5 100644--- a/tests/test_litellm/integrations/datadog/test_datadog_llm_observability.py+++ b/tests/test_litellm/integrations/datadog/test_datadog_llm_observability.py@@ -293,6 +293,19 @@ class TestDataDogLLMObsLogger:assert logger._get_datadog_span_kind("unknown_call_type") == "llm"assert logger._get_datadog_span_kind(None) == "llm"+ def test_dd_base_url_does_not_override_intake_url(self, mock_env_vars):+ """Even if DD_BASE_URL is set, intake_url should remain DD_SITE-based"""+ with patch.dict(os.environ, {"DD_BASE_URL": "https://example.datadog"}):+ with patch(+ "litellm.integrations.datadog.datadog_llm_obs.get_async_httpx_client"+ ), patch("asyncio.create_task"):+ logger = DataDogLLMObsLogger()++ expected_url = (+ f"https://api.{logger.DD_SITE}/api/intake/llm-obs/v1/trace/spans"+ )+ assert logger.intake_url == expected_url+@pytest.mark.asyncioasync def test_async_log_failure_event(self, mock_env_vars):"""Test that async_log_failure_event correctly processes failure payloads according to DD LLM Obs API spec"""