diff options
Diffstat (limited to 'lib/gitlab/alert_management/payload')
-rw-r--r-- | lib/gitlab/alert_management/payload/managed_prometheus.rb | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/lib/gitlab/alert_management/payload/managed_prometheus.rb b/lib/gitlab/alert_management/payload/managed_prometheus.rb deleted file mode 100644 index 4ed21108d3e..00000000000 --- a/lib/gitlab/alert_management/payload/managed_prometheus.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -# Attribute mapping for alerts via prometheus alerting integration, -# and for which payload includes gitlab-controlled attributes. -module Gitlab - module AlertManagement - module Payload - class ManagedPrometheus < ::Gitlab::AlertManagement::Payload::Prometheus - attribute :gitlab_prometheus_alert_id, - paths: %w(labels gitlab_prometheus_alert_id), - type: :integer - attribute :metric_id, - paths: %w(labels gitlab_alert_id), - type: :integer - - def gitlab_alert - strong_memoize(:gitlab_alert) do - next unless metric_id || gitlab_prometheus_alert_id - - alerts = Projects::Prometheus::AlertsFinder - .new(project: project, metric: metric_id, id: gitlab_prometheus_alert_id) - .execute - - next if alerts.blank? || alerts.size > 1 - - alerts.first - end - end - - def full_query - gitlab_alert&.full_query || super - end - - def environment - gitlab_alert&.environment || super - end - - private - - def plain_gitlab_fingerprint - [metric_id, starts_at_raw].join('/') - end - end - end - end -end |