Skip to content

Commit

Permalink
exporter/prometheusremotewriterexporter: close HTTP response body (op…
Browse files Browse the repository at this point in the history
…en-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
  • Loading branch information
odeke-em authored Apr 1, 2021
1 parent 6fc26c3 commit a08a650
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions exporter/prometheusremotewriteexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ func (prwe *PrwExporter) execute(ctx context.Context, writeReq *prompb.WriteRequ
if err != nil {
return consumererror.Permanent(err)
}
defer resp.Body.Close()

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

0 comments on commit a08a650

Please sign in to comment.