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

[receiver/snmpreceiver] make timeout configureable #26070

Merged

Conversation

technimad-splunk
Copy link
Contributor

Description:
The timeout of snmp requests was hard coded to 5 seconds. This commit adds timeout to the configuration of this receiver. The timeout can now be set using the timeout key at the higest level in the configuration. The default is left at 5 seconds.

Link to tracking Issue:
#25885

Testing:
Updated TestNewFactory method to reflect new default config.
Ran receiver against devices demanding a high timeout. During testing added extra logging statements to check if timeout setting was propagated correctly to the underlying SNMP library and if it was reflected in the SNMP commands executed. Tests succeeded. Removed extra logging statements as we shouldn't create a log per datapoint received in production.

Documentation:
Added the new config option timeout to README.

The timeout of snmp requests was hard coded to 5 seconds.
This commit adds timeout to the configuration of this receiver.
The timeout can now be set using the timeout key at the higest level in the configuration.
The default is left at 5 seconds.
@technimad-splunk technimad-splunk requested a review from a team August 23, 2023 09:43
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Aug 23, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@@ -76,6 +77,10 @@ type Config struct {
// If no port is given, 161 is assumed.
Endpoint string `mapstructure:"endpoint"`

// Timeout for each SNMP request.
// Default: 5 seconds
Timeout time.Duration `mapstructure:"timeout"`
Copy link
Member

Choose a reason for hiding this comment

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

ScraperControllerSettings already has Timeout option for this purposes, let's reuse it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've moved the Timeout setting to ScraperControllerSettings.

@dmitryax dmitryax merged commit 164696c into open-telemetry:main Aug 28, 2023
@github-actions github-actions bot added this to the next release milestone Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants