mirror of
https://github.com/minio/minio.git
synced 2025-01-11 23:13:23 -05:00
Capture ttfb api metrics only for GetObject (#19733)
as that is the only API where the TTFB metric is beneficial, and capturing this for all APIs exponentially increases the response size in large clusters.
This commit is contained in:
parent
d4b391de1b
commit
0e59e50b39
@ -27,6 +27,10 @@ import (
|
|||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
apiGetObject = "GetObject"
|
||||||
|
)
|
||||||
|
|
||||||
// connStats - Network statistics
|
// connStats - Network statistics
|
||||||
// Count total input/output transferred bytes during
|
// Count total input/output transferred bytes during
|
||||||
// the server's life.
|
// the server's life.
|
||||||
@ -128,7 +132,7 @@ func (bh *bucketHTTPStats) updateHTTPStats(bucket, api string, w *xhttp.Response
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if w != nil {
|
if w != nil && api == apiGetObject {
|
||||||
// Increment the prometheus http request response histogram with API, Bucket
|
// Increment the prometheus http request response histogram with API, Bucket
|
||||||
bucketHTTPRequestsDuration.With(prometheus.Labels{
|
bucketHTTPRequestsDuration.With(prometheus.Labels{
|
||||||
"api": api,
|
"api": api,
|
||||||
@ -433,7 +437,9 @@ func (st *HTTPStats) updateStats(api string, w *xhttp.ResponseRecorder) {
|
|||||||
st.totalS3Requests.Inc(api)
|
st.totalS3Requests.Inc(api)
|
||||||
|
|
||||||
// Increment the prometheus http request response histogram with appropriate label
|
// Increment the prometheus http request response histogram with appropriate label
|
||||||
httpRequestsDuration.With(prometheus.Labels{"api": api}).Observe(w.TimeToFirstByte.Seconds())
|
if api == apiGetObject {
|
||||||
|
httpRequestsDuration.With(prometheus.Labels{"api": api}).Observe(w.TimeToFirstByte.Seconds())
|
||||||
|
}
|
||||||
|
|
||||||
code := w.StatusCode
|
code := w.StatusCode
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user