-
Notifications
You must be signed in to change notification settings - Fork 85
fix pci devices duplicates #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
|
||
|
|
@@ -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 { | ||
| systemLogContext.WithField("operation", "system.PCIeDevices()").Info(fmt.Sprintf("Ignoring duplicate pci device: %s", pcieDevice.ODataID)) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you see the duplicate devices in the Redfish response?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: |
||
| wg5.Done() | ||
| continue | ||
| } | ||
| processed[pcieDevice.ODataID] = true | ||
| go parsePcieDevice(ch, systemHostName, pcieDevice, wg5) | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
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
sampleOutfolder.A comment could also be added here, referencing the sample data.
There was a problem hiding this comment.
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.