{"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/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/datadog/datadog.py#L220-L256","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nexport DD_API_KEY=xxx\n# DD_SITE missing -> init raises\n\n# after\nexport DD_API_KEY=xxx\nexport DD_SITE=us5.datadoghq.com","handlingStrategy":"validation","validationCode":"import os\n\nsite = os.getenv(\"DD_SITE\")\nif site:\n    assert \".\" in site, f\"DD_SITE looks wrong: {site!r}\"","typeGuard":null,"tryCatchPattern":"try:\n    DataDogLogger()\nexcept Exception as e:\n    if \"DD_SITE\" in str(e):\n        export_and_restart(\"DD_SITE=us5.datadoghq.com\")\n    raise","preventionTips":["Copy DD_SITE from your Datadog UI URL, not from generic docs","Pair DD_SITE with DD_API_KEY in the same env template"],"tags":["datadog","logging","env-vars","config"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}