mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
/metric exposes Promethus compatible data for scraping metrics Fixes: #5723
This commit is contained in:
committed by
Harshavardhana
parent
9f31da5d57
commit
9ebb72aa99
@@ -21,6 +21,8 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
|
||||
"go.uber.org/atomic"
|
||||
)
|
||||
|
||||
@@ -188,6 +190,10 @@ func (st *HTTPStats) updateStats(r *http.Request, w *httpResponseRecorder, durat
|
||||
st.successDELETEs.Duration.Add(durationSecs)
|
||||
}
|
||||
}
|
||||
// Increment the prometheus http request count with appropriate label
|
||||
httpRequests.With(prometheus.Labels{"request_type": r.Method}).Inc()
|
||||
// Increment the prometheus http request response histogram with appropriate label
|
||||
httpRequestsDuration.With(prometheus.Labels{"request_type": r.Method}).Observe(durationSecs)
|
||||
}
|
||||
|
||||
// Prepare new HTTPStats structure
|
||||
|
||||
Reference in New Issue
Block a user