Course contentsShow
← Data Engineering
Lesson 370 of 8255. Batch ETL/ELT Pipelines with dbtFree lesson

Monitoring Pipeline Health and Performance

Set up automated alerts and logging for dbt runs to proactively identify performance bottlenecks and execution failures in production.

In this lesson, you will learn how to set up automated alerts and logging for your dbt runs to proactively catch failures and performance issues in your production environment.

When your data pipelines run in production, simply knowing that they ran isn't enough; you need to know how they ran. Monitoring involves tracking two primary signals: execution health (Did it fail?) and performance bottlenecks (Did it take longer than usual?).

Leveraging Orchestration Logs

Since we have previously integrated dbt with orchestration tools like Airflow or GitHub Actions, these platforms serve as our primary logging interface. You should configure these tools to emit alerts whenever a dbt run or dbt test command returns a non-zero exit code.

For example, in a GitHub Actions workflow, you can add a notification step that triggers on job failure:

- name: Notify on failure
  if: failure()
  run: |
    curl -X POST -H 'Content-type: application/json' \
    --data '{"text":"🚨 dbt pipeline failed! Check the logs."}' \
    ${{ secrets.SLACK_WEBHOOK_URL }}

Tracking Performance

To identify bottlenecks, you need to monitor the execution time of individual models. While dbt produces run_results.json in the target/ directory after every execution, you should treat this as a metadata artifact.

In a robust setup, you should ingest this run_results.json file into a dedicated monitoring table in your data warehouse after each deployment. This allows you to track:

  1. Execution Duration: Which models are growing in runtime as your data volume scales?
  2. Failure Frequency: Are specific models failing consistently due to stale source data?

By building a simple dashboard on top of these historical run logs, you can move from reactive "firefighting" to proactive optimization. If a model’s runtime trends upward, you’ll know it’s time to refactor that model using the incremental strategies we discussed earlier, rather than waiting for a timeout error to disrupt your stakeholders.

Key Takeaway: Proactive monitoring relies on turning your pipeline’s metadata (log files and run results) into actionable alerts that notify your team immediately when failures occur or performance degrades.