Skip to content

Commit 96246b9

Browse files
committed
modernize
1 parent c02ac93 commit 96246b9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

routers/common/middleware.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,8 @@ func RouteMetrics() func(h http.Handler) http.Handler {
173173
code := strconv.Itoa(m.WrittenStatus())
174174
reqDurationHistogram.WithLabelValues(req.Method, code, route).Observe(time.Since(start).Seconds())
175175
respSizeHistogram.WithLabelValues(req.Method, code, route).Observe(float64(m.WrittenSize()))
176-
size := req.ContentLength
177-
if size < 0 {
178-
size = 0
179-
}
176+
177+
size := max(req.ContentLength, 0)
180178
reqSizeHistogram.WithLabelValues(req.Method, code, route).Observe(float64(size))
181179
})
182180
}

0 commit comments

Comments
 (0)