mirror of
https://github.com/recklessop/Zerto_Exporter.git
synced 2026-07-03 07:53:15 -04:00
Fix duplicate VRA metrics after VRA upgrade (closes #21)
VraVersion is used as a Prometheus label. When a VRA upgrades, the new version creates a new time series while the old one persists until restart. Fix: clear all VRA Gauges at the start of each collection cycle so stale label sets (old version numbers) are removed before repopulating with current data. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -462,6 +462,12 @@ def GetVraMetrics(zvm_instance):
|
||||
|
||||
if vras_json is not None:
|
||||
log.debug("VRA names: %s", vras_json)
|
||||
# Clear stale label sets so upgraded VRAs don't appear twice
|
||||
for g in (g_vra_memory, g_vra_vcpu_count, g_vra_protected_vms,
|
||||
g_vra_protected_vpgs, g_vra_protected_vols,
|
||||
g_vra_recovery_vms, g_vra_recovery_vpgs, g_vra_recovery_vols,
|
||||
g_vra_self_protected, g_vra_cpu_usage, g_vra_memory_usage):
|
||||
g.clear()
|
||||
for vra in vras_json:
|
||||
lbl = dict(
|
||||
VraIdentifierStr=vra['VraIdentifierStr'],
|
||||
|
||||
Reference in New Issue
Block a user