diff options
Diffstat (limited to 'lib/gitlab/metrics/dashboard/processor.rb')
-rw-r--r-- | lib/gitlab/metrics/dashboard/processor.rb | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/lib/gitlab/metrics/dashboard/processor.rb b/lib/gitlab/metrics/dashboard/processor.rb index c0fa3bb2f3a..bfdee76a818 100644 --- a/lib/gitlab/metrics/dashboard/processor.rb +++ b/lib/gitlab/metrics/dashboard/processor.rb @@ -8,43 +8,23 @@ module Gitlab # the UI. These includes shared metric info, custom metrics # info, and alerts (only in EE). class Processor - SYSTEM_SEQUENCE = [ - Stages::CommonMetricsInserter, - Stages::ProjectMetricsInserter, - Stages::EndpointInserter, - Stages::Sorter - ].freeze - - PROJECT_SEQUENCE = [ - Stages::CommonMetricsInserter, - Stages::EndpointInserter, - Stages::Sorter - ].freeze - - def initialize(project, environment, dashboard) + def initialize(project, dashboard, sequence, params) @project = project - @environment = environment @dashboard = dashboard + @sequence = sequence + @params = params end # Returns a new dashboard hash with the results of # running transforms on the dashboard. - def process(insert_project_metrics:) + def process @dashboard.deep_symbolize_keys.tap do |dashboard| - sequence(insert_project_metrics).each do |stage| - stage.new(@project, @environment, dashboard).transform! + @sequence.each do |stage| + stage.new(@project, dashboard, @params).transform! end end end - - private - - def sequence(insert_project_metrics) - insert_project_metrics ? SYSTEM_SEQUENCE : PROJECT_SEQUENCE - end end end end end - -Gitlab::Metrics::Dashboard::Processor.prepend_if_ee('EE::Gitlab::Metrics::Dashboard::Processor') |