Added reset before collecting new metrics to prevent dangling metrics

This commit is contained in:
Jan Lošťák
2025-02-22 19:28:37 +01:00
parent 2b385fbade
commit 2ed310eef7
8 changed files with 73 additions and 0 deletions

View File

@@ -46,6 +46,9 @@ func (c *PveClusterStateCollector) CollectMetrics() error {
return err
}
c.nodes.Reset()
c.quorate.Reset()
l := prometheus.Labels{"cluster": cluster.Name}
c.nodes.With(l).Set(float64(cluster.Nodes))
c.quorate.With(l).Set(float64(cluster.Quorate))