Skip to content

Commit 85168e6

Browse files
odeke-empjanotti
authored andcommitted
exporter/prometheusremotewriterexporter: close HTTP response body (open-telemetry#2875)
Fixes a leak in HTTP responses after sending protobuf payloads to Amazon's endpoints. This change ensures that connections can be successfully reused, otherwise without invoking .Close() they won't easily be reused. Discovered while investigating for anything that could be averse to scalability of the exporter. Fixes open-telemetry#2874
1 parent 2ff70cf commit 85168e6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

exporter/prometheusremotewriteexporter/exporter.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ func (prwe *PrwExporter) execute(ctx context.Context, writeReq *prompb.WriteRequ
324324
if err != nil {
325325
return consumererror.Permanent(err)
326326
}
327+
defer resp.Body.Close()
327328

328329
// 2xx status code is considered a success
329330
// 5xx errors are recoverable and the exporter should retry

0 commit comments

Comments
 (0)