Skip to content

Commit

Permalink
Merge pull request #750 from pebrc/fix-apm-roundtripper
Browse files Browse the repository at this point in the history
Implement CloseIdleConnections on apmelasticsearch
  • Loading branch information
axw committed Apr 21, 2020
2 parents 839d3cc + f54bd30 commit eea0ff3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions module/apmelasticsearch/client.go
Expand Up @@ -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
Expand Down

0 comments on commit eea0ff3

Please sign in to comment.