fix(proxy): add datadog_llm_observability to /health/services allowed list (#19952)

The /health/services endpoint rejected datadog_llm_observability as an
unknown service, even though it was registered in the core callback
registry and __init__.py. Added it to both the Literal type hint and
the hardcoded validation list in the health endpoint.
This commit is contained in:
michelligabriele 2026-01-29 07:16:27 +01:00 committed by GitHub
parent 2a48d12507
commit dcf5f07e5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 39 additions and 0 deletions

View file

@ -118,6 +118,7 @@ services = Union[
"email",
"braintrust",
"datadog",
"datadog_llm_observability",
"generic_api",
"arize",
"sqs"
@ -190,6 +191,7 @@ async def health_services_endpoint( # noqa: PLR0915
"custom_callback_api",
"langsmith",
"datadog",
"datadog_llm_observability",
"generic_api",
"arize",
"sqs"

View file

@ -312,6 +312,43 @@ async def test_test_model_connection_loads_config_from_router():
assert "result" in result
@pytest.mark.asyncio
async def test_health_services_endpoint_datadog_llm_observability():
"""
Verify that 'datadog_llm_observability' is accepted as a valid service
by the /health/services endpoint and does not raise a 400 error.
Regression test for: https://github.com/BerriAI/litellm/issues/XXXX
The service was missing from the allowed services validation list.
"""
from litellm.proxy.health_endpoints._health_endpoints import (
health_services_endpoint,
)
# Mock datadog_llm_observability to be in success_callback so the generic branch handles it
with patch("litellm.success_callback", ["datadog_llm_observability"]):
result = await health_services_endpoint(
service="datadog_llm_observability"
)
# Should not raise HTTPException(400) and should return success
assert result["status"] == "success"
assert "datadog_llm_observability" in result["message"]
@pytest.mark.asyncio
async def test_health_services_endpoint_rejects_unknown_service():
"""
Verify that an unknown service name is rejected with a 400 error.
"""
from litellm.proxy._types import ProxyException
with pytest.raises(ProxyException):
await health_services_endpoint(
service="totally_unknown_service_xyz"
)
@pytest.fixture(scope="function")
def proxy_client(monkeypatch):
"""