Skip to content

Conversation

@BarbarossaTM
Copy link
Contributor

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 😁

@BarbarossaTM
Copy link
Contributor Author

@SuperQ What do you think? :-)

return res, err
}

func (e *EthtoolFixture) GetChannels(intf string) (ethtool.Channels, error) {
Copy link
Member

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

Copy link
Contributor Author

@BarbarossaTM BarbarossaTM Jan 14, 2026

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?

Copy link
Member

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.

}

channels, err := c.ethtool.GetChannels(device)
if err == nil {
Copy link
Member

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.

Copy link
Contributor Author

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>
@BarbarossaTM
Copy link
Contributor Author

Hm, is the FreeBSD test broken somehow?

ld-elf.so.1: /usr/local/lib/libpcre2-8.so.0: version PCRE2_10.47 required by /usr/local/bin/git not defined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants