elementary icon indicating copy to clipboard operation
elementary copied to clipboard

Support seed monitoring with EDR

Open kokorin opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe. In our project we occasionally got an error with DBT seed (new column was added). We use the following EDR command:

edr monitor --profile-target ${DBT_TARGET} --env ${DBT_TARGET} --target-path edr_target \
                  --filters statuses:error,fail --filters resource_types:model,test --teams-webhook ${TEAMS_ALERT_WEBHOOK}

Unfortunately EDR fails with ValueError: 'seed' is not a valid ResourceType if we add seed to resource_type filter.

Describe the solution you'd like EDR allows sending seed failure/error notifications.

Describe alternatives you've considered Nothing

Additional context I tried adding SEED value to ResourceType enum, the command completed successfully but no notification was sent. alerts_v2 model's post-hook checks only for test_alerts, model_alerts and source_freshness_alerts. There is no seed alerts.

Would you be willing to contribute this feature? Yes with guidance.

kokorin avatar Aug 01 '24 09:08 kokorin

Hey @kokorin, nice suggestion, I can give some guidance for contribution.

I think the best way to add support for seed alerts is to do the same thing we currently do for snapshots, that is, regard them as models with a seed materialization, in order to do that there are two changes needed:

  • add a seed_run_results model to the dbt package, should look like snapshot_run_results, but join with dbt_seeds instead of dbt_snapshots
  • query the new seed_run_results model when querying all of the model alerts data in populate_model_alerts_query

Should be pretty straightforward to implement, if there is anything isn't clear I can provide further help 😁

ofek1weiss avatar Aug 04 '24 17:08 ofek1weiss

@ofek1weiss I have created a PR in dbt-data-reliability

kokorin avatar Aug 07 '24 03:08 kokorin

Hi @kokorin, PR looks great, left one small comment in order to ensure the logic is backwards-compatible and doesn't break for users who haven't upgraded their dbt package yet. Thanks for contributing!

elongl avatar Aug 25 '24 13:08 elongl