diff --git a/server/api/metric.go b/server/api/metric.go index 3bfab034cb2..a457895bddf 100644 --- a/server/api/metric.go +++ b/server/api/metric.go @@ -28,7 +28,7 @@ type queryMetric struct { s *server.Server } -func newQueryMetric(s *server.Server) *queryMetric { +func newqueryMetric(s *server.Server) *queryMetric { return &queryMetric{s: s} } diff --git a/server/api/router.go b/server/api/router.go index 85072af134b..0e129706b43 100644 --- a/server/api/router.go +++ b/server/api/router.go @@ -335,8 +335,8 @@ func createRouter(prefix string, svr *server.Server) *mux.Router { registerFunc(apiRouter, "/ping", healthHandler.Ping, setMethods(http.MethodGet), setAuditBackend(prometheus)) // metric query use to query metric data, the protocol is compatible with prometheus. - registerFunc(apiRouter, "/metric/query", newQueryMetric(svr).queryMetric, setMethods(http.MethodGet, http.MethodPost), setAuditBackend(prometheus)) - registerFunc(apiRouter, "/metric/query_range", newQueryMetric(svr).queryMetric, setMethods(http.MethodGet, http.MethodPost), setAuditBackend(prometheus)) + registerFunc(apiRouter, "/metric/query", newqueryMetric(svr).queryMetric, setMethods(http.MethodGet, http.MethodPost), setAuditBackend(prometheus)) + registerFunc(apiRouter, "/metric/query_range", newqueryMetric(svr).queryMetric, setMethods(http.MethodGet, http.MethodPost), setAuditBackend(prometheus)) pprofHandler := newPprofHandler(svr, rd) // profile API diff --git a/server/api/server_test.go b/server/api/server_test.go index 7ebee9bcdfe..af41905ad86 100644 --- a/server/api/server_test.go +++ b/server/api/server_test.go @@ -242,7 +242,7 @@ func (suite *serviceTestSuite) TestServiceLabels() { apiutil.NewAccessPath("/pd/api/v1/leader/resign", "")) re.Equal("", serviceLabel) - accessPaths = suite.svr.GetServiceLabels("QueryMetric") + accessPaths = suite.svr.GetServiceLabels("queryMetric") re.Len(accessPaths, 4) sort.Slice(accessPaths, func(i, j int) bool { if accessPaths[i].Path == accessPaths[j].Path { @@ -260,10 +260,10 @@ func (suite *serviceTestSuite) TestServiceLabels() { re.Equal(http.MethodPost, accessPaths[3].Method) serviceLabel = suite.svr.GetAPIAccessServiceLabel( apiutil.NewAccessPath("/pd/api/v1/metric/query", http.MethodPost)) - re.Equal("QueryMetric", serviceLabel) + re.Equal("queryMetric", serviceLabel) serviceLabel = suite.svr.GetAPIAccessServiceLabel( apiutil.NewAccessPath("/pd/api/v1/metric/query", http.MethodGet)) - re.Equal("QueryMetric", serviceLabel) + re.Equal("queryMetric", serviceLabel) } func (suite *adminTestSuite) TestCleanPath() {