OpenFn / lightning

OpenFn/Lightning ⚡️ is the newest version of the OpenFn DPG and provides a web UI to visually manage complex workflow automation projects.
https://openfn.github.io/lightning/
GNU Lesser General Public License v3.0
133 stars 37 forks source link

Realtime alerts with rate limiting #581

Closed amberrignell closed 1 year ago

amberrignell commented 1 year ago

User story

As a user that has a project with critical workflows in it, I want to be notified every time there is a run failure, so that I can see what the issue is and decide whether to address it or not.

As a user that has enabled realtime alerts, if a given workflow fails more that 5 times in 24 hours, I want to stop receiving emails so that my inbox does not get cluttered.

Details

See excel doc below for example: https://docs.google.com/spreadsheets/d/13eOkUKDbK_jHDp58f70v3dGQwmtF9V4j0_RmoliG6YA/edit?usp=sharing

The email should be as follows:

Subject: {n. failures)th failure for workflow {workflow_name}

Body: Hi ${user first name}, Word order ${worder_order_id} failed for workflow ${workflow_name} with the following logs:

display logs

Please view it [here] ({link_to_run}) to debug the issue.

*This is the ${n. failures} failure in the last 24 hours. If the workflow has more than 5 failed runs in the last 24 hours, you will stop receiving these alerts.

Implementation notes

A quick proposal for the solution image.png

image.png

Release notes

User acceptance criteria

Given a user that has enabled realtime alerts for a project (failure_alerts set to true),

wanecode commented 1 year ago

To facilitate testing in dev mode , the time scale is set to 1mn (vs 24h), so you can run failing jobs and check the /dev/mailbox to look at emails @amberrignell

wanecode commented 1 year ago

For dev purpose, failure notification are activated by default. What is need here? @amberrignell

amberrignell commented 1 year ago

By default amnesia should store to disk, we will deal with remaining questions around persistence after this has been merged.