Skip to content

Commit

Permalink
Merge pull request #16 from cjauvin/add-url-label-to-request-counter
Browse files Browse the repository at this point in the history
Add url label to request counter
  • Loading branch information
zsais authored Oct 20, 2017
2 parents bdee3a8 + 577b7fb commit a3f957d
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 a3f957d

Please sign in to comment.