Class: Gitlab::DatabaseImporters::CommonMetrics::Importer
- Inherits:
-
Object
- Object
- Gitlab::DatabaseImporters::CommonMetrics::Importer
- Defined in:
- lib/gitlab/database_importers/common_metrics/importer.rb
Constant Summary collapse
- MissingQueryId =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(filename = 'common_metrics.yml') ⇒ Importer
constructor
A new instance of Importer.
Constructor Details
#initialize(filename = 'common_metrics.yml') ⇒ Importer
Returns a new instance of Importer.
11 12 13 |
# File 'lib/gitlab/database_importers/common_metrics/importer.rb', line 11 def initialize(filename = 'common_metrics.yml') @content = YAML.load_file(Rails.root.join('config', 'prometheus', filename)) end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
9 10 11 |
# File 'lib/gitlab/database_importers/common_metrics/importer.rb', line 9 def content @content end |
Instance Method Details
#execute ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/gitlab/database_importers/common_metrics/importer.rb', line 15 def execute CommonMetrics::PrometheusMetric.reset_column_information process_content do |id, attributes| find_or_build_metric!(id) .update!(**attributes) end end |