{"record":{"id":"2c73ddd3c9deeda1","repo":"BerriAI/litellm","slug":"dd-site-is-not-set-in-env-set-dd-site","errorCode":null,"errorMessage":"DD_SITE is not set in .env, set 'DD_SITE=<>","messagePattern":"DD_SITE is not set in \\.env, set 'DD_SITE=<>","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/integrations/datadog/datadog.py","lineNumber":238,"sourceCode":"    ) -> None:\n        \"\"\"\n        Configure direct DataDog API connection\n\n        Args:\n            dd_api_key: Datadog API key. Falls back to DD_API_KEY env var when allow_env_credentials is True.\n            dd_site: Datadog site. Falls back to DD_SITE env var.\n            allow_env_credentials: When False, never read the API key from DD_API_KEY env var.\n\n        Raises:\n            Exception: If required credentials are not provided via args or env vars\n        \"\"\"\n        resolved_api_key: Final = dd_api_key or (os.getenv(\"DD_API_KEY\") if allow_env_credentials else None)\n        resolved_site: Final = dd_site or os.getenv(\"DD_SITE\")\n\n        if resolved_api_key is None:\n            raise Exception(\"DD_API_KEY is not set, set 'DD_API_KEY=<>\")\n        if resolved_site is None:\n            raise Exception(\"DD_SITE is not set in .env, set 'DD_SITE=<>\")\n\n        self.DD_API_KEY = resolved_api_key\n        self.intake_url = f\"https://http-intake.logs.{resolved_site}/api/v2/logs\"\n\n    async def async_log_success_event(self, kwargs, response_obj, start_time, end_time):\n        \"\"\"\n        Async Log success events to Datadog\n\n        - Creates a Datadog payload\n        - Adds the Payload to the in memory logs queue\n        - Payload is flushed every 10 seconds or when batch size is greater than 100\n\n\n        Raises:\n            Raises a NON Blocking verbose_logger.exception if an error occurs\n        \"\"\"\n        try:\n            verbose_logger.debug(\"Datadog: Logging - Enters logging function for model %s\", kwargs)","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/datadog/datadog.py#L220-L256","documentation":"The site twin of the Datadog credential check: DatadogLogger.__init__ resolves dd_site from the argument or the DD_SITE env var (there is no allow_env_credentials gate on the site) and raises this Exception when both are empty. Without the site the intake URL (https://http-intake.logs.<site>/api/v2/logs) cannot be built, so the logger refuses to start.","triggerScenarios":"DD_API_KEY set but DD_SITE unset when the datadog callback initializes; passing dd_api_key explicitly while forgetting dd_site; EU/custom-region Datadog accounts where the correct site (e.g. eu1.datadoghq.eu, us5.datadoghq.com) was never configured.","commonSituations":"Deployments that copy only the API key from Datadog's setup page; orgs on non-us1 regions wondering why logs vanish — here they fail fast instead; env files trimmed during containerization.","solutions":["export DD_SITE=<your site, e.g. us5.datadoghq.com or eu1.datadoghq.eu> and restart the process","Or pass dd_site explicitly in the logger construction alongside dd_api_key","Verify with the Datadog API which site your org belongs to and use that exact hostname","Add both DD_API_KEY and DD_SITE to your deployment's secret/env spec"],"exampleFix":"# before\nexport DD_API_KEY=xxxx\ndatadog_logger = DatadogLogger()  # Exception: DD_SITE is not set\n\n# after\nexport DD_API_KEY=xxxx\nexport DD_SITE=us5.datadoghq.com\ndatadog_logger = DatadogLogger()","handlingStrategy":"validation","validationCode":"import os\n\nif not (os.getenv('DD_SITE') or explicit_dd_site):\n    raise RuntimeError('DD_SITE missing: set it (e.g. us5.datadoghq.com) before adding the datadog callback')","typeGuard":"def datadog_site_configured() -> bool:\n    import os\n    return bool(os.getenv('DD_SITE'))","tryCatchPattern":"except Exception as e:\n    if 'DD_SITE is not set' in str(e):\n        export the correct DD_SITE for your Datadog region and restart the logger/process\n    raise","preventionTips":["Copy both credential values from the Datadog setup page, not just the API key","Confirm your org's site hostname (us5.datadoghq.com, eu1.datadoghq.eu, ...) in deployment env","Include DD_SITE in the same secret/env checklist as DD_API_KEY"],"tags":["datadog","environment-variables","configuration","logging","litellm"],"backgroundTag":"missing-env-var","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}