{"id":7124,"library":"dagster-datadog","title":"Dagster Datadog Integration","description":"The `dagster-datadog` library provides components to integrate Dagster with Datadog for monitoring and observability. This includes resources for sending metrics and events, and loggers for forwarding Dagster logs to Datadog. It is currently at version 0.29.0 and is released as part of the Dagster ecosystem's approximately monthly release cycle, with library versions tracking core Dagster releases.","status":"active","version":"0.29.0","language":"en","source_language":"en","source_url":"https://github.com/dagster-io/dagster/tree/master/python_modules/libraries/dagster-datadog","tags":["dagster","datadog","observability","metrics","logging","monitoring"],"install":[{"cmd":"pip install dagster-datadog","lang":"bash","label":"Install dagster-datadog"}],"dependencies":[{"reason":"Core Dagster framework is required to use the integration components.","package":"dagster"},{"reason":"The official Datadog client library is required for communication with Datadog APIs.","package":"datadog"}],"imports":[{"note":"The function-based `datadog_resource` was deprecated in Dagster 1.0+ in favor of the class-based `DatadogResource`.","wrong":"from dagster_datadog import datadog_resource","symbol":"DatadogResource","correct":"from dagster_datadog import DatadogResource"},{"note":"For sending Dagster system logs to Datadog.","symbol":"DatadogLogger","correct":"from dagster_datadog import DatadogLogger"}],"quickstart":{"code":"from dagster import AssetExecutionContext, Definitions, asset, job\nfrom dagster_datadog import DatadogResource, DatadogLogger\nimport os\n\n@asset\ndef my_datadog_asset(context: AssetExecutionContext, datadog: DatadogResource):\n    context.log.info(\"Asset started, sending metric to Datadog...\")\n    # Use the DatadogResource client to send a custom metric\n    datadog.send_metric(\n        metric_name=\"my_asset.completion\",\n        value=1,\n        tags=[\"asset:my_datadog_asset\", f\"run_id:{context.run_id}\"],\n    )\n    context.log.info(\"Metric sent. Asset completed.\")\n\n@job\ndef my_datadog_job():\n    my_datadog_asset()\n\ndefs = Definitions(\n    assets=[my_datadog_asset],\n    resources={\n        \"datadog\": DatadogResource(\n            api_key=os.environ.get(\"DATADOG_API_KEY\", \"\"),\n            app_key=os.environ.get(\"DATADOG_APP_KEY\", \"\"),\n            # Optional: configure host/port if Datadog Agent is not on localhost\n            # host=\"localhost\",\n            # port=8125,\n        )\n    },\n    # Optional: configure a Datadog logger for system events\n    loggers={\n        \"datadog\": DatadogLogger(\n            api_key=os.environ.get(\"DATADOG_API_KEY\", \"\"),\n            app_key=os.environ.get(\"DATADOG_APP_KEY\", \"\")\n        )\n    }\n)\n\n# To run this example:\n# 1. Ensure DATADOG_API_KEY and DATADOG_APP_KEY environment variables are set.\n# 2. Save as `repo.py` and run `dagster dev -f repo.py`.\n# 3. Launch `my_datadog_job` from the UI.","lang":"python","description":"This quickstart demonstrates defining a Dagster asset that interacts with `DatadogResource` to send a custom metric. It shows how to configure the `DatadogResource` and `DatadogLogger` within your Dagster definitions, requiring Datadog API and APP keys typically provided via environment variables."},"warnings":[{"fix":"Replace `datadog_resource()` with `DatadogResource()` when defining your resources, and provide configuration parameters directly to the class constructor.","message":"Dagster 1.0+ introduced a new resource API. The function-based `datadog_resource` is now deprecated and should be replaced with the class-based `DatadogResource`.","severity":"breaking","affected_versions":"Dagster versions 1.0.0 and above. dagster-datadog versions 0.16.0 and above."},{"fix":"Ensure `api_key` and `app_key` are provided to `DatadogResource` and `DatadogLogger` constructors, preferably using environment variables (e.g., `os.environ.get(\"DATADOG_API_KEY\")`).","message":"The `DatadogResource` and `DatadogLogger` require Datadog `api_key` and `app_key` for successful authentication and data submission. Misconfiguration or omission of these keys will lead to failed Datadog interactions.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Verify Datadog Agent status or explicitly configure `host` and `port` in `DatadogResource` if using a non-default agent location, or ensure `api_key`/`app_key` are provided for direct HTTP API usage.","message":"When sending metrics directly to the Datadog Agent (default behavior if `host`/`port` point to an agent), ensure the agent is running and accessible from the Dagster execution environment. Otherwise, configure the resource to use the HTTP API directly.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run `pip install dagster-datadog`.","cause":"The `dagster-datadog` library has not been installed in your Python environment.","error":"ModuleNotFoundError: No module named 'dagster_datadog'"},{"fix":"Add `DatadogResource` to your `Definitions` resources, e.g., `resources={'datadog': DatadogResource(...)}}`.","cause":"Your job or asset tries to access a resource named 'datadog', but it hasn't been defined in your `Definitions` or provided to the job/graph.","error":"dagster._core.errors.DagsterInvalidDefinitionError: Resource with key 'datadog' expected but not provided."},{"fix":"Provide `api_key` in the resource or logger configuration, e.g., `DatadogResource(api_key=\"YOUR_API_KEY\", app_key=\"YOUR_APP_KEY\")`.","cause":"The `DatadogResource` or `DatadogLogger` was initialized without providing the necessary `api_key` configuration.","error":"dagster._core.errors.DagsterInvalidConfigError: Missing required config entry 'api_key'."},{"fix":"Update your code to use the class-based `DatadogResource` instead: `from dagster_datadog import DatadogResource`.","cause":"You are trying to import or use the old function-based `datadog_resource` which was removed or deprecated in Dagster 1.0+.","error":"AttributeError: module 'dagster_datadog' has no attribute 'datadog_resource'"}]}