diff --git a/rest/handler/prometheushandler.go b/rest/handler/prometheushandler.go index 742ec18c3137..629cb5494e63 100644 --- a/rest/handler/prometheushandler.go +++ b/rest/handler/prometheushandler.go @@ -13,7 +13,7 @@ import ( const serverNamespace = "http_server" var ( - rpcServerReqDurBuckets = []float64{5, 10, 25, 50, 100, 250, 500, 750, 1000} + serverReqDurBuckets = []float64{5, 10, 25, 50, 100, 250, 500, 750, 1000} metricServerReqDurOnce sync.Once metricServerReqDur metric.HistogramVec @@ -30,7 +30,7 @@ var ( // SetServerReqDurBuckets sets buckets for rest server requests duration. // It must be called before PrometheusHandler is used. func SetServerReqDurBuckets(buckets []float64) { - rpcServerReqDurBuckets = buckets + serverReqDurBuckets = buckets } // PrometheusHandler returns a middleware that reports stats to prometheus. @@ -60,7 +60,7 @@ func initMetricServerReqDur() { Name: "duration_ms", Help: "http server requests duration(ms).", Labels: []string{"path", "method", "code"}, - Buckets: rpcServerReqDurBuckets, + Buckets: serverReqDurBuckets, }) }) } diff --git a/rest/handler/prometheushandler_test.go b/rest/handler/prometheushandler_test.go index df5cd376c39a..29bf5f32182b 100644 --- a/rest/handler/prometheushandler_test.go +++ b/rest/handler/prometheushandler_test.go @@ -39,5 +39,5 @@ func TestPromMetricHandler_Enabled(t *testing.T) { func TestSetRpcServerReqDurBuckets(t *testing.T) { SetServerReqDurBuckets([]float64{0.1}) - assert.Equal(t, []float64{0.1}, rpcServerReqDurBuckets) + assert.Equal(t, []float64{0.1}, serverReqDurBuckets) }