Include orchestrator jobs data in alerts
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
Implementation guidance to anyone interested in contributing
Architecture Overview
Elementary already collects orchestrator metadata through the dbt_invocations table. The implementation involves:
- dbt Project: Modify alert population macros to include orchestrator metadata
- Alert Models: Extend base
AlertModelto include orchestrator fields - Message Builder: Enhance alert formatting to display orchestrator information and links
- 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.sqlelementary/elementary/monitor/dbt_project/macros/alerts/population/model_alerts.sqlelementary/elementary/monitor/dbt_project/macros/alerts/population/source_freshness_alerts.sql
Modify these macros to:
- Join with the
dbt_invocationstable 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_invocationstable which already contains orchestrator metadata - Inheritance: Add orchestrator fields to the base
AlertModelso 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
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.
Leave open