oncall-engine/engine/apps/alerts/signals.py
Michael Derynck 6b40f95033 World, meet OnCall!
Co-authored-by: Eve832 <eve.meelan@grafana.com>
    Co-authored-by: Francisco Montes de Oca <nevermind89x@gmail.com>
    Co-authored-by: Ildar Iskhakov <ildar.iskhakov@grafana.com>
    Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
    Co-authored-by: Julia <ferril.darkdiver@gmail.com>
    Co-authored-by: maskin25 <kengurek@gmail.com>
    Co-authored-by: Matias Bordese <mbordese@gmail.com>
    Co-authored-by: Matvey Kukuy <motakuk@gmail.com>
    Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
    Co-authored-by: Richard Hartmann <richih@richih.org>
    Co-authored-by: Robby Milo <robbymilo@fastmail.com>
    Co-authored-by: Timur Olzhabayev <timur.olzhabayev@grafana.com>
    Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
    Co-authored-by: Yulia Shanyrova <yulia.shanyrova@grafana.com>
2022-06-03 08:09:47 -06:00

59 lines
1.9 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",
]
)
# 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,
)