Commit fb56b670 authored by Kamil Trzciński's avatar Kamil Trzciński

Improve EE::MetricGroup

parent bb65fc86
...@@ -2,7 +2,11 @@ module EE ...@@ -2,7 +2,11 @@ module EE
module Gitlab module Gitlab
module Prometheus module Prometheus
module MetricGroup module MetricGroup
module ClassMethods extend ActiveSupport::Concern
class_methods do
extend ::Gitlab::Utils::Override
def custom_metrics(project) def custom_metrics(project)
project.prometheus_metrics.all.group_by(&:group_title).map do |name, metrics| project.prometheus_metrics.all.group_by(&:group_title).map do |name, metrics|
::Gitlab::Prometheus::MetricGroup.new( ::Gitlab::Prometheus::MetricGroup.new(
...@@ -10,14 +14,11 @@ module EE ...@@ -10,14 +14,11 @@ module EE
end end
end end
override :for_project
def for_project(project) def for_project(project)
super + custom_metrics(project) super + custom_metrics(project)
end end
end end
def self.prepended(base)
base.singleton_class.prepend ClassMethods
end
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment