From ec638920de40af8512e0051fd92faac0b179451d Mon Sep 17 00:00:00 2001 From: Andrew Dewar Date: Fri, 3 Nov 2023 10:59:44 -0600 Subject: [PATCH] fix defer linting error --- pkg/middleware/metrics.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/middleware/metrics.go b/pkg/middleware/metrics.go index 9117336d8..b440fe70b 100644 --- a/pkg/middleware/metrics.go +++ b/pkg/middleware/metrics.go @@ -56,8 +56,9 @@ func MetricsMiddlewareWithConfig(config *MetricsConfig) echo.MiddlewareFunc { method := ctx.Request().Method path := MatchedRoute(ctx) err := next(ctx) + timeStart := time.Since(start) status := mapStatus(ctx.Response().Status) - defer config.Metrics.HttpStatusHistogram.WithLabelValues(status, method, path).Observe(time.Since(start).Seconds()) + defer config.Metrics.HttpStatusHistogram.WithLabelValues(status, method, path).Observe(timeStart.Seconds()) return err } }