Sion Kim
04/08/2025, 3:14 PMdbt test or dbt build to show up in the UI or trigger an alert with webhook syncs?kapa.ai
04/08/2025, 3:14 PMkapa.ai
04/08/2025, 3:14 PMdbt test or dbt build are not immediately reflected in the UI or trigger alerts. The process works as follows: When you run dbt test or dbt build, Elementary captures the test results through an on-run-end hook that executes at the end of the dbt invocation. The test results are stored in tables like elementary_test_results and then aggregated into alert tables like alerts_dbt_tests. For the alerts to be sent, you need to run the edr monitor command after your dbt tests complete. This command: 1. Aggregates the test results into the alerts table 2. Identifies new alerts that need to be sent 3. Sends the alerts via configured channels (like Slack) As mentioned in one of the forum discussions, Elementary leverages "the dbt results jinja variable to get the results of all the resources who participated in an invocation. This variable is currently only accessible by dbt at the end of the DAG (in the context of an on-run-end hook). So the answer is that it will alert once the DAG is completed" [Slack Forum Discussion](https://slack.com/archives/C02CTC89LAX/p1674071962667739). This means that for long-running DAGs, you'll only see alerts after the entire DAG completes, not immediately when a test fails in the middle of execution. To ensure alerts are sent promptly, you should run edr monitor after your dbt jobs complete. Many users set up their workflows to run edr monitor shortly after their dbt jobs finish (e.g., "30 minutes after our datamart job is completed" as mentioned by one user). If you're not seeing alerts despite test failures, you might want to check: 1. If the alerts are being properly recorded in the alerts_dbt_tests table 2. If there are any configuration issues with alert suppression or disabling 3. If the edr monitor command is running correctly with the proper parametersSion Kim
04/08/2025, 3:16 PMkapa.ai
04/08/2025, 3:17 PMkapa.ai
04/08/2025, 3:17 PMdbt test or dbt build), which populate Elementary's test results tables 2. Then, you need to explicitly run the edr monitor command to process and send alerts The edr monitor command is what actually sends the alerts through your configured channels (including webhooks or Slack). By default, it looks for alerts from the past 24 hours, but you can adjust this with the --days-back parameter [Slack Forum Discussion](https://slack.com/archives/C02CTC89LAX/p1663241888773889). As one user mentioned in a forum discussion, they "run edr monitor 30 minutes after our datamart job is completed" [Slack Forum Discussion](https://slack.com/archives/C02CTC89LAX/p1676383019819779). This indicates that there's typically a deliberate delay built into workflows to ensure all test results are captured before sending alerts. The recommended flow according to Elementary support staff is: 1. dbt run 2. dbt test 3. edr monitor [Slack Forum Discussion](https://slack.com/archives/C02CTC89LAX/p1686842159294479) If you're not seeing alerts being sent despite having failing tests, you should check: 1. Whether the alerts are properly recorded in the alerts tables 2. If you're running edr monitor after your dbt tests complete 3. If there are any configuration issues with your webhook setup Remember that Elementary will only send alerts for new issues that haven't been sent before, as it marks alerts as "sent" after processing them. I hope this helps clarify the process for consuming alerts through webhooks from dbt with Elementary Data!Sion Kim
04/08/2025, 3:23 PMkapa.ai
04/08/2025, 3:23 PMkapa.ai
04/08/2025, 3:24 PMimport hmac import requests request_body = b"" secret = b"<SECRET>" webhook_url = "<WEBHOOK_URL>" signature = hmac.new(secret, request_body, "sha256").hexdigest() <http://requests.post|requests.post>(webhook_url, headers={"Authorization": signature}, data=request_body) This approach ensures your Elementary Cloud environment updates as soon as new data is available, giving you near real-time visibility into your data quality [Environment Syncs Schedule](https://docs.elementary-data.com/cloud/guides/sync-scheduling). ## Alert Consumption Through Webhooks It's important to distinguish between two different webhook concepts in Elementary: 1. Triggered syncs webhooks: These trigger Elementary Cloud to sync data from your data warehouse 2. Alert webhooks: These are used to send alerts from Elementary to other systems For alert consumption, the process works as follows: 1. When dbt tests run, the results are stored in your Elementary schema through on-run-end hooks 2. To send alerts, you need to run the edr monitor command, which: - Aggregates test results into alert tables - Identifies new alerts to be sent - Sends alerts through configured channels The logs from a typical edr monitor run show this process: Running internal dbt run to aggregate alerts Querying test alerts Running dbt run-operation elementary.log_macro_results... Querying model alerts The time it takes for this process varies based on your data volume and warehouse performance, but from the logs shared in the knowledge sources, it typically takes a few minutes to complete [Slack Forum Discussion](https://slack.com/archives/C02CTC89LAX/p1713364399960069). For near real-time alerting, it's recommended to run edr monitor immediately after your dbt jobs complete. As one community member mentioned, they "run edr monitor 30 minutes after our datamart job is completed" to ensure all test results are captured. To optimize your workflow for real-time alerts, you should: 1. Configure triggered syncs in Elementary Cloud 2. Run edr monitor after your dbt jobs complete 3. Consider automating this process through your orchestration tool This approach will give you the most timely alerts about data quality issues in your pipelines. Hope this helps clarify how Environment Syncs Schedule works with triggered syncs and the alert consumption process!Sion Kim
04/08/2025, 3:25 PMkapa.ai
04/08/2025, 3:26 PMkapa.ai
04/08/2025, 3:26 PMkapa.ai
04/08/2025, 3:27 PMkapa.ai
04/08/2025, 3:27 PMSion Kim
04/08/2025, 3:28 PMkapa.ai
04/08/2025, 3:28 PMkapa.ai
04/08/2025, 3:29 PM