diff options
author | Douwe Maan <douwe@gitlab.com> | 2019-04-19 09:29:22 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2019-04-19 09:29:22 +0000 |
commit | 1aa0ceae41c444fd18e37237497ecb8306a21307 (patch) | |
tree | 9b7b55d287b0351dde9cd24daf43c09971cfe394 /db | |
parent | 6376f78445300ee42c5a181f63e5b332d8266b0a (diff) | |
parent | e5966e5dff37c1060e8bd321888972c821b63362 (diff) | |
download | gitlab-ce-1aa0ceae41c444fd18e37237497ecb8306a21307.tar.gz |
Merge branch '60383-change-common-metrics-schema' into 'master'
Change the schema of common_metrics.yml
Closes #60383
See merge request gitlab-org/gitlab-ce!27283
Diffstat (limited to 'db')
-rw-r--r-- | db/importers/common_metrics_importer.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/db/importers/common_metrics_importer.rb b/db/importers/common_metrics_importer.rb index deadd653ae9..195bde8f34a 100644 --- a/db/importers/common_metrics_importer.rb +++ b/db/importers/common_metrics_importer.rb @@ -53,7 +53,7 @@ module Importers private def process_content(&blk) - content.map do |group| + content['panel_groups'].map do |group| process_group(group, &blk) end end @@ -63,28 +63,28 @@ module Importers group: find_group_title_key(group['group']) } - group['metrics'].map do |metric| - process_metric(metric, attributes, &blk) + group['panels'].map do |panel| + process_panel(panel, attributes, &blk) end end - def process_metric(metric, attributes, &blk) + def process_panel(panel, attributes, &blk) attributes = attributes.merge( - title: metric['title'], - y_label: metric['y_label']) + title: panel['title'], + y_label: panel['y_label']) - metric['queries'].map do |query| - process_metric_query(query, attributes, &blk) + panel['metrics'].map do |metric_details| + process_metric_details(metric_details, attributes, &blk) end end - def process_metric_query(query, attributes, &blk) + def process_metric_details(metric_details, attributes, &blk) attributes = attributes.merge( - legend: query['label'], - query: query['query_range'], - unit: query['unit']) + legend: metric_details['label'], + query: metric_details['query_range'], + unit: metric_details['unit']) - yield(query['id'], attributes) + yield(metric_details['id'], attributes) end def find_or_build_metric!(id) |