Skip to content

Commit

Permalink
Add url label to request counter
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Jauvin committed Oct 18, 2017
1 parent bdee3a8 commit 577b7fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (p *Prometheus) registerMetrics(subsystem string) {
Name: "requests_total",
Help: "How many HTTP requests processed, partitioned by status code and HTTP method.",
},
[]string{"code", "method", "handler", "host"},
[]string{"code", "method", "handler", "host", "url"},
)

if err := prometheus.Register(p.reqCnt); err != nil {
Expand Down Expand Up @@ -232,7 +232,7 @@ func (p *Prometheus) handlerFunc() gin.HandlerFunc {
resSz := float64(c.Writer.Size())

p.reqDur.Observe(elapsed)
p.reqCnt.WithLabelValues(status, c.Request.Method, c.HandlerName(), c.Request.Host).Inc()
p.reqCnt.WithLabelValues(status, c.Request.Method, c.HandlerName(), c.Request.Host, c.Request.URL.String()).Inc()
p.reqSz.Observe(float64(reqSz))
p.resSz.Observe(resSz)
}
Expand Down

0 comments on commit 577b7fb

Please sign in to comment.