Commit ab108cd3 authored by Stan Hu's avatar Stan Hu

Merge branch 'sh-fix-order-dependent-prometheus-spec' into 'master'

Fix order-dependent Prometheus metrics specs

Closes #196048

See merge request gitlab-org/gitlab!22690
parents 44739602 e500cc49
......@@ -62,10 +62,18 @@ module Gitlab
end
def error_detected!
set_error!(true)
end
def clear_errors!
set_error!(false)
end
def set_error!(status)
clear_memoization(:prometheus_metrics_enabled)
PROVIDER_MUTEX.synchronize do
@error = true
@error = status
end
end
......
......@@ -6,6 +6,10 @@ describe Gitlab::Metrics::Prometheus, :prometheus do
let(:all_metrics) { Gitlab::Metrics }
let(:registry) { all_metrics.registry }
after do
all_metrics.clear_errors!
end
describe '#reset_registry!' do
it 'clears existing metrics' do
registry.counter(:test, 'test metric')
......
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