-
Notifications
You must be signed in to change notification settings - Fork 2.6k
collector/ethtool: Expose NIC channel configuration #3514
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?
Conversation
|
@SuperQ What do you think? :-) |
| return res, err | ||
| } | ||
|
|
||
| func (e *EthtoolFixture) GetChannels(intf string) (ethtool.Channels, error) { |
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.
The ethtool library already implements this. Please use it.
https://pkg.go.dev/github.com/safchain/ethtool#Ethtool.GetChannels
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.
Thanks for the review!
For querying the actual values, I'm using this, but I'm not sure how I should use that for the mock? There I adopted the existing approach also used to mock the other Ethtool methods.
Do you want me to rework the mock part? If so, could you please elaborate on what you have in mind?
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.
Ahh, sorry, I misunderstood the use here. I didn't realize that we had a complex mock test setup for this collector.
I'm not sure how useful this is, as it's not really mocking the syscalls that the real library does. I need to look over the ethtool_linux_test.go again, but it looks like it's not really a good way to test this.
collector/ethtool_linux.go
Outdated
| } | ||
|
|
||
| channels, err := c.ethtool.GetChannels(device) | ||
| if err == nil { |
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.
I'd suggest moving this to a function, then check for the error first and return early.
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.
Sure thing, like this?
When running a large fleet of machines running network-heavy loads and with different hardware configurations, it is important to get an overview about their configuration. Ethtool exporter already exposes a lot of useful info like port configuration, driver, and obviously stats, however did not expose the channel configuration. This commit adds two new metrics exposing the current and maximum supported channel configuration, with each metric exposing one instance for combined, other, rx, and tx. Signed-off-by: Maximilian Wilhelm <maximilian.wilhelm@hetzner-cloud.de>
d0555fb to
6084d55
Compare
|
Hm, is the FreeBSD test broken somehow? |
When running a large fleet of machines running network-heavy loads and with different hardware configurations, it is important to get an overview about their configuration. Ethtool exporter already exposes a lot of useful info like port configuration, driver, and obviously stats, however did not expose the channel configuration.
This commit adds two new metrics exposing the current and maximum supported channel configuration, with each metric exposing one instance for combined, other, rx, and tx.
I'd consider this a fairly trivial improvement, so directly opening a PR, hope that's OK 😁