elementary icon indicating copy to clipboard operation
elementary copied to clipboard

Include orchestrator jobs data in alerts

Open quickcoffee opened this issue 6 months ago โ€ข 3 comments

Is your feature request related to a problem? Please describe. When I have a look at the elementary alerts I want to find out what the root cause for the alert was. While the alert already includes plenty of useful data I usually open our orchestrator tool and find the run with the failure to get more information on the cause. Right now going from the alert to the orchestrator run is a manual process.

Describe the solution you'd like Via the jobs data we collect already all relevant metadata about the orchestrator tool. It would be great to make this data available as fields in the alert. For example: Run ID: 2342
Run URL: https://orchestrator.com/run/2342 (could also be a button like "Show run in {orchestrator} UI")

Describe alternatives you've considered No obvious alternative.

Additional context Slack discussion

Would you be willing to contribute this feature? No

quickcoffee avatar Jun 24 '25 11:06 quickcoffee

Implementation guidance to anyone interested in contributing

Architecture Overview

Elementary already collects orchestrator metadata through the dbt_invocations table. The implementation involves:

  1. dbt Project: Modify alert population macros to include orchestrator metadata
  2. Alert Models: Extend base AlertModel to include orchestrator fields
  3. Message Builder: Enhance alert formatting to display orchestrator information and links
  4. Automatic Integration: All messaging platforms (Slack, Teams, etc.) automatically benefit

Implementation Guide

Step 1: Extend Base AlertModel

File: elementary/elementary/monitor/alerts/alert.py

Add orchestrator fields to the base AlertModel class and create an orchestrator_info property that returns the metadata in a structured format.

Step 2: Update Alert Population Macros

Files:

  • elementary/elementary/monitor/dbt_project/macros/alerts/population/test_alerts.sql
  • elementary/elementary/monitor/dbt_project/macros/alerts/population/model_alerts.sql
  • elementary/elementary/monitor/dbt_project/macros/alerts/population/source_freshness_alerts.sql

Modify these macros to:

  • Join with the dbt_invocations table to get orchestrator metadata
  • Include orchestrator fields in the alert data
  • Pass orchestrator information to the alert object constructor

Step 3: Update Alert Object Generation

File: elementary/elementary/monitor/dbt_project/macros/alerts/population/utils/

Find and update the utility macro that generates alert objects to accept and include orchestrator parameters.

Step 4: Enhance Message Builder

File: elementary/elementary/monitor/alerts/alert_messages/builder.py

Update the _get_run_alert_subtitle_block method to:

  • Accept orchestrator information as a parameter
  • Display job name, run ID, and orchestrator type in the alert summary
  • Add clickable links to orchestrator runs when URLs are available

Key Implementation Points

  • Data Source: Use the existing dbt_invocations table which already contains orchestrator metadata
  • Inheritance: Add orchestrator fields to the base AlertModel so all alert types automatically benefit
  • Message Formatting: Enhance the subtitle blocks to include orchestrator information and links
  • Integration: No changes needed to messaging integrations - they automatically use the enhanced message builder output

Expected Output

Add tests validating this behavior

No orchestrator data

โŒ Failure: test_column_not_null
Table: customers
Column: email
Status: fail
Time: 2024-01-15 10:30:00

After Implementation

โŒ Failure: test_column_not_null
Table: customers
Column: email
Status: fail
Time: 2024-01-15 10:30:00
Job: nightly_load (via airflow)
[View in airflow] โ† Clickable link

ofek1weiss avatar Aug 27 '25 10:08 ofek1weiss

This issue is stale because it has been open for too long with no activity. If you would like the issue to remain open, please remove the stale label or leave a comment.

github-actions[bot] avatar Nov 14 '25 02:11 github-actions[bot]

Leave open

quickcoffee avatar Nov 18 '25 19:11 quickcoffee