mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-11-10 04:27:25 +01:00
Refactoring: Use array of pointers
This commit is contained in:
parent
d6154ff35b
commit
542520d2c0
@ -6,6 +6,7 @@
|
||||
"test_fs"
|
||||
]
|
||||
},
|
||||
"ibstat": {},
|
||||
"loadavg": {
|
||||
"exclude_metrics": [
|
||||
"proc_total"
|
||||
|
@ -31,7 +31,7 @@ type InfinibandCollector struct {
|
||||
config struct {
|
||||
ExcludeDevices []string `json:"exclude_devices,omitempty"` // IB device to exclude e.g. mlx5_0
|
||||
}
|
||||
info []InfinibandCollectorInfo
|
||||
info []*InfinibandCollectorInfo
|
||||
}
|
||||
|
||||
// Init initializes the Infiniband collector by walking through files below IB_BASEPATH
|
||||
@ -111,7 +111,7 @@ func (m *InfinibandCollector) Init(config json.RawMessage) error {
|
||||
}
|
||||
|
||||
m.info = append(m.info,
|
||||
InfinibandCollectorInfo{
|
||||
&InfinibandCollectorInfo{
|
||||
LID: LID,
|
||||
device: device,
|
||||
port: port,
|
||||
@ -142,10 +142,7 @@ func (m *InfinibandCollector) Read(interval time.Duration, output chan lp.CCMetr
|
||||
}
|
||||
|
||||
now := time.Now()
|
||||
for i := range m.info {
|
||||
|
||||
// device info
|
||||
info := &m.info[i]
|
||||
for _, info := range m.info {
|
||||
for counterName, counterFile := range info.portCounterFiles {
|
||||
line, err := ioutil.ReadFile(counterFile)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user