Skip to main content

Example alert policy configuration

If you prefer to manage your alerts through configuration files instead of the UI, you can create a YAML file using the following snippets and adjust as needed. To sync the file to your Dagster+ deployment, run:

dagster-cloud deployment alert-policies sync -a /path/to/alert_policies.yaml

Asset alert

Alerting when an asset fails to materialize

# alert_policies.yaml

alert_policies:
alert_targets:
- asset_key_target:
asset_key:
- s3
- report
- asset_group_target:
asset_group: transformed
location_name: prod
repo_name: __repository__
description: Sends an email when an asset fails to materialize.
event_types:
- ASSET_MATERIALIZATION_FAILED
name: asset-materialization-failure-alert-email
notification_service:
email:
email_addresses:
- richard.hendricks@hooli.com
- nelson.bighetti@hooli.com

Alerting when an asset check fails

# alert_policies.yaml

alert_policies:
alert_targets:
- asset_key_target:
asset_key:
- s3
- report
- asset_group_target:
asset_group: transformed
location_name: prod
repo_name: __repository__
description: Sends an email when an asset check fails.
event_types:
- ASSET_CHECK_SEVERITY_ERROR
name: asset-check-failed-email
notification_service:
email:
email_addresses:
- richard.hendricks@hooli.com
- nelson.bighetti@hooli.com

Run alert

Alerting when a run fails

# alert_policies.yaml

alert_policies:
description: Sends an email when a run fails.
event_types:
- JOB_FAILURE
name: run-alert-failure-email
notification_service:
email:
email_addresses:
- richard.hendricks@hooli.com
- nelson.bighetti@hooli.com
tags:
important: 'true'

Alerting when a run is taking too long to complete

# alert_policies.yaml

alert_policies:
alert_targets:
- long_running_job_threshold_target:
threshold_seconds: 3600
description: Sends an email when a run is taking too long to complete.
event_types:
- JOB_LONG_RUNNING
name: job-running-over-one-hour-email
notification_service:
email:
email_addresses:
- richard.hendricks@hooli.com
- nelson.bighetti@hooli.com
tags:
important: 'true'

Code location alert

# alert_policies.yaml

alert_policies:
description: Sends an email when a code location fails to load.
event_types:
- CODE_LOCATION_ERROR
name: code-location-error-email
notification_service:
email:
email_addresses:
- richard.hendricks@hooli.com
- nelson.bighetti@hooli.com

Automation alert

# alert_policies.yaml

alert_policies:
description: Sends an email when a schedule or sensor tick fails.
event_types:
- TICK_FAILURE
name: schedule-sensor-failure-email
notification_service:
email:
email_addresses:
- richard.hendricks@hooli.com
- nelson.bighetti@hooli.com

Agent unavailable alert

note

Alerting when a Hybrid agent becomes unavailable is only available for Hybrid deployments.

# alert_policies.yaml

alert_policies:
description: Sends an email when a Hybrid agent hasn't sent a heartbeat in the last
5 minutes.
event_types:
- AGENT_UNAVAILABLE
name: agent-unavailable-alert-email
notification_service:
email:
email_addresses:
- richard.hendricks@hooli.com
- nelson.bighetti@hooli.com

Credit budget alert

note

The example configuration below can be used in both Serverless and Hybrid deployments.

# alert_policies.yaml

alert_policies:
alert_targets:
- insights_asset_threshold_target:
asset_key:
- s3
- report
metric_name: __dagster_dagster_credits
operator: GREATER_THAN
selection_period_days: 7
threshold: 50
description: Sends an email when a credit budget limit has been exceeded.
event_types:
- INSIGHTS_CONSUMPTION_EXCEEDED
name: credit-budget-alert-email
notification_service:
email:
email_addresses:
- richard.hendricks@hooli.com
- nelson.bighetti@hooli.com