BerriAI/litellm · error · Exception
DD_SITE is not set in .env, set 'DD_SITE=<>
Error message
DD_SITE is not set in .env, set 'DD_SITE=<>
What it means
DataDogLogger needs the Datadog site (e.g. us5.datadoghq.com, datadoghq.eu) to build its logs intake URL (https://http-intake.logs.<site>/api/v2/logs). The constructor resolves dd_site or the DD_SITE env var; if neither exists it raises this Exception at init. Without it the integration cannot know which regional intake to POST to.
Source
Thrown at litellm/integrations/datadog/datadog.py:238
) -> None:
"""
Configure direct DataDog API connection
Args:
dd_api_key: Datadog API key. Falls back to DD_API_KEY env var when allow_env_credentials is True.
dd_site: Datadog site. Falls back to DD_SITE env var.
allow_env_credentials: When False, never read the API key from DD_API_KEY env var.
Raises:
Exception: If required credentials are not provided via args or env vars
"""
resolved_api_key: Final = dd_api_key or (os.getenv("DD_API_KEY") if allow_env_credentials else None)
resolved_site: Final = dd_site or os.getenv("DD_SITE")
if resolved_api_key is None:
raise Exception("DD_API_KEY is not set, set 'DD_API_KEY=<>")
if resolved_site is None:
raise Exception("DD_SITE is not set in .env, set 'DD_SITE=<>")
self.DD_API_KEY = resolved_api_key
self.intake_url = f"https://http-intake.logs.{resolved_site}/api/v2/logs"
async def async_log_success_event(self, kwargs, response_obj, start_time, end_time):
"""
Async Log success events to Datadog
- Creates a Datadog payload
- Adds the Payload to the in memory logs queue
- Payload is flushed every 10 seconds or when batch size is greater than 100
Raises:
Raises a NON Blocking verbose_logger.exception if an error occurs
"""
try:
verbose_logger.debug("Datadog: Logging - Enters logging function for model %s", kwargs)View on GitHub (pinned to 6c2dcb801b)
Solutions
- Set DD_SITE to your org's Datadog site (find it in the Datadog UI URL, e.g. us5.datadoghq.com or datadoghq.eu)
- Or pass dd_site explicitly to the DataDogLogger constructor
- Add both DD_API_KEY and DD_SITE to the same secret/env mechanism so they stay in sync
Example fix
# before export DD_API_KEY=xxx # DD_SITE missing -> init raises # after export DD_API_KEY=xxx export DD_SITE=us5.datadoghq.com
Defensive patterns
Strategy: validation
Validate before calling
import os
site = os.getenv("DD_SITE")
if site:
assert "." in site, f"DD_SITE looks wrong: {site!r}" Try / catch
try:
DataDogLogger()
except Exception as e:
if "DD_SITE" in str(e):
export_and_restart("DD_SITE=us5.datadoghq.com")
raise Prevention
- Copy DD_SITE from your Datadog UI URL, not from generic docs
- Pair DD_SITE with DD_API_KEY in the same env template
When it happens
Trigger: DD_API_KEY is set (or passed) but DD_SITE is not set and no dd_site argument given, during DataDogLogger construction. Note the env fallback for the site is not gated by allow_env_credentials, only the key is.
Common situations: New Datadog onboarding where teams copy the API key but not the site; EU/custom-site orgs assuming us1 defaults; docker deployments passing only DD_API_KEY.
Related errors
- DD_API_KEY is not set, set 'DD_API_KEY=<>
- DD_API_KEY is not set, set 'DD_API_KEY=<>'
- DD_SITE is not set, set 'DD_SITE=<>', example sit = `us5.dat
- Response from datadog API status_code: {response.status_code
- DD_SITE is not set, set 'DD_SITE=<>', example site = `us5.da
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/2c73ddd3c9deeda1.
Report an issue: GitHub.