summaryrefslogtreecommitdiff
path: root/lib/gitlab/usage/metrics/instrumentations/issues_with_prometheus_alert_events.rb
blob: 2befec65ac27451dd67ee326d30e130d1b849234 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

module Gitlab
  module Usage
    module Metrics
      module Instrumentations
        class IssuesWithPrometheusAlertEvents < DatabaseMetric
          # this metric is used in IssuesCreatedFromAlertsMetric
          # do not report metric directly in service ping
          available? { false }

          operation :count

          start { Issue.minimum(:id) }
          finish { Issue.maximum(:id) }

          relation { Issue.with_prometheus_alert_events }

          cache_start_and_finish_as :issue
        end
      end
    end
  end
end