oncall-engine/engine/apps
Yulya Artyukhina 191814b25e
User notifications bundle (#4457)
# What this PR does
This PR adds two new models: UserNotificationBundle and
BundledNotification (proposals for naming are welcome).

`UserNotificationBundle` manages the information about last notification
time and scheduled notification task for bundled notifications. It is
unique per user + notification_channel + notification importance.

`BundledNotification` contains notification policy and alert group, that
triggered the notification. The BundledNotification instance is created
in `notify_user_task` for every notification, that should be bundled,
and is attached to UserNotificationBundle by ForeignKey connection.

How it works:
If the user was notified recently (within the last two minutes) by the
current notification channel, and this channel is bundlable,
BundledNotification instance will be created and attached to the
UserNotificationBundle instance, and `send_bundled_notification` task
will be scheduled to execute in 2 min.
In `send_bundled_notification` task we get all BundledNotification
attached to the current UserNotificationBundle instance, check if alert
groups are still active and if there is only one notification - perform
regular notification by calling `perform_notification` task, otherwise
call "notify_by_<channel>_bundle" method for the current notification
channel.

PR with method to send notification bundle by SMS -
https://github.com/grafana/oncall/pull/4624

**This feature is disabled by default by feature flag. Public docs will
be added in a separate PR with enabling this feature.**
## Which issue(s) this PR closes
related to https://github.com/grafana/oncall-private/issues/2712

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-07-16 11:24:08 +00:00
..
alerts User notifications bundle (#4457) 2024-07-16 11:24:08 +00:00
api Allow routing via labels on the Integration page (#3850) 2024-07-15 07:43:40 +00:00
api_for_grafana_incident add labels in grafana-incident alertgroup endpoint (#4448) 2024-06-25 14:50:55 +00:00
auth_token Google OAuth2 flow + fetch Google Calendar OOO events (#4067) 2024-04-02 14:59:03 -04:00
base patch default user notification policy changes + fix failing e2e test (#4635) 2024-07-09 11:23:53 -04:00
chatops_proxy Tweak chatops-proxy sync (#4627) 2024-07-08 15:33:58 +00:00
email Handle inbound email integration alert getting multiple recipients (#4655) 2024-07-11 12:51:01 +00:00
exotel add exotel call provider (#4433) 2024-06-06 06:19:02 +00:00
google Update out of office task to not retry on HttpError (#4328) 2024-05-09 16:16:46 +00:00
grafana_plugin Don't retry cleanup tasks (#4633) 2024-07-08 20:04:46 +00:00
heartbeat Improve OpenAPI schema coverage (#3629) 2024-01-12 15:11:22 +00:00
integrations Add tilt button to run pytest, fix local dev config for pytest, minor improvements to til (#3927) 2024-07-09 01:24:18 +00:00
labels Support prescribed labels (#3848) 2024-02-20 14:42:51 +08:00
metrics_exporter User notifications bundle (#4457) 2024-07-16 11:24:08 +00:00
mobile_app rename settings/ci-test.py to settings/ci_test.py (#4391) 2024-05-24 13:55:08 +00:00
oss_installation bump uwsgi to 2.0.26 + Python to 3.12.3 (#4495) 2024-06-10 15:33:37 -04:00
phone_notifications User notifications bundle (#4457) 2024-07-16 11:24:08 +00:00
public_api don't force create default user notification policies (#4608) 2024-07-05 15:08:17 -04:00
schedules bump uwsgi to 2.0.26 + Python to 3.12.3 (#4495) 2024-06-10 15:33:37 -04:00
slack Add slack button to show log report (#4641) 2024-07-12 09:49:09 +00:00
social_auth Prepare OnCall for Unified Slack App (#4232) 2024-06-03 09:07:10 +00:00
telegram Prepare OnCall for Unified Slack App (#4232) 2024-06-03 09:07:10 +00:00
twilioapp Update alert group state by backsync (#4089) 2024-03-27 12:37:01 +00:00
user_management patch default user notification policy changes + fix failing e2e test (#4635) 2024-07-09 11:23:53 -04:00
webhooks Add tilt button to run pytest, fix local dev config for pytest, minor improvements to til (#3927) 2024-07-09 01:24:18 +00:00
zvonok change zvonok call verification (#4393) 2024-06-04 05:34:57 +00:00
__init__.py World, meet OnCall! 2022-06-03 08:09:47 -06:00