Skip to content

Commit

Permalink
make Prometheus middleware identical to Kratos analogue
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbonnell committed Jan 25, 2021
1 parent 10b5d59 commit a7c13b4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions metrics/prometheus/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ func NewMetricsManager(version, hash, buildTime string) *MetricsManager {
// Response time metric
// pmm.prometheusMetrics.ResponseTime.WithLabelValues(r.URL.Path).Observe(time.Since(start).Seconds())
func (pmm *MetricsManager) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
start := time.Now()
next(rw, r)

pmm.prometheusMetrics.ResponseTime.WithLabelValues(r.URL.Path).Observe(time.Since(start).Seconds())
}

0 comments on commit a7c13b4

Please sign in to comment.