Commit f5e9dc63 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'sh-fix-stale-prometrics-config' into 'master'

Fix stale Prometheus metrics directory not being restored

See merge request gitlab-org/gitlab!76477
parents 8464faa7 cd89f9c0
......@@ -32,6 +32,7 @@ RSpec.describe MetricsServer do # rubocop:disable RSpec/FilePath
let(:prometheus_config) { ::Prometheus::Client::Configuration.new }
let(:metrics_dir) { Dir.mktmpdir }
let(:settings_double) { double(:settings, sidekiq_exporter: {}) }
let!(:old_metrics_dir) { ::Prometheus::Client.configuration.multiprocess_files_dir }
subject(:metrics_server) { described_class.new('fake', metrics_dir, true)}
......@@ -43,8 +44,11 @@ RSpec.describe MetricsServer do # rubocop:disable RSpec/FilePath
end
after do
Gitlab::Metrics.reset_registry!
::Prometheus::CleanupMultiprocDirService.new.execute
Dir.rmdir(metrics_dir)
::Prometheus::Client.configuration.multiprocess_files_dir = old_metrics_dir
end
it 'configures ::Prometheus::Client' do
......
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