Commit ce3d98f7 authored by Kamil Trzciński's avatar Kamil Trzciński

Fix static analysis

parent 5646f3f5
......@@ -9,11 +9,11 @@ module Importers
aws_elb: -3,
nginx: -4,
kubernetes: -5,
# custom groups
business: 0,
response: 1,
system: 2,
system: 2
}
scope :common, -> { where(common: true) }
......@@ -38,7 +38,7 @@ module Importers
def initialize(file = 'config/prometheus/common_metrics.yml')
@content = YAML.load_file(file)
end
def execute
process_content do |id, attributes|
find_or_build_metric!(id)
......@@ -80,12 +80,12 @@ module Importers
query: query['query_range'],
unit: query['unit'])
blk.call(query['id'], attributes)
yield(query['id'], attributes)
end
def find_or_build_metric!(id)
raise MissingQueryId unless id
PrometheusMetric.common.find_by(identifier: id) ||
PrometheusMetric.new(common: true, identifier: id)
end
......
......@@ -118,4 +118,4 @@ describe Importers::CommonMetricsImporter do
end
end
end
end
\ No newline at end of file
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment