This repository was archived by the owner on Jan 16, 2026. It is now read-only.
feat: add an option to set the http.Client for the Sender#171
Merged
LukeWinikates merged 1 commit intomainfrom Oct 18, 2023
Merged
feat: add an option to set the http.Client for the Sender#171LukeWinikates merged 1 commit intomainfrom
LukeWinikates merged 1 commit intomainfrom
Conversation
d6d3584 to
4a32f84
Compare
jbooherl
approved these changes
Oct 17, 2023
jbooherl
left a comment
There was a problem hiding this comment.
I agree with the changes made. Was going to make very similar comments to how you changed things!
aa67ed8 to
7790804
Compare
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
related to influxdata/telegraf#14090
This PR introduces a new
Option,HTTPClient, allowing users to override the*http.Clientused by theSender.This allows a variety of customization options, such as proxy settings, idle connection management, and TLS Options. It is intended to integrate well with Telegraf's http config, which can generate an
http.Clientfrom a standardtomlconfiguration (https://github.com/influxdata/telegraf/blob/master/plugins/common/http/config.go)This PR
reimplements the existingeliminates the internalTimeoutandTLSConfigoptions in terms ofconfiguration.HTTPClient, andNewClientfactory.feedback request: the PR logs a warning if you try to use more than one ofTimeout,TLSConfig, andHTTPClientfor the sameSender, because subsequent calls will clobber the first call. Curious if anyone thinks this should work differently.I had a change of heart about my initial solution to mixing
Timeout,TLSConfig, andHTTPClient. I just pushed a second commit with a different solution. This allowsTimeoutandTLSConfigto be used together, but prints a warning if either are used afterHTTPClient. The intended logic now is that if you set an HTTPClient, theSenderwill just use that, but you can alternatively provide either, both, or neither ofTimeoutandTLSConfigOptionsas easier shorthand methods for changing those two settings. In that case, we'll make anhttp.Clientfor you.