mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix instrumentation panic if there is no response (#27567)
This commit is contained in:
parent
7f6e979056
commit
f529223455
@ -84,9 +84,9 @@ func instrumentRoundtrip(datasourceName string, next http.RoundTripper) promhttp
|
|||||||
promhttp.InstrumentRoundTripperInFlight(requestInFlight, next))).
|
promhttp.InstrumentRoundTripperInFlight(requestInFlight, next))).
|
||||||
RoundTrip(r)
|
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
|
// 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))
|
responseSizeSummary.Observe(float64(res.ContentLength))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user