From 4252d3c18709b22b44cf7983b6be343663df2fda Mon Sep 17 00:00:00 2001 From: Justin Paul Date: Fri, 20 Feb 2026 20:04:00 -0500 Subject: [PATCH] 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 --- app/python-node-exporter.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/python-node-exporter.py b/app/python-node-exporter.py index bed89f7..975696b 100644 --- a/app/python-node-exporter.py +++ b/app/python-node-exporter.py @@ -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'],