Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/concerns/alert_management/alert_processing.rb')
-rw-r--r--app/services/concerns/alert_management/alert_processing.rb21
1 files changed, 13 insertions, 8 deletions
diff --git a/app/services/concerns/alert_management/alert_processing.rb b/app/services/concerns/alert_management/alert_processing.rb
index f10ff4e6f19..8c6c7b15d28 100644
--- a/app/services/concerns/alert_management/alert_processing.rb
+++ b/app/services/concerns/alert_management/alert_processing.rb
@@ -39,12 +39,6 @@ module AlertManagement
SystemNoteService.change_alert_status(alert, User.alert_bot)
close_issue(alert.issue_id) if auto_close_incident?
- else
- logger.warn(
- message: 'Unable to update AlertManagement::Alert status to resolved',
- project_id: project.id,
- alert_id: alert.id
- )
end
end
@@ -64,13 +58,18 @@ module AlertManagement
if alert.save
alert.execute_integrations
SystemNoteService.create_new_alert(alert, alert_source)
+ elsif alert.errors[:fingerprint].any?
+ refind_and_increment_alert
else
logger.warn(
- message: "Unable to create AlertManagement::Alert from #{alert_source}",
+ message: "Unable to create AlertManagement::Alert",
project_id: project.id,
- alert_errors: alert.errors.messages
+ alert_errors: alert.errors.messages,
+ alert_source: alert_source
)
end
+ rescue ActiveRecord::RecordNotUnique
+ refind_and_increment_alert
end
def process_incident_issues
@@ -107,6 +106,12 @@ module AlertManagement
AlertManagement::Alert.new(**incoming_payload.alert_params, ended_at: nil)
end
+ def refind_and_increment_alert
+ clear_memoization(:alert)
+
+ process_firing_alert
+ end
+
def resolving_alert?
incoming_payload.ends_at.present?
end