diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-20 18:40:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-20 18:40:28 +0300 |
commit | b595cb0c1dec83de5bdee18284abe86614bed33b (patch) | |
tree | 8c3d4540f193c5ff98019352f554e921b3a41a72 /app/services/concerns/alert_management/alert_processing.rb | |
parent | 2f9104a328fc8a4bddeaa4627b595166d24671d0 (diff) |
Add latest changes from gitlab-org/gitlab@15-2-stable-eev15.2.0-rc42
Diffstat (limited to 'app/services/concerns/alert_management/alert_processing.rb')
-rw-r--r-- | app/services/concerns/alert_management/alert_processing.rb | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/app/services/concerns/alert_management/alert_processing.rb b/app/services/concerns/alert_management/alert_processing.rb index abbfd4d66d4..f10ff4e6f19 100644 --- a/app/services/concerns/alert_management/alert_processing.rb +++ b/app/services/concerns/alert_management/alert_processing.rb @@ -38,7 +38,7 @@ module AlertManagement if alert.resolve(incoming_payload.ends_at) SystemNoteService.change_alert_status(alert, User.alert_bot) - close_issue(alert.issue) if auto_close_incident? + close_issue(alert.issue_id) if auto_close_incident? else logger.warn( message: 'Unable to update AlertManagement::Alert status to resolved', @@ -52,22 +52,18 @@ module AlertManagement alert.register_new_event! end - def close_issue(issue) - return if issue.blank? || issue.closed? + def close_issue(issue_id) + return unless issue_id - ::Issues::CloseService - .new(project: project, current_user: User.alert_bot) - .execute(issue, system_note: false) - - SystemNoteService.auto_resolve_prometheus_alert(issue, project, User.alert_bot) if issue.reset.closed? + ::IncidentManagement::CloseIncidentWorker.perform_async(issue_id) end def process_new_alert + return if resolving_alert? + if alert.save alert.execute_integrations SystemNoteService.create_new_alert(alert, alert_source) - - process_resolved_alert if resolving_alert? else logger.warn( message: "Unable to create AlertManagement::Alert from #{alert_source}", @@ -78,7 +74,7 @@ module AlertManagement end def process_incident_issues - return if alert.issue || alert.resolved? + return if alert.issue_id || alert.resolved? ::IncidentManagement::ProcessAlertWorkerV2.perform_async(alert.id) end |