Commit f5292234 by Sofia Papagiannaki Committed by GitHub

Fix instrumentation panic if there is no response (#27567)

parent 7f6e9790
......@@ -84,9 +84,9 @@ func instrumentRoundtrip(datasourceName string, next http.RoundTripper) promhttp
promhttp.InstrumentRoundTripperInFlight(requestInFlight, next))).
RoundTrip(r)
// we avoid measing contentlength less the zero because it indicates
// we avoid measuring contentlength less than zero because it indicates
// that the content size is unknown. https://godoc.org/github.com/badu/http#Response
if res.ContentLength > 0 {
if res != nil && res.ContentLength > 0 {
responseSizeSummary.Observe(float64(res.ContentLength))
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment