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 'lib/gitlab/alerting/alert.rb')
-rw-r--r--lib/gitlab/alerting/alert.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/gitlab/alerting/alert.rb b/lib/gitlab/alerting/alert.rb
index dad3dabb4fc..94b81b7d290 100644
--- a/lib/gitlab/alerting/alert.rb
+++ b/lib/gitlab/alerting/alert.rb
@@ -7,7 +7,17 @@ module Gitlab
include Gitlab::Utils::StrongMemoize
include Presentable
- attr_accessor :project, :payload
+ attr_accessor :project, :payload, :am_alert
+
+ def self.for_alert_management_alert(project:, alert:)
+ params = if alert.prometheus?
+ alert.payload
+ else
+ Gitlab::Alerting::NotificationPayloadParser.call(alert.payload.to_h, alert.project)
+ end
+
+ self.new(project: project, payload: params, am_alert: alert)
+ end
def gitlab_alert
strong_memoize(:gitlab_alert) do