- Change FIRING trigger for webhooks to be sent after escalation snapshot has been computed - Extract users from `notify_to_users_queue` and `notify_schedule` from escalation snapshot to populate `users_to_be_notified` in webhook payload
71 lines
2.2 KiB
Python
71 lines
2.2 KiB
Python
import django.dispatch
|
|
|
|
from apps.slack.representatives.alert_group_representative import AlertGroupSlackRepresentative
|
|
from apps.slack.representatives.user_representative import UserSlackRepresentative
|
|
|
|
"""
|
|
There are three entities which require sync between web, slack and telegram.
|
|
AlertGroup, AlertGroup's logs and AlertGroup's resolution notes.
|
|
"""
|
|
# Signal to create alert group message in all connected integrations (Slack, Telegram)
|
|
alert_create_signal = django.dispatch.Signal(
|
|
providing_args=[
|
|
"alert",
|
|
]
|
|
)
|
|
|
|
alert_group_created_signal = django.dispatch.Signal(
|
|
providing_args=[
|
|
"alert_group",
|
|
]
|
|
)
|
|
|
|
alert_group_escalation_snapshot_built = django.dispatch.Signal(
|
|
providing_args=[
|
|
"alert_group",
|
|
]
|
|
)
|
|
|
|
# Signal to rerender alert group in all connected integrations (Slack, Telegram) when its state is changed
|
|
alert_group_action_triggered_signal = django.dispatch.Signal(
|
|
providing_args=[
|
|
"log_record",
|
|
"action_source",
|
|
]
|
|
)
|
|
|
|
# Signal to rerender alert group's log message in all connected integrations (Slack, Telegram)
|
|
# when alert group state is changed
|
|
alert_group_update_log_report_signal = django.dispatch.Signal(providing_args=["alert_group"])
|
|
|
|
# Signal to rerender alert group's resolution note in all connected integrations (Slack)
|
|
alert_group_update_resolution_note_signal = django.dispatch.Signal(
|
|
providing_args=[
|
|
"alert_group",
|
|
"resolution_note",
|
|
]
|
|
)
|
|
|
|
# Currently only writes error in Slack thread while notify user. Maybe it is worth to delete it?
|
|
user_notification_action_triggered_signal = django.dispatch.Signal(providing_args=["log_record"])
|
|
|
|
alert_create_signal.connect(
|
|
AlertGroupSlackRepresentative.on_create_alert,
|
|
)
|
|
|
|
|
|
alert_group_action_triggered_signal.connect(
|
|
AlertGroupSlackRepresentative.on_alert_group_action_triggered,
|
|
)
|
|
|
|
alert_group_update_log_report_signal.connect(
|
|
AlertGroupSlackRepresentative.on_alert_group_update_log_report,
|
|
)
|
|
|
|
alert_group_update_resolution_note_signal.connect(
|
|
AlertGroupSlackRepresentative.on_alert_group_update_resolution_note,
|
|
)
|
|
|
|
user_notification_action_triggered_signal.connect(
|
|
UserSlackRepresentative.on_user_action_triggered,
|
|
)
|