Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion collector/system_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (s *SystemCollector) Collect(ch chan<- prometheus.Metric) {
if systemTotalMemoryHealthStateValue, ok := parseCommonStatusHealth(systemTotalMemoryHealthState); ok {
ch <- prometheus.MustNewConstMetric(s.metrics["system_total_memory_health_state"].desc, prometheus.GaugeValue, systemTotalMemoryHealthStateValue, systemLabelValues...)
}

// get system OdataID
//systemOdataID := system.ODataID

Expand Down Expand Up @@ -296,8 +296,17 @@ func (s *SystemCollector) Collect(ch chan<- prometheus.Metric) {
} else if pcieDevices == nil {
systemLogContext.WithField("operation", "system.PCIeDevices()").Info("no PCI-E device data found")
} else {
processed := make(map[string]bool)
wg5.Add(len(pcieDevices))
//Some devices are returning duplicated PCIeDevices. This is workaround for this. Example of such data can be found in sampleOut/system_duplicated_devices.json
for _, pcieDevice := range pcieDevices {
_, exists := processed[pcieDevice.ODataID]
if exists {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: In the absence of any unit tests it would be helpful to add the scrape data where we see this issue to the sampleOut folder.

A comment could also be added here, referencing the sample data.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I have added sample data and comment about it.

systemLogContext.WithField("operation", "system.PCIeDevices()").Info(fmt.Sprintf("Ignoring duplicate pci device: %s", pcieDevice.ODataID))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you see the duplicate devices in the Redfish response?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Here is sample of what I got, when I made curl call:
"PCIeDevices": [ { "@odata.id": "/redfish/v1/Systems/System.Embedded.1/PCIeDevices/129-0" }, { "@odata.id": "/redfish/v1/Systems/System.Embedded.1/PCIeDevices/129-0" }, { "@odata.id": "/redfish/v1/Systems/System.Embedded.1/PCIeDevices/128-7" }, { "@odata.id": "/redfish/v1/Systems/System.Embedded.1/PCIeDevices/128-4" }, { "@odata.id": "/redfish/v1/Systems/System.Embedded.1/PCIeDevices/128-8" }, { "@odata.id": "/redfish/v1/Systems/System.Embedded.1/PCIeDevices/128-7" }, { "@odata.id": "/redfish/v1/Systems/System.Embedded.1/PCIeDevices/128-2" }, { "@odata.id": "/redfish/v1/Systems/System.Embedded.1/PCIeDevices/128-8" }, { "@odata.id": "/redfish/v1/Systems/System.Embedded.1/PCIeDevices/128-1" }, { "@odata.id": "/redfish/v1/Systems/System.Embedded.1/PCIeDevices/128-3" }, { "@odata.id": "/redfish/v1/Systems/System.Embedded.1/PCIeDevices/128-0" }, { "@odata.id": "/redfish/v1/Systems/System.Embedded.1/PCIeDevices/160-8" }, { "@odata.id": "/redfish/v1/Systems/System.Embedded.1/PCIeDevices/160-7" }, { "@odata.id": "/redfish/v1/Systems/System.Embedded.1/PCIeDevices/160-7" }, { "@odata.id": "/redfish/v1/Systems/System.Embedded.1/PCIeDevices/160-3" }, { "@odata.id": "/redfish/v1/Systems/System.Embedded.1/PCIeDevices/160-8" },

wg5.Done()
continue
}
processed[pcieDevice.ODataID] = true
go parsePcieDevice(ch, systemHostName, pcieDevice, wg5)
}
}
Expand Down
Loading