Close connection to scrape target after retrieving data (#39)

This commit is contained in:
Hang Xie 2020-07-07 07:20:20 -07:00 committed by GitHub
parent 46ec972162
commit db8ccea9da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -1,4 +1,4 @@
FROM golang:1.10.0 as builder
FROM golang:1.13.11 as builder
RUN mkdir -p /go/src/github.com/cloudposse/prometheus-to-cloudwatch
WORKDIR /go/src/github.com/cloudposse/prometheus-to-cloudwatch
COPY . .

View File

@ -514,6 +514,7 @@ func fetchMetricFamilies(
}
client := &http.Client{Transport: transport}
decodeContent(client, url, ch)
client.CloseIdleConnections()
}
func decodeContent(client *http.Client, url string, ch chan<- *dto.MetricFamily) {