Skip to content

Commit

Permalink
Refine code
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaodong Ye <[email protected]>
  • Loading branch information
yeahdongcn committed Dec 24, 2024
1 parent 2005355 commit 7f53e1c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions collector/rdma_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func (c *rdmaCollector) Update(ch chan<- prometheus.Metric) error {
updateFunc := func(key string, value float64, labelValues ...string) {
metric, ok := lookupTable[key]
if !ok {
c.logger.Debug("rdma metric not found in lookup table", "key", key)
c.logger.Warn("rdma metric not found in lookup table", "key", key)
return
}
if !c.metricsPattern.MatchString(metric) {
Expand All @@ -293,10 +293,7 @@ func (c *rdmaCollector) Update(ch chan<- prometheus.Metric) error {
}

for _, portstats := range stats.PortStats {
for _, stat := range portstats.HwStats {
updateFunc(stat.Name, float64(stat.Value), device, fmt.Sprintf("%d", portstats.Port), interfaces)
}
for _, stat := range portstats.Stats {
for _, stat := range append(portstats.HwStats, portstats.Stats...) {
updateFunc(stat.Name, float64(stat.Value), device, fmt.Sprintf("%d", portstats.Port), interfaces)
}
}
Expand Down

0 comments on commit 7f53e1c

Please sign in to comment.