BerriAI/litellm · error · Exception

DD_SITE is not set, set 'DD_SITE=<>', example site =…

Error message

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

What it means

Defensive re-check inside _configure_dd_direct_api(): after reading DD_SITE from the environment, an empty/missing value aborts direct-API configuration (message here spells 'site' correctly, unlike the __init__ variant's 'sit'). Like error 344 it uses truthiness, so DD_SITE="" is rejected too. Reachable when _configure_dd_direct_api runs standalone or when the __init__ env check was bypassed (e.g. empty-string value).

Solutions

  1. Set DD_SITE to your region hostname (us5.datadoghq.com, datadoghq.eu, etc.) and verify it is non-empty in the running process
  2. Audit deployment templates so DD_SITE is either fully rendered or the agent-mode variables are used instead
  3. Confirm the value matches the region in your Datadog app URL

Example fix

# before
# helm values: datadog: { site: "{{ .Values.ddSite | default "" }}" } -> DD_SITE=""

# after
# helm values: datadog: { site: "us5.datadoghq.com" } -> DD_SITE=us5.datadoghq.com
Defensive patterns

Strategy: validation

Validate before calling

import os

def dd_site_present_and_nonempty() -> bool:
    return bool((os.getenv("DD_SITE") or "").strip())

Prevention

When it happens

Trigger: DD_SITE exported as an empty string from a templated config; direct invocation of _configure_dd_direct_api in tests; whitespace-only DD_SITE value.

Common situations: Helm/k8s templating that renders DD_SITE: "" when a value is omitted; CI variables defined but blank; env files with 'DD_SITE=' lines.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: 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 77b7c6c40c)