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 or PagerDuty 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 and are designed to integrate with Slack and PagerDuty. Follow this guide to set up your Slack or PagerDuty to receive alerts from Astro and then configure your Deployment to send alerts.
To configure Airflow notifications, see Airflow email notifications and Manage Airflow DAG notifications
- An Astro project.
- An Astro Deployment. Your Deployment must run Astro Runtime 7.1.0 or later to configure Astro alerts.
- A Slack workspace and/or PagerDuty service.
Step 1: Configure your communication 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.
Go to Slack API: Applications to create a new app in your organization's Slack workspace.
Click From scratch when prompted to choose how you want to create your app.
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.
Select Incoming webhooks.
On the Incoming webhooks page, click to turn on Activate Incoming Webhooks.
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.
Choose the channel where you want to send your Astro alerts and click Allow.
After your webhook is created, copy the webhook URL from the new entry in the Webhook URLs for your Workspace table.
To set up an alert integration with PagerDuty, you need access to your organization's PagerDuty Service. PagerDuty uses the Events API v2 to create a new integration that connects your Service with Astro.
Open your PagerDuty service.
On the Integrations tab, click Add an integration.
Select Events API v2 as the Integration Type.
On your Integrations page, open your new integration and enter an Integration Name.
Copy the Integration Key for your new Astro alert integration.
Step 2: Create your Workspace alert in the Cloud UI
In the Cloud UI, you can enable alerts from the Workspace Settings page.
In the Cloud UI, select the Astro Workspace you want to create an alert for.
Click Workspace Settings, then click Alerts.
Click Add Alert.
Enter your Alert Name and choose the alert type, either Pipeline Failure or Task Duration.
Choose the Communication Channel where you want to send your alert. You can choose to send alerts to both Slack and PagerDuty.
Add your communication 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.
Paste the Integration Key from your PagerDuty Integration and select the Severity of the alert.
Add DAG or Tasks to your alert.
Pipeline failure: Click Pipeline to choose the DAG that you want to send an alert about if it fails.
Task duration: Click Task and choose the Deployment, DAG, and task name. Enter the Duration for how long a task should take to run before you send an alert to your communication channels.
You can add more DAGs or tasks after you create your alert.
Click Create alert.