Skip to content

Commit 348074d

Browse files
fix pci devices duplicates
Co-authored-by: Will Szumski <[email protected]>
1 parent d388474 commit 348074d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

collector/system_collector.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func (s *SystemCollector) Collect(ch chan<- prometheus.Metric) {
177177
if systemTotalMemoryHealthStateValue, ok := parseCommonStatusHealth(systemTotalMemoryHealthState); ok {
178178
ch <- prometheus.MustNewConstMetric(s.metrics["system_total_memory_health_state"].desc, prometheus.GaugeValue, systemTotalMemoryHealthStateValue, systemLabelValues...)
179179
}
180-
180+
181181
// get system OdataID
182182
//systemOdataID := system.ODataID
183183

@@ -296,8 +296,16 @@ func (s *SystemCollector) Collect(ch chan<- prometheus.Metric) {
296296
} else if pcieDevices == nil {
297297
systemLogContext.WithField("operation", "system.PCIeDevices()").Info("no PCI-E device data found")
298298
} else {
299+
processed := make(map[string]bool)
299300
wg5.Add(len(pcieDevices))
300301
for _, pcieDevice := range pcieDevices {
302+
_, exists := processed[pcieDevice.ODataID]
303+
if exists {
304+
systemLogContext.WithField("operation", "system.PCIeDevices()").Info(fmt.Sprintf("Ignoring duplicate pci device: %s", pcieDevice.ODataID))
305+
wg5.Done()
306+
continue
307+
}
308+
processed[pcieDevice.ODataID] = true
301309
go parsePcieDevice(ch, systemHostName, pcieDevice, wg5)
302310
}
303311
}

0 commit comments

Comments
 (0)