BerriAI/litellm · error · Exception

DD_SITE is not set, set 'DD_SITE=<>', example site = `us5.da

Error message

DD_SITE is not set, set 'DD_SITE=<>', example site = `us5.datadoghq.com`

What it means

Same truthiness re-validation as 373 but for the site: __init__ only rejects a None DD_SITE (line 72), so an empty-string DD_SITE passes and later fails in _configure_dd_direct_api() with 'not self.DD_SITE'. The message here includes a correct example ('example site = us5.datadoghq.com'). Surfaced at construction time in direct-API mode.

Source

Thrown at litellm/integrations/datadog/datadog_llm_obs.py:117

        # When using the Agent, LLM Observability Intake does NOT require the API Key
        # Reference: https://docs.datadoghq.com/llm_observability/setup/sdk/#agent-setup

        # Use specific port for LLM Obs (Trace Agent) to avoid conflict with Logs Agent (10518)
        agent_port: Final = os.getenv("LITELLM_DD_LLM_OBS_PORT", "8126")
        self.DD_SITE = "localhost"  # Not used for URL construction in agent mode
        self.intake_url = f"http://{dd_agent_host}:{agent_port}/api/intake/llm-obs/v1/trace/spans"
        verbose_logger.debug("DataDogLLMObs: Using DD Agent at %s", self.intake_url)

    def _configure_dd_direct_api(self):
        """
        Configure the Datadog logger to send traces directly to the Datadog API.
        """
        if not self.DD_API_KEY:
            raise Exception("DD_API_KEY is not set, set 'DD_API_KEY=<>'")

        self.DD_SITE = os.getenv("DD_SITE")
        if not self.DD_SITE:
            raise Exception("DD_SITE is not set, set 'DD_SITE=<>', example site = `us5.datadoghq.com`")

        self.intake_url = f"https://api.{self.DD_SITE}/api/intake/llm-obs/v1/trace/spans"

    def _get_datadog_llm_obs_params(self) -> dict:
        """
        Get the datadog_llm_observability_params from litellm.datadog_llm_observability_params

        These are params specific to initializing the DataDogLLMObsLogger e.g. turn_off_message_logging
        """
        dict_datadog_llm_obs_params: dict = {}
        if litellm.datadog_llm_observability_params is not None:
            if isinstance(litellm.datadog_llm_observability_params, DatadogLLMObsInitParams):
                dict_datadog_llm_obs_params = litellm.datadog_llm_observability_params.model_dump()
            elif isinstance(litellm.datadog_llm_observability_params, dict):
                # only allow params that are of DatadogLLMObsInitParams
                dict_datadog_llm_obs_params = DatadogLLMObsInitParams(
                    **litellm.datadog_llm_observability_params
                ).model_dump()

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Set DD_SITE to your actual Datadog site (non-empty)
  2. Audit .env / compose files for keys with empty values and remove or fill them
  3. Prefer agent mode (LITELLM_DD_AGENT_HOST) when direct-API env management is error-prone

Example fix

# before
# docker-compose.yml
environment:
  - DD_SITE=${DD_SITE}   # DD_SITE undefined -> empty string

# after
environment:
  - DD_SITE=${DD_SITE:-us5.datadoghq.com}
Defensive patterns

Strategy: validation

Validate before calling

import os

site = os.getenv("DD_SITE")
assert site and site.strip(), "DD_SITE is empty — fix compose interpolation or .env"

Try / catch

try:
    DataDogLLMObsLogger()
except Exception as e:
    if "DD_SITE" in str(e):
        set_default_site("us5.datadoghq.com")
    raise

Prevention

When it happens

Trigger: DD_SITE exported as an empty string (or stripped to empty) while running DataDogLLMObsLogger in direct API mode without LITELLM_DD_AGENT_HOST.

Common situations: Env templating that renders empty values for unset vars; yaml/docker-compose interpolating a missing variable as ''; copy-paste .env files with the value deleted but the key left in.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/00318ef914e79018. Report an issue: GitHub.