Read about our upcoming Code of Conduct on this issue

metric_group.rb 521 Bytes
Newer Older
1
2
3
module Gitlab
  module Prometheus
    class MetricGroup
4
      include ActiveModel::Model
5

6
      attr_accessor :name, :priority, :metrics
7

8
      validates :name, :priority, :metrics, presence: true
9

10
      def self.common_metrics
11
12
13
        ::PrometheusMetric.common.group_by(&:group_title).map do |name, metrics|
          MetricGroup.new(name: name, priority: 0, metrics: metrics.map(&:to_query_metric))
        end
14
      end
15
16
17
18
19

      # EE only
      def self.for_project(_)
        common_metrics
      end
20
21
22
    end
  end
end