Add prometheus metric requests_total with headers
Co-authored-by: Julien Salleyron <julien.salleyron@gmail.com>
This commit is contained in:
parent
4bc2305ed3
commit
c823879097
20 changed files with 295 additions and 90 deletions
|
@ -30,7 +30,7 @@ const (
|
|||
|
||||
type metricsMiddleware struct {
|
||||
next http.Handler
|
||||
reqsCounter gokitmetrics.Counter
|
||||
reqsCounter metrics.CounterWithHeaders
|
||||
reqsTLSCounter gokitmetrics.Counter
|
||||
reqDurationHistogram metrics.ScalableHistogram
|
||||
openConnsGauge gokitmetrics.Gauge
|
||||
|
@ -147,7 +147,7 @@ func (m *metricsMiddleware) ServeHTTP(rw http.ResponseWriter, req *http.Request)
|
|||
|
||||
labels = append(labels, "code", strconv.Itoa(capt.StatusCode()))
|
||||
m.reqDurationHistogram.With(labels...).ObserveFromStart(start)
|
||||
m.reqsCounter.With(labels...).Add(1)
|
||||
m.reqsCounter.With(req.Header, labels...).Add(1)
|
||||
m.respsBytesCounter.With(labels...).Add(float64(capt.ResponseSize()))
|
||||
m.reqsBytesCounter.With(labels...).Add(float64(capt.RequestSize()))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue