Class: Gitlab::Metrics::Dashboard::Stages::CommonMetricsInserter

Inherits:
BaseStage
  • Object
show all
Defined in:
lib/gitlab/metrics/dashboard/stages/common_metrics_inserter.rb

Constant Summary

Constants included from Defaults

Defaults::DEFAULT_PANEL_TYPE

Instance Attribute Summary

Attributes inherited from BaseStage

#dashboard, #params, #project

Instance Method Summary collapse

Methods inherited from BaseStage

#initialize

Constructor Details

This class inherits a constructor from Gitlab::Metrics::Dashboard::Stages::BaseStage

Instance Method Details

#transform!Object

For each metric in the dashboard config, attempts to find a corresponding database record. If found, includes the record's id in the dashboard config.


11
12
13
14
15
16
17
18
# File 'lib/gitlab/metrics/dashboard/stages/common_metrics_inserter.rb', line 11

def transform!
  common_metrics = ::PrometheusMetricsFinder.new(common: true).execute

  for_metrics do |metric|
    metric_record = common_metrics.find { |m| m.identifier == metric[:id] }
    metric[:metric_id] = metric_record.id if metric_record
  end
end