Commit e0769dde authored by Mikolaj Wawrzyniak's avatar Mikolaj Wawrzyniak

Aggreagated metrics add YAML anchors and aliases

To avoid repetitive parts of aggregated metrics definition lets
utilize YAML anchor and aliases feature
parent db2a50fa
...@@ -148,7 +148,7 @@ module Gitlab ...@@ -148,7 +148,7 @@ module Gitlab
end end
def load_yaml_from_path(path) def load_yaml_from_path(path)
YAML.safe_load(File.read(path))&.map(&:with_indifferent_access) YAML.safe_load(File.read(path), aliases: true)&.map(&:with_indifferent_access)
end end
end end
end end
......
...@@ -222,6 +222,12 @@ RSpec.describe Gitlab::Usage::Metrics::Aggregates::Aggregate, :clean_gitlab_redi ...@@ -222,6 +222,12 @@ RSpec.describe Gitlab::Usage::Metrics::Aggregates::Aggregate, :clean_gitlab_redi
end end
end end
it 'allows for YAML aliases in aggregated metrics configs' do
expect(YAML).to receive(:safe_load).with(kind_of(String), aliases: true)
described_class.new(recorded_at)
end
describe '.aggregated_metrics_weekly_data' do describe '.aggregated_metrics_weekly_data' do
subject(:aggregated_metrics_data) { described_class.new(recorded_at).weekly_data } subject(:aggregated_metrics_data) { described_class.new(recorded_at).weekly_data }
......
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