Skip to content

Commit

Permalink
Merge pull request #22 from zemzale/add-host
Browse files Browse the repository at this point in the history
Add host label to request duration counter
  • Loading branch information
depado authored May 17, 2021
2 parents 79ebc57 + 9fd5e99 commit fc7f3eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions prom.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ func (p *Prometheus) register() {
Buckets: p.BucketsSize,
Name: p.RequestDurationMetricName,
Help: "The HTTP request latency bucket.",
}, []string{"method", "path"})
}, []string{"method", "path", "host"})
registerer.MustRegister(p.reqDur)

p.reqSz = prometheus.NewSummary(
Expand Down Expand Up @@ -327,7 +327,7 @@ func (p *Prometheus) Instrument() gin.HandlerFunc {
resSz := float64(c.Writer.Size())

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

0 comments on commit fc7f3eb

Please sign in to comment.