We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c02ac93 commit 96246b9Copy full SHA for 96246b9
routers/common/middleware.go
@@ -173,10 +173,8 @@ func RouteMetrics() func(h http.Handler) http.Handler {
173
code := strconv.Itoa(m.WrittenStatus())
174
reqDurationHistogram.WithLabelValues(req.Method, code, route).Observe(time.Since(start).Seconds())
175
respSizeHistogram.WithLabelValues(req.Method, code, route).Observe(float64(m.WrittenSize()))
176
- size := req.ContentLength
177
- if size < 0 {
178
- size = 0
179
- }
+
+ size := max(req.ContentLength, 0)
180
reqSizeHistogram.WithLabelValues(req.Method, code, route).Observe(float64(size))
181
})
182
}
0 commit comments