Skip to content

Commit 8e4a2dd

Browse files
authored
v1.12.0
2 parents 386c4d3 + 686ebbf commit 8e4a2dd

File tree

111 files changed

+3073
-997
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+3073
-997
lines changed

docs/sources/manage/notify/phone-calls-sms/index.md

+315-4
Large diffs are not rendered by default.

engine/apps/alerts/escalation_snapshot/snapshot_classes/escalation_policy_snapshot.py

+25-22
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@
2020
)
2121
from apps.alerts.utils import is_declare_incident_step_enabled
2222
from apps.schedules.ical_utils import list_users_to_notify_from_ical
23-
from apps.user_management.models import User
2423

2524
if typing.TYPE_CHECKING:
2625
from apps.alerts.models.alert_group import AlertGroup
26+
from apps.schedules.models import OnCallSchedule
27+
from apps.slack.models import SlackUserGroup
28+
from apps.user_management.models import Team, User
29+
from apps.webhooks.models import Webhook
2730

2831

2932
class EscalationPolicySnapshot:
@@ -57,24 +60,24 @@ class EscalationPolicySnapshot:
5760

5861
def __init__(
5962
self,
60-
id,
61-
order,
62-
step,
63-
wait_delay,
64-
notify_to_users_queue,
65-
last_notified_user,
66-
from_time,
67-
to_time,
68-
num_alerts_in_window,
69-
num_minutes_in_window,
70-
custom_webhook,
71-
notify_schedule,
72-
notify_to_group,
73-
escalation_counter,
74-
passed_last_time,
75-
pause_escalation,
76-
notify_to_team_members=None,
77-
severity=None,
63+
id: int,
64+
order: int,
65+
step: int,
66+
wait_delay: typing.Optional[datetime.timedelta],
67+
notify_to_users_queue: typing.Optional[typing.Sequence["User"]],
68+
last_notified_user: typing.Optional["User"],
69+
from_time: typing.Optional[datetime.time],
70+
to_time: typing.Optional[datetime.time],
71+
num_alerts_in_window: typing.Optional[int],
72+
num_minutes_in_window: typing.Optional[int],
73+
custom_webhook: typing.Optional["Webhook"],
74+
notify_schedule: typing.Optional["OnCallSchedule"],
75+
notify_to_group: typing.Optional["SlackUserGroup"],
76+
escalation_counter: int,
77+
passed_last_time: typing.Optional[datetime.datetime],
78+
pause_escalation: bool,
79+
notify_to_team_members: typing.Optional["Team"] = None,
80+
severity: typing.Optional[str] = None,
7881
):
7982
self.id = id
8083
self.order = order
@@ -107,11 +110,11 @@ def escalation_policy(self) -> typing.Optional[EscalationPolicy]:
107110
return EscalationPolicy.objects.filter(pk=self.id).first()
108111

109112
@property
110-
def sorted_users_queue(self) -> typing.List[User]:
113+
def sorted_users_queue(self) -> typing.List["User"]:
111114
return sorted(self.notify_to_users_queue, key=lambda user: (user.username or "", user.pk))
112115

113116
@property
114-
def next_user_in_sorted_queue(self) -> User:
117+
def next_user_in_sorted_queue(self) -> "User":
115118
users_queue = self.sorted_users_queue
116119
try:
117120
last_user_index = users_queue.index(self.last_notified_user)
@@ -120,7 +123,7 @@ def next_user_in_sorted_queue(self) -> User:
120123
next_user = users_queue[(last_user_index + 1) % len(users_queue)]
121124
return next_user
122125

123-
def execute(self, alert_group: "AlertGroup", reason) -> StepExecutionResultData:
126+
def execute(self, alert_group: "AlertGroup", reason: str) -> StepExecutionResultData:
124127
action_map: typing.Dict[typing.Optional[int], EscalationPolicySnapshot.StepExecutionFunc] = {
125128
EscalationPolicy.STEP_WAIT: self._escalation_step_wait,
126129
EscalationPolicy.STEP_FINAL_NOTIFYALL: self._escalation_step_notify_all,

0 commit comments

Comments
 (0)