Commit 0f7eb573 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'sh-fix-geo-issue-9000' into 'master'

Geo: Fix metrics updates when secondary nodes are cached

Closes #9000

See merge request gitlab-org/gitlab-ee!8981
parents 743b2a9b bf7ed3d4
......@@ -14,7 +14,7 @@ module Geo
update_prometheus_metrics(current_node, current_node_status) if prometheus_enabled?
if Gitlab::Geo.primary? && prometheus_enabled?
Gitlab::Geo.secondary_nodes.find_each { |node| update_prometheus_metrics(node, node.status) }
Gitlab::Geo.secondary_nodes.each { |node| update_prometheus_metrics(node, node.status) }
end
end
......
......@@ -124,6 +124,16 @@ describe Geo::MetricsUpdateService, :geo, :prometheus do
it 'updates the GeoNodeStatus entry' do
expect { subject.execute }.to change { GeoNodeStatus.count }.by(1)
end
it 'updates metrics when secondary nodes are cached', :request_store do
allow(subject).to receive(:update_prometheus_metrics).and_call_original
expect(subject).to receive(:update_prometheus_metrics).with(secondary, anything).twice
expect(subject).to receive(:update_prometheus_metrics).with(another_secondary, anything).twice
2.times do
subject.execute
end
end
end
context 'when node is a secondary' 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