Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrpereira2 <rpereira@gitlab.com>2018-12-21 14:11:58 +0300
committerrpereira2 <rpereira@gitlab.com>2018-12-21 14:11:58 +0300
commit2cd7b783910230bec4c6a704d820631e3ff048ed (patch)
treed98625e8c68e437ac973095cded9b7ea0be39861 /lib/gitlab/prometheus
parented4994c3ac1121b8f8ca93e2378b3b5d2ae0927d (diff)
Correct ordering of metrics
Correct the ordering of metrics on performance dashboard. Before common metrics were moved into the DB, metric groups were ordered by the priority defined in the common_metrics.yml file. This commit adds a priority to each metric group in the PrometheusMetric model. It also combines title, priority and required_metrics into one frozen GROUP_DETAILS hash so that the code is clearer. This can be done since there is a fixed set of groups which are not configurable.
Diffstat (limited to 'lib/gitlab/prometheus')
-rw-r--r--lib/gitlab/prometheus/metric_group.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/gitlab/prometheus/metric_group.rb b/lib/gitlab/prometheus/metric_group.rb
index 8f30cdee232..394556e8708 100644
--- a/lib/gitlab/prometheus/metric_group.rb
+++ b/lib/gitlab/prometheus/metric_group.rb
@@ -10,9 +10,15 @@ module Gitlab
validates :name, :priority, :metrics, presence: true
def self.common_metrics
- ::PrometheusMetric.common.group_by(&:group_title).map do |name, metrics|
- MetricGroup.new(name: name, priority: 0, metrics: metrics.map(&:to_query_metric))
+ all_groups = ::PrometheusMetric.common.group_by(&:group_title).map do |name, metrics|
+ MetricGroup.new(
+ name: name,
+ priority: metrics.map(&:priority).max,
+ metrics: metrics.map(&:to_query_metric)
+ )
end
+
+ all_groups.sort_by(&:priority).reverse
end
# EE only