Skip to content

Commit

Permalink
Also exclude from _get_log_records_for_after_resolve_report
Browse files Browse the repository at this point in the history
  • Loading branch information
mderynck committed Nov 19, 2024
1 parent 065a2b1 commit a586760
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion engine/apps/alerts/incident_log_builder/incident_log_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ def _get_log_records_for_after_resolve_report(self) -> "RelatedManager['AlertGro
Q(Q(type=AlertGroupLogRecord.TYPE_ATTACHED) | Q(type=AlertGroupLogRecord.TYPE_UNATTACHED))
& Q(Q(root_alert_group__isnull=True) & Q(dependent_alert_group__isnull=True))
)
# Exclude SUCCESS + ERROR_NOTIFICATION_POSTING_TO_SLACK_IS_DISABLED, these cause confusions as the user
# has already been notified by another path so this step should not be displayed, although it is kept
# for auditing.
| Q(
Q(type=UserNotificationPolicyLogRecord.TYPE_PERSONAL_NOTIFICATION_SUCCESS)
& Q(
notification_error_code=UserNotificationPolicyLogRecord.ERROR_NOTIFICATION_POSTING_TO_SLACK_IS_DISABLED
)
)
)
.select_related("author")
.distinct()
Expand All @@ -152,8 +161,14 @@ def _get_user_notification_log_records_for_log_report(self) -> "RelatedManager['
Q(type=UserNotificationPolicyLogRecord.TYPE_PERSONAL_NOTIFICATION_TRIGGERED)
& Q(notification_policy__step=UserNotificationPolicy.Step.WAIT)
)
# Exclude SUCCESS + ERROR_NOTIFICATION_POSTING_TO_SLACK_IS_DISABLED, these cause confusions as the user
# has already been notified by another path so this step should not be displayed, although it is kept
# for auditing.
| Q(
notification_error_code=UserNotificationPolicyLogRecord.ERROR_NOTIFICATION_POSTING_TO_SLACK_IS_DISABLED
Q(type=UserNotificationPolicyLogRecord.TYPE_PERSONAL_NOTIFICATION_SUCCESS)
& Q(
notification_error_code=UserNotificationPolicyLogRecord.ERROR_NOTIFICATION_POSTING_TO_SLACK_IS_DISABLED
)
)
)
.select_related("author")
Expand Down

0 comments on commit a586760

Please sign in to comment.