diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:10:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:10:16 +0300 |
commit | 694555850c08df0e98209b49b9c26d4c0428ad31 (patch) | |
tree | 1e69bb796398f055a8b2e1823a78d4a4ae879930 /app/models/alert_management | |
parent | 520f3178665de5e7d313d332989cd445da83817b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/alert_management')
-rw-r--r-- | app/models/alert_management/alert.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/models/alert_management/alert.rb b/app/models/alert_management/alert.rb index 75581805b49..0318dedca11 100644 --- a/app/models/alert_management/alert.rb +++ b/app/models/alert_management/alert.rb @@ -11,6 +11,7 @@ module AlertManagement include Noteable include Gitlab::SQL::Pattern include Presentable + include Gitlab::Utils::StrongMemoize STATUSES = { triggered: 0, @@ -118,7 +119,7 @@ module AlertManagement end delegate :iid, to: :issue, prefix: true, allow_nil: true - delegate :metrics_dashboard_url, :runbook, :details_url, to: :present + delegate :metrics_dashboard_url, :details_url, to: :present scope :for_iid, -> (iid) { where(iid: iid) } scope :for_status, -> (status) { where(status: status) } @@ -197,6 +198,14 @@ module AlertManagement project.execute_services(hook_data, :alert_hooks) end + # Representation of the alert's payload. Avoid accessing + # #payload attribute directly. + def parsed_payload + strong_memoize(:parsed_payload) do + Gitlab::AlertManagement::Payload.parse(project, payload, monitoring_tool: monitoring_tool) + end + end + def present return super(presenter_class: AlertManagement::PrometheusAlertPresenter) if prometheus? |