Skip to content
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

feat(inputs.net): Add speed metric #14625

Merged
merged 4 commits into from Jan 29, 2024
Merged

Conversation

DStrand1
Copy link
Contributor

Summary

Adds a speed metric, reading /sys/class/net/*/speed as documented here in the kernel documentation. Currently only implemented for Linux. There is a PR to gopsutil, shirou/gopsutil#1473, which implements this metric as part of its interface and supports more platforms, but we decided to move forward with implementing this ourselves for the time being.

Checklist

  • No AI generated code was used in this PR

Related issues

resolves #4658

@DStrand1 DStrand1 requested a review from powersj January 24, 2024 20:33
@telegraf-tiger telegraf-tiger bot added feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Jan 24, 2024
Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick PR! Question about the -1.

plugins/inputs/net/net.go Outdated Show resolved Hide resolved
@powersj powersj self-assigned this Jan 24, 2024
Copy link
Contributor

@Hipska Hipska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree to have a test for the -1 value.

Also, wouldn't it be better to already be on-par with the upstream gopsutil and have a separate field for in and out? Like speed_in and speed_out? (Seems to be only supported by Windows to have different values)

@powersj
Copy link
Contributor

powersj commented Jan 25, 2024

Also, wouldn't it be better to already be on-par with the upstream gopsutil and have a separate field for in and out? Like speed_in and speed_out? (Seems to be only supported by Windows to have different values)

The net plugin only supports linux. If someone eventually gets gopsutil support enabled for other distros, then that could be re-evaluted down the road for Windows users.

@DStrand1 DStrand1 requested a review from powersj January 25, 2024 20:27
plugins/inputs/net/net.go Outdated Show resolved Hide resolved
@powersj powersj added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Jan 25, 2024
@powersj powersj assigned srebhan and unassigned powersj Jan 25, 2024
@telegraf-tiger
Copy link
Contributor

@Hipska
Copy link
Contributor

Hipska commented Jan 26, 2024

The net plugin only supports linux.

Oh sorry, didn’t check that. Never mind my remark then.

Copy link
Contributor

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DStrand1 thanks for the clean PR! Just one question about the return value...

plugins/inputs/net/net.go Show resolved Hide resolved
@srebhan srebhan merged commit 1e3597d into influxdata:master Jan 29, 2024
25 of 26 checks passed
@github-actions github-actions bot added this to the v1.30.0 milestone Jan 29, 2024
@DStrand1 DStrand1 deleted the fix/4658 branch January 29, 2024 20:27
hhiroshell pushed a commit to hhiroshell/telegraf that referenced this pull request Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Report interface speed in net module
4 participants