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: Add caching to internet_speed #10530

Merged
merged 14 commits into from
Feb 1, 2022
Merged

feat: Add caching to internet_speed #10530

merged 14 commits into from
Feb 1, 2022

Conversation

Jleagle
Copy link
Contributor

@Jleagle Jleagle commented Jan 26, 2022

Required for all PRs:

This PR adds two config options, offset & cache.

Offset is to help spread the calls to the speedtest server, this also reduces errors that seem to happen at specific times like on the hour, presumably where everyone does a test at the same time.

Cache caches the closest speedtest server, there doesn't seem to be much point in querying all the servers to get the closest one when it's going to be the same every time.

They both default to false to help with backwards compatibility.

@telegraf-tiger
Copy link
Contributor

Thanks so much for the pull request!
🤝 ✒️ Just a reminder that the CLA has not yet been signed, and we'll need it before merging. Please sign the CLA when you get a chance, then post a comment here saying !signed-cla

@telegraf-tiger telegraf-tiger bot added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label Jan 26, 2022
@Jleagle
Copy link
Contributor Author

Jleagle commented Jan 26, 2022

!signed-cla

@Jleagle Jleagle marked this pull request as ready for review January 27, 2022 10:23
Copy link
Member

@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.

Thanks for this PR @Jleagle. I have some comments in the code. However, there is a more general comment regarding the offset. I think this should be a Telegraf-wide option to allow an offset to the rounded gather interval globally and plugin-wise. So I'm setting the corresponding tag to make Influx people take a look.

plugins/inputs/internet_speed/README.md Outdated Show resolved Hide resolved
plugins/inputs/internet_speed/internet_speed.go Outdated Show resolved Hide resolved
plugins/inputs/internet_speed/internet_speed.go Outdated Show resolved Hide resolved
plugins/inputs/internet_speed/internet_speed.go Outdated Show resolved Hide resolved
plugins/inputs/internet_speed/internet_speed.go Outdated Show resolved Hide resolved
plugins/inputs/internet_speed/internet_speed.go Outdated Show resolved Hide resolved
plugins/inputs/internet_speed/internet_speed.go Outdated Show resolved Hide resolved
plugins/inputs/internet_speed/internet_speed_test.go Outdated Show resolved Hide resolved
plugins/inputs/internet_speed/internet_speed_test.go Outdated Show resolved Hide resolved
@srebhan srebhan self-assigned this Jan 27, 2022
@srebhan srebhan added needs design review plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Jan 27, 2022
@srebhan
Copy link
Member

srebhan commented Jan 27, 2022

The corresponding issue is #10406 and #1319.

Jleagle and others added 8 commits January 27, 2022 13:26
Co-authored-by: Sven Rebhan <36194019+srebhan@users.noreply.github.com>
Co-authored-by: Sven Rebhan <36194019+srebhan@users.noreply.github.com>
Co-authored-by: Sven Rebhan <36194019+srebhan@users.noreply.github.com>
Co-authored-by: Sven Rebhan <36194019+srebhan@users.noreply.github.com>
@srebhan
Copy link
Member

srebhan commented Jan 30, 2022

@Jleagle can you maybe check if you can get rid of the offset parameter in your PR when rebasing on #10545 and using collection_offset!?

Copy link
Member

@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.

Very nice @Jleagle. There is only one offset left-over in the readme, but other than that we are fine to go I think.
Just one more request: If the collection_offset worked for you, please drop a note in the corresponding PR. Thanks for your effort!

plugins/inputs/internet_speed/README.md Outdated Show resolved Hide resolved
@Jleagle Jleagle changed the title feat: Add time offset and caching to internet_speed feat: Add caching to internet_speed Feb 1, 2022
Copy link
Member

@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.

Looks good to me. Thanks @Jleagle for your contribution!

@srebhan srebhan 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 Feb 1, 2022
@sspaink sspaink merged commit 85ee825 into influxdata:master Feb 1, 2022
@Hipska
Copy link
Contributor

Hipska commented May 20, 2022

I'm a bit late to the party, but now the selected server is used for the whole duration of telegraf run. I can imagine after a few days that server is not available and another one should be picked.

Could someone implement server re-election and/or cache expiry (Duration)?

@srebhan
Copy link
Member

srebhan commented May 20, 2022

I think re-electing the server on error is a valid point.

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.

5 participants