From 8a51b21918161dda5977a92327175a1728efa1c8 Mon Sep 17 00:00:00 2001 From: rpereira2 Date: Thu, 11 Apr 2019 20:09:58 +0530 Subject: Change the schema of the common_metrics.yml - Change it to the new dashboard syntax described here: https://gitlab.com/gitlab-org/gitlab-ce/issues/60383. --- db/importers/common_metrics_importer.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'db/importers') 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) -- cgit v1.2.3