Skip to main content

Set up Astro alerts

Astro alerts provide an additional level of observability to Airflow's notification systems. You can configure an alert to notify you in Slack, PagerDuty, or through email when a DAG completes, if you have a DAG run failure, or if a task duration exceeds a specified time.

Unlike Airflow callbacks and SLAs, Astro alerts require no changes to DAG code. Follow this guide to set up your Slack, PagerDuty, or email to receive alerts from Astro and then configure your Deployment to send alerts.

info

To configure Airflow notifications, see Airflow email notifications and Manage Airflow DAG notifications.

Alert types

Each Astro alert has a notification channel and a trigger type. The notification channel determines the format and destination of an alert, and the trigger type defines what causes the alert trigger.

Trigger types

You can trigger an alert to a notification channel using one of the following trigger types:

  • DAG failure: The alert triggers whenever the specified DAG fails.
  • DAG success: The alert triggers whenever the specified DAG completes
  • Task duration: The alert triggers when a specified task takes longer than expected to complete.
  • Absolute Time: The alert triggers when a given DAG does not have a successful DAG run within a defined time window.
info

You can only set a task duration trigger for an individual task. Alerting on task group duration is not supported.

Notification channels

You can send Astro alerts to the following notification channels

  • Slack
  • PagerDuty
  • Email
  • (Private Preview) DAG trigger
Private Preview - DAG Trigger

This feature is in Private Preview. Please reach out to your customer success manager to enable this feature.

The DAG Trigger notification channel works differently from other notification channel types. Instead of sending a pre-formatted alert message, Astro makes a generic request through the Airflow REST API to trigger a DAG on Astro. You can configure the triggered DAG to complete any action, such as sending a message to your own incident management system or writing data about an incident to a table.

Prerequisites

info

Astro alerts requires OpenLineage. By default, every Astro Deployment has OpenLineage enabled. If you disabled OpenLineage in your Deployment, you need to enable it to use Astro alerts. See Disable OpenLineage to find how to disable and re-enable OpenLineage.

Step 1: Configure your notification channel

To set up alerts in Slack, you need to create a Slack app in your Slack workspace. After you've created your app, you can generate a webhook URL in Slack where Astro will send Astro alerts.

  1. Go to Slack API: Applications to create a new app in your organization's Slack workspace.

  2. Click From scratch when prompted to choose how you want to create your app.

  3. Enter a name for your app, like astro-alerts, choose the Slack workspace where you want Astro to send your alerts, and then click Create App.

info

If you do not have permission to install apps into your Slack workspace, you can still create the app, but you will need to request that an administrator from your team completes the installation.

  1. Select Incoming webhooks.

  2. On the Incoming webhooks page, click the toggle to turn on Activate Incoming Webhooks. See Sending messages using Incoming Webhooks.

  3. In the Webhook URLs for your Workspace section, click Add new Webhook to Workspace.

info

If you do not have permission to install apps in your Slack workspace, click Request to Add New Webhook to send a request to your organization administrator.

  1. Choose the channel where you want to send your Astro alerts and click Allow.

  2. After your webhook is created, copy the webhook URL from the new entry in the Webhook URLs for your Workspace table.

Step 2: Add a notification channel.

You can enable alerts from the Astro UI.

  1. In the Astro UI, click Alerts in the main menu.

  2. Click the Notification channels tab.

  3. Click Add Notification Channel.

  4. Enter a name for your notification channel.

  5. Choose the Channel Type.

  6. Add the notification channel information.

    Paste the Webhook URL from your Slack workspace app. If you need to find a URL for an app you've already created, go to your Slack Apps page, select your app, and then choose the Incoming Webhooks page.

    Add your Slack Webhook URL

  7. Click Create notification channel.

Step 3: Create your alert in the Astro UI

  1. In the Astro UI, click on Alerts and then the Alerts Tab.

  2. Click Add Alert.

  3. Choose the Alert Type

    • DAG failure: Send an alert if a DAG fails.

    • DAG success: Send an alert when a DAG completes.

    • Task duration: Enter the Duration for how long a task should take to run before you send an alert to your notification channels.

    • Absolute Time: Select the Days of Week that the alert should observe, the Verification Time when it should look for a DAG success, and the Lookback Period for how long it should look back for a verification time.

    For example, if an alert has a Verification Time of 3:00 PM and a Lookback Period of 60 minutes, it will trigger whenever the given DAG does not produce a successful DAG run from 2:00 to 3:00 PM. Astro applies the times you specify based on the time zone of your current web browser session, then translates them to UTC in your Airflow environment.

  4. Choose the alert Severity, either Info, Warning, Critical, or Error.

  5. Define the conditions on which you want your alert to send a notification.

  • Select the Attribute, Operator, and DAGs to define when you want Astro to send an Alert and which DAGs that you want the alert to apply to.

Step 3: (Optional) Change an alert name

After you select a DAG that you want to apply an alert to, Astro automatically generates a name for your alert. However, you can choose to change the name of your alert.

  1. Expand the Change alert names... section.

  2. Edit the Alert Name.

  3. Click Create Alert to save your changes.

(Optional) Test your DAG failure alert

Astro alerts work whether your DAG run is manual or scheduled, so you can test your configured Astro alerts by failing your DAG manually.

  1. In the Astro UI, click DAGs.

  2. Choose the DAG that has your alert configured.

  3. Trigger a DAG run.

  4. Select Mark as and choose Failed to trigger an alert for a DAG failure.

Manually marking a successful DAG run as Failed.

  1. Check your Slack, PagerDuty, or Email alerts for your DAG failure alert. The alert includes information about the DAG, Workspace, Deployment, and data lineage associated with the failure as well as direct links to the Astro UI.

    Example of a Slack test alert.

Was this page helpful?

Sign up for Developer Updates

Get a summary of new Astro features once a month.

You can unsubscribe at any time.
By proceeding you agree to our Privacy Policy, our Website Terms and to receive emails from Astronomer.