diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-03 00:32:59 +0300 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-05 12:37:07 +0300 |
commit | 6a70509a2763717e592c603249855bfb43519d2f (patch) | |
tree | 5f910b7ac90db6bc3c604700c59f190485e716fb /lib/gitlab/prometheus/queries | |
parent | e74896df0c7d0d88958a3d35b3144361cfdd0594 (diff) |
Towards Reviewable prometheus
Diffstat (limited to 'lib/gitlab/prometheus/queries')
-rw-r--r-- | lib/gitlab/prometheus/queries/matched_metrics_query.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/gitlab/prometheus/queries/matched_metrics_query.rb b/lib/gitlab/prometheus/queries/matched_metrics_query.rb index a5e1f6a3fde..fc97bca486c 100644 --- a/lib/gitlab/prometheus/queries/matched_metrics_query.rb +++ b/lib/gitlab/prometheus/queries/matched_metrics_query.rb @@ -23,11 +23,10 @@ module Gitlab::Prometheus::Queries metrics_groups.each do |group| groups[group] ||= { active_metrics: 0, metrics_missing_requirements: 0 } - metrics = group.metrics.flat_map(&:required_metrics) - active_metrics = metrics.count(&lookup.method(:has_key?)) + active_metrics = group.metrics.count { |metric| metric.required_metrics.all?(&lookup.method(:has_key?)) } groups[group][:active_metrics] += active_metrics - groups[group][:metrics_missing_requirements] += metrics.count - active_metrics + groups[group][:metrics_missing_requirements] += group.metrics.count - active_metrics end groups @@ -48,7 +47,7 @@ module Gitlab::Prometheus::Queries end def has_matching_label(series_info) - series_info.has_key?('environment') + series_info.key?('environment') end def available_metrics |