You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@WZH8898 to be honest I don't like the approach too much as it has too many assumptions. How about rather than trying to guess ask the user to use the deadline configuration option instead as this is what is used already? I.e. if you see timeout to be set with the native method, you should error out (or warn) in Init() that this parameter is not used for the method and what to do instead. Maybe also add some documentation to the README?
@WZH8898 to be honest I don't like the approach too much as it has too many assumptions. How about rather than trying to guess ask the user to use the deadline configuration option instead as this is what is used already? I.e. if you see timeout to be set with the native method, you should error out (or warn) in Init() that this parameter is not used for the method and what to do instead. Maybe also add some documentation to the README?
Thanks for the suggestion! I've updated the implementation to warn when timeout is used with the native method and documented the behavior in the README.
Please let me know if further adjustments are needed.
The reason will be displayed to describe this comment to others. Learn more.
Log always is non-nil at runtime. If you see a panic here it's because the tests do not define Log which is a bug and should be fixed by setting the logger in the test!
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
## If set, the total ping deadline, in seconds. Operates like the "-w"
## option of the ping command. Use this option to control timeout behavior
## when using the "native" method.
## If set, the total ping deadline, in seconds. Operates like the "-w"
## option of the ping command. Use this option to control timeout behavior
## when using the "native" method.
srebhan
changed the title
fix(inputs.ping): honor timeout parameter for native method
fix(inputs.ping): Warn on using timeout parameter for native method
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
area/pingfixpr to fix corresponding bugplugin/input1. Request for new input plugins 2. Issues/PRs that are related to input plugins
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix issue where the
timeoutparameter was ignored when usingmethod = "native".The native pinger uses a global timeout, so this change computes an effective
runtime timeout based on:
The computed timeout is also capped by the configured
deadline.Unit tests have been added for the timeout calculation.
Checklist
Related issues
resolves #18395