pdh: report duplicate instances by occurrence instead of renaming them (#2742)

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2026-10-16 09:58:43 +02:00
committed by GitHub
parent d8dbf852d1
commit 43d77f6869
32 changed files with 832 additions and 266 deletions
@@ -57,7 +57,8 @@ type collectorReplicaVM struct {
}
type perfDataCounterValuesReplicaVM struct {
Name string
Name string
Occurrence int
AverageReplicationLatency float64 `perfdata:"Average Replication Latency"`
AverageReplicationSize float64 `perfdata:"Average Replication Size"`
@@ -198,6 +199,11 @@ func (c *Collector) collectReplicaVMPerfData(ch chan<- prometheus.Metric, scrape
return fmt.Errorf("failed to collect Hyper-V Replica VM metrics: %w", err)
}
suffixDuplicateVMs(c.perfDataObjectReplicaVM,
func(row *perfDataCounterValuesReplicaVM) *string { return &row.Name },
func(row *perfDataCounterValuesReplicaVM) int { return row.Occurrence },
)
for _, data := range c.perfDataObjectReplicaVM {
ch <- scrape.MustNewConstMetric(
c.replicaVMAverageReplicationLatency,