-
Notifications
You must be signed in to change notification settings - Fork 323
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
Add support for InfiniBand #164
Conversation
dd36224
to
6431c84
Compare
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.
Overall LGTM, just a few nits in-line.
Also, I think usually it's preferred to have the parseThing functions take either a string or an io.Reader with the content to be parsed instead of passing a filename. @mdlayher WDYT?
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.
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. |
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.
LGTM
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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.