0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-07-19 04:11:16 +02:00

modernize

This commit is contained in:
TheFox0x7 2025-07-08 17:26:02 +02:00
parent c02ac93968
commit 96246b93aa
No known key found for this signature in database
GPG Key ID: 6CA33903484AF7C2

View File

@ -173,10 +173,8 @@ func RouteMetrics() func(h http.Handler) http.Handler {
code := strconv.Itoa(m.WrittenStatus())
reqDurationHistogram.WithLabelValues(req.Method, code, route).Observe(time.Since(start).Seconds())
respSizeHistogram.WithLabelValues(req.Method, code, route).Observe(float64(m.WrittenSize()))
size := req.ContentLength
if size < 0 {
size = 0
}
size := max(req.ContentLength, 0)
reqSizeHistogram.WithLabelValues(req.Method, code, route).Observe(float64(size))
})
}