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

*: use persistent HTTP clients #1904

Merged
merged 1 commit into from
Jun 7, 2019

Conversation

simonpasquier
Copy link
Member

Currently every time an HTTP-based integration notifies something, it creates a new HTTP client and the connection is only closed after 5 minutes (idle connection time-out). Although usually there aren't thousands of notification requests during such interval, it consumes unnecessary resources.

config.NewClientFromConfig() from github.com/prometheus/common detects whenever the configuration on disk (eg certificates, tokens) has changed so re-using the same client instead of creating one per request should be transparent. It also means that an invalid configuration (eg non-existing certificate) will be detected during the loading of the configuration instead of during the first notification.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Copy link
Contributor

@stuartnelson3 stuartnelson3 left a comment

Choose a reason for hiding this comment

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

awesome change 💯

@simonpasquier simonpasquier merged commit 2abd78c into prometheus:master Jun 7, 2019
@simonpasquier simonpasquier deleted the reuse-http-clients branch June 7, 2019 10:32
DuskEagle pushed a commit to DuskEagle/alertmanager that referenced this pull request Aug 1, 2019
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants