Skip to content

Commit

Permalink
refactor metrics middlware
Browse files Browse the repository at this point in the history
  • Loading branch information
olexsmir committed Oct 5, 2024
1 parent a1eb12a commit 216b70b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/transport/http/apiv1/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ func (a *APIV1) metricsMiddleware(c *gin.Context) {
c.Next()
latency := time.Since(start)

metrics.RecordLatencyRequestMetric(c.Request.Method, c.Request.RequestURI, latency)

if c.Writer.Status() >= 200 && c.Writer.Status() < 300 {
metrics.RecordSuccessfulRequestMetric(c.Request.Method, c.Request.RequestURI)
}

if c.Writer.Status() >= 400 {
metrics.RecordFailedRequestMetric(c.Request.Method, c.Request.RequestURI)
}

metrics.RecordLatencyRequestMetric(c.Request.Method, c.Request.RequestURI, latency)
}

//nolint:unused // TODO: remove me later
Expand Down

0 comments on commit 216b70b

Please sign in to comment.