Conversation
dd36224 to
6431c84
Compare
mdlayher
left a comment
There was a problem hiding this comment.
Will review in depth later, but TBH I don't think the use of reflect is really justified here. It's not that bad to write a couple of switch statements that match up filenames with struct fields. And the fields should be regular values and not pointers as well.
|
Thanks for the review. I will address those points. @mdlayher, do you really prefer to have a switch statement for the 16 different values? This list might grow. If the counter fields are regular values, what should I do if the system does not have this counter? |
6ea13b3 to
337211e
Compare
|
I looked at https://github.com/prometheus/node_exporter/blob/master/collector/infiniband_linux.go and borrowed the workarounds and the legacy counters. |
337211e to
64dcedd
Compare
|
I changed the two parse functions to take a string as parameter (instead of a path to the file). |
|
Tend to agree with @mdlayher. What about using a temporary map to iterate over instead of using reflect to iterate over the map? |
64dcedd to
0b0644c
Compare
|
|
3229901 to
642c0e0
Compare
|
@mdlayher I saw your recent commits on master and adapted this pull request to the logic used for PowerSupply. Therefore
All remarks are addressed and this pull request is ready for an in depth review. |
642c0e0 to
37a480d
Compare
The Prometheus node exporter collects metrics for the InfiniBand network protocol including the amount of packets sent and received, the number of times the link has been downed and how many times the link has recovered from an error state. Reading all those information from sysfs is better placed in the procfs library. Also collect the state, physical state, and the rate. Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
37a480d to
7acf46b
Compare
|
Merged, thanks! |
Parsing the sysfs files for InfiniBand was added to the procfs library (see prometheus/procfs#164). Therefore use `InfiniBandClass` from the procfs library instead of parsing sysfs itself. If the port counter return `N/A (no PMA)` no metric will be returned (instead of returning 0 for this metric. Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
Parsing the sysfs files for InfiniBand was added to the procfs library (see prometheus/procfs#164). Therefore use `InfiniBandClass` from the procfs library instead of parsing sysfs itself. If the port counter return `N/A (no PMA)` no metric will be returned (instead of returning 0 for this metric. Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
Do cargo-check for 32-bit linux in github CI
Parsing the sysfs files for InfiniBand was added to the procfs library (see prometheus/procfs#164). Therefore use `InfiniBandClass` from the procfs library instead of parsing sysfs itself. If the port counter return `N/A (no PMA)` no metric will be returned (instead of returning 0 for this metric. Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
Parsing the sysfs files for InfiniBand was added to the procfs library (see prometheus/procfs#164). Therefore use `InfiniBandClass` from the procfs library instead of parsing sysfs itself. If the port counter return `N/A (no PMA)` no metric will be returned (instead of returning 0 for this metric. Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
The Prometheus node exporter collects metrics for the InfiniBand network protocol including the amount of packets sent and received, the number of times the link has been downed and how many times the link has recovered from an error state.
Reading all those information from sysfs is better placed in the procfs library. Also collect the state, physical state, and the rate.