From 00a1c2d20471100873d77bd06362b58a45856e49 Mon Sep 17 00:00:00 2001 From: Xavier Coulon Date: Wed, 20 Nov 2024 11:28:47 +0100 Subject: [PATCH] metrics: measure roundtrips in seconds not in milliseconds, which results in histogram buckets under '1' being always empty Signed-off-by: Xavier Coulon --- pkg/middleware/promhttp_middleware.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/middleware/promhttp_middleware.go b/pkg/middleware/promhttp_middleware.go index 7e681684..aa340b2e 100644 --- a/pkg/middleware/promhttp_middleware.go +++ b/pkg/middleware/promhttp_middleware.go @@ -42,7 +42,7 @@ func InstrumentRoundTripperDuration(histVec *prometheus.HistogramVec) gin.Handle "code": strconv.Itoa(c.Writer.Status()), "method": c.Request.Method, "path": c.Request.URL.Path, - }).Observe(float64(duration.Milliseconds())) + }).Observe(float64(duration.Seconds())) }() c.Next() }