diff options
Diffstat (limited to 'app/services/concerns')
-rw-r--r-- | app/services/concerns/alert_management/alert_processing.rb | 21 | ||||
-rw-r--r-- | app/services/concerns/work_items/widgetable_service.rb | 2 |
2 files changed, 14 insertions, 9 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 diff --git a/app/services/concerns/work_items/widgetable_service.rb b/app/services/concerns/work_items/widgetable_service.rb index 5665b07dce1..beb614c7b76 100644 --- a/app/services/concerns/work_items/widgetable_service.rb +++ b/app/services/concerns/work_items/widgetable_service.rb @@ -18,7 +18,7 @@ module WorkItems # rubocop:enable Gitlab/ModuleWithInstanceVariables def widget_service_class(widget) - "WorkItems::Widgets::#{widget.type.capitalize}Service::#{self.class.name.demodulize}".constantize + "WorkItems::Widgets::#{widget.type.to_s.camelize}Service::#{self.class.name.demodulize}".constantize rescue NameError nil end |