diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 6b8b14664..f63ce6cd6 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -25,6 +25,7 @@ https://github.com/elastic/apm-agent-go/compare/v1.7.2...master[View commits] - Add "recording" config option, to dynamically disable event recording {pull}737[(#737)] - Enable central configuration of "stack_frames_min_duration" and "stack_trace_limit" {pull}742[(#742)] +- Implement "CloseIdleConnections" on the Elasticsearch RoundTripper {pull}750[(#750)] [[release-notes-1.x]] === Go Agent version 1.x diff --git a/module/apmelasticsearch/client.go b/module/apmelasticsearch/client.go index 9222c732e..9e45ae66b 100644 --- a/module/apmelasticsearch/client.go +++ b/module/apmelasticsearch/client.go @@ -99,6 +99,16 @@ func (r *roundTripper) RoundTrip(req *http.Request) (*http.Response, error) { return resp, err } +// CloseIdleConnections calls r.r.CloseIdleConnections if the method exists. +func (r *roundTripper) CloseIdleConnections() { + type closeIdler interface { + CloseIdleConnections() + } + if tr, ok := r.r.(closeIdler); ok { + tr.CloseIdleConnections() + } +} + type responseBody struct { span *apm.Span body io.ReadCloser