mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-20 11:39:04 +02:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user