---
title: "Sentry for Data: Optimizing Airflow with Sentry"
description: "In our Sentry for Data series, we explain precisely why Sentry is the perfect tool for your data team."
url: "https://blog.sentry.io/sentry-for-data-optimizing-airflow-with-sentry/"
canonical_url: "https://blog.sentry.io/sentry-for-data-optimizing-airflow-with-sentry/"
authors: ["Osmar Coronel"]
published: "2019-07-10"
category: "Product Updates"
---

# Sentry for Data: Optimizing Airflow with Sentry

_In our_ Sentry for Data _series, we explain precisely why Sentry is the perfect tool for your data team. The present post focuses on how we optimized Airflow for deeper insights into what goes wrong when our data pipelines break._

Data enables Sentry’s go-to-market teams by generating high-quality leads and tailored marketing campaigns. Of course, data is also used to steer the business by influencing how we think about Sentry pricing, future opportunities, and feature roadmap.

[Apache Airflow](https://airflow.apache.org/) is our tool of choice for executing data pipelines. With its simple approach to writing DAGs (directed acyclic graphs), Airflow enable our sales and marketing teams to offer the best experience for our customers.

However, for all of the things we enjoy about Airflow, one obstacle we encountered was understanding what _actually_ goes wrong when our data pipelines break. While the built-in log interface inside Airflow is a decent starting point, it lacks the full context surrounding the exception, which makes issue resolution painful.

![Airflow log Sentry errors](https://blog.sentry.io/_vercel/image?url=_astro%2Finline-0.CMgMk40t.png&w=2048&q=100)

We recently introduced a new plugin, `sentry-airflow`, to the Airflow ecosystem that combats the absence of visibility by collecting, handling, and reporting any errors that occur within Airflow tasks upon execution.

## Getting started

```plaintext
sentry-airflow` is a drop-in solution that only requires `SENTRY_DSN` specification.



There are only two required steps:



1. Place the plugin in the `$AIRFLOW_HOME/plugins` folder.
2. Set the `SENTRY_DSN` environment variable.




However, for those running Airflow via Google Cloud Composer, the installation is just one step (lucky you):



`$ gcloud composer environments storage plugins import --environment ENVIRONMENT_NAME \
    --location LOCATION \
    --source sentry-airflow/sentry-plugin \
    --destination PATH_IN_SUBFOLDER
```

## Handling the errors

After the configuration is complete, Sentry collects all information about failed tasks.

![Airflow errors logged in Sentry's UI](https://blog.sentry.io/_vercel/image?url=_astro%2Finline-1.D0AKypYY.png&w=3840&q=100)

Errors arrive in Sentry with useful tags, like `dag_id`, `task_id`, `execution_date`, and `operator`.

![Tags in Sentry's Issue UI](https://blog.sentry.io/_vercel/image?url=_astro%2Finline-2.DCchFcIq.png&w=750&q=100)

For additional insight into previous tasks that might have also failed, errors include the upstream DAG tasks as breadcrumbs.

![Airflow errors shown in Sentry's Breadcrumb UI](https://blog.sentry.io/_vercel/image?url=_astro%2Finline-3.DFllwmnA.png&w=2048&q=100)

## Getting the plugin

You can find `sentry-airflow` [here](https://www.github.com/getsentry/sentry-airflow). The plugin is currently available for use and constantly improving.

If you have any feedback, want more features, or need help using the tool, open an issue on the GitHub repository or shout out to our [support engineers](https://help.sentry.io/). They’re here to help. And also to code. But mostly to help.
