mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-17 10:09:05 +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:
@@ -55,7 +55,8 @@ type collectorVirtualSwitch struct {
|
||||
}
|
||||
|
||||
type perfDataCounterValuesVirtualSwitch struct {
|
||||
Name string
|
||||
Name string
|
||||
Occurrence int
|
||||
|
||||
VirtualSwitchBroadcastPacketsReceived float64 `perfdata:"Broadcast Packets Received/sec"`
|
||||
VirtualSwitchBroadcastPacketsSent float64 `perfdata:"Broadcast Packets Sent/sec"`
|
||||
@@ -224,6 +225,11 @@ func (c *Collector) collectVirtualSwitch(ch chan<- prometheus.Metric, scrape *la
|
||||
return fmt.Errorf("failed to collect Hyper-V Virtual Switch metrics: %w", err)
|
||||
}
|
||||
|
||||
suffixDuplicateVMs(c.perfDataObjectVirtualSwitch,
|
||||
func(row *perfDataCounterValuesVirtualSwitch) *string { return &row.Name },
|
||||
func(row *perfDataCounterValuesVirtualSwitch) int { return row.Occurrence },
|
||||
)
|
||||
|
||||
for _, data := range c.perfDataObjectVirtualSwitch {
|
||||
ch <- scrape.MustNewConstMetric(
|
||||
c.virtualSwitchBroadcastPacketsReceived,
|
||||
|
||||
Reference in New Issue
Block a user