summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorrpereira2 <rpereira@gitlab.com>2019-04-11 20:09:58 +0530
committersyasonik <syasonik@gitlab.com>2019-04-17 20:02:24 +0800
commit8a51b21918161dda5977a92327175a1728efa1c8 (patch)
tree90de06942c767b7b350afc7d9c7d98763814a69a /db
parent38da5d6b23577edcd2a924125e0e4f3f8236f234 (diff)
downloadgitlab-ce-8a51b21918161dda5977a92327175a1728efa1c8.tar.gz
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.
Diffstat (limited to 'db')
-rw-r--r--db/importers/common_metrics_importer.rb26
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)