diff --git a/rest/engine.go b/rest/engine.go index 1ae37ec6..d2e55f93 100644 --- a/rest/engine.go +++ b/rest/engine.go @@ -110,7 +110,7 @@ func (s *engine) bindRoute(fr featuredRoutes, router httpx.Router, metrics *stat handler.TimeoutHandler(time.Duration(s.conf.Timeout)*time.Millisecond), handler.RecoverHandler, handler.MetricHandler(metrics), - handler.PrometheousHandler(route.Path), + handler.PromethousHandler(route.Path), handler.MaxBytesHandler(s.conf.MaxBytes), handler.GunzipHandler, ) diff --git a/rest/handler/prometheoushandler.go b/rest/handler/prometheushandler.go similarity index 94% rename from rest/handler/prometheoushandler.go rename to rest/handler/prometheushandler.go index 17ef1a80..98253257 100644 --- a/rest/handler/prometheoushandler.go +++ b/rest/handler/prometheushandler.go @@ -31,7 +31,7 @@ var ( }) ) -func PrometheousHandler(path string) func(http.Handler) http.Handler { +func PromethousHandler(path string) func(http.Handler) http.Handler { return func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { startTime := timex.Now() diff --git a/rest/handler/prometheoushandler_test.go b/rest/handler/prometheushandler_test.go similarity index 89% rename from rest/handler/prometheoushandler_test.go rename to rest/handler/prometheushandler_test.go index 39bb11c0..7201363b 100644 --- a/rest/handler/prometheoushandler_test.go +++ b/rest/handler/prometheushandler_test.go @@ -9,7 +9,7 @@ import ( ) func TestPromMetricHandler(t *testing.T) { - promMetricHandler := PrometheousHandler("/user/login") + promMetricHandler := PromethousHandler("/user/login") handler := promMetricHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) })) diff --git a/zrpc/internal/client.go b/zrpc/internal/client.go index f0b48467..53addf18 100644 --- a/zrpc/internal/client.go +++ b/zrpc/internal/client.go @@ -74,7 +74,7 @@ func buildDialOptions(opts ...ClientOption) []grpc.DialOption { clientinterceptors.TracingInterceptor, clientinterceptors.DurationInterceptor, clientinterceptors.BreakerInterceptor, - clientinterceptors.PrometheousInterceptor, + clientinterceptors.PrometheusInterceptor, clientinterceptors.TimeoutInterceptor(clientOptions.Timeout), ), } diff --git a/zrpc/internal/clientinterceptors/prometheousinterceptor.go b/zrpc/internal/clientinterceptors/prometheusinterceptor.go similarity index 92% rename from zrpc/internal/clientinterceptors/prometheousinterceptor.go rename to zrpc/internal/clientinterceptors/prometheusinterceptor.go index cab6946f..a330410c 100644 --- a/zrpc/internal/clientinterceptors/prometheousinterceptor.go +++ b/zrpc/internal/clientinterceptors/prometheusinterceptor.go @@ -32,7 +32,7 @@ var ( }) ) -func PrometheousInterceptor(ctx context.Context, method string, req, reply interface{}, +func PrometheusInterceptor(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { startTime := timex.Now() err := invoker(ctx, method, req, reply, cc, opts...) diff --git a/zrpc/internal/clientinterceptors/prometheousinterceptor_test.go b/zrpc/internal/clientinterceptors/prometheusinterceptor_test.go similarity index 89% rename from zrpc/internal/clientinterceptors/prometheousinterceptor_test.go rename to zrpc/internal/clientinterceptors/prometheusinterceptor_test.go index 2ebc7b31..c7bdb237 100644 --- a/zrpc/internal/clientinterceptors/prometheousinterceptor_test.go +++ b/zrpc/internal/clientinterceptors/prometheusinterceptor_test.go @@ -26,7 +26,7 @@ func TestPromMetricInterceptor(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { cc := new(grpc.ClientConn) - err := PrometheousInterceptor(context.Background(), "/foo", nil, nil, cc, + err := PrometheusInterceptor(context.Background(), "/foo", nil, nil, cc, func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, opts ...grpc.CallOption) error { return test.err diff --git a/zrpc/internal/rpcserver.go b/zrpc/internal/rpcserver.go index efb3cb71..bddec361 100644 --- a/zrpc/internal/rpcserver.go +++ b/zrpc/internal/rpcserver.go @@ -55,7 +55,7 @@ func (s *rpcServer) Start(register RegisterFn) error { serverinterceptors.UnaryTracingInterceptor(s.name), serverinterceptors.UnaryCrashInterceptor(), serverinterceptors.UnaryStatInterceptor(s.metrics), - serverinterceptors.UnaryPrometheousInterceptor(), + serverinterceptors.UnaryPrometheusInterceptor(), } unaryInterceptors = append(unaryInterceptors, s.unaryInterceptors...) streamInterceptors := []grpc.StreamServerInterceptor{ diff --git a/zrpc/internal/serverinterceptors/prometheousinterceptor.go b/zrpc/internal/serverinterceptors/prometheusinterceptor.go similarity index 94% rename from zrpc/internal/serverinterceptors/prometheousinterceptor.go rename to zrpc/internal/serverinterceptors/prometheusinterceptor.go index d9ad90a3..7925fcba 100644 --- a/zrpc/internal/serverinterceptors/prometheousinterceptor.go +++ b/zrpc/internal/serverinterceptors/prometheusinterceptor.go @@ -32,7 +32,7 @@ var ( }) ) -func UnaryPrometheousInterceptor() grpc.UnaryServerInterceptor { +func UnaryPrometheusInterceptor() grpc.UnaryServerInterceptor { return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) ( interface{}, error) { startTime := timex.Now() diff --git a/zrpc/internal/serverinterceptors/prometheousinterceptor_test.go b/zrpc/internal/serverinterceptors/prometheusinterceptor_test.go similarity index 89% rename from zrpc/internal/serverinterceptors/prometheousinterceptor_test.go rename to zrpc/internal/serverinterceptors/prometheusinterceptor_test.go index 14eacb60..9d31f4f9 100644 --- a/zrpc/internal/serverinterceptors/prometheousinterceptor_test.go +++ b/zrpc/internal/serverinterceptors/prometheusinterceptor_test.go @@ -9,7 +9,7 @@ import ( ) func TestUnaryPromMetricInterceptor(t *testing.T) { - interceptor := UnaryPrometheousInterceptor() + interceptor := UnaryPrometheusInterceptor() _, err := interceptor(context.Background(), nil, &grpc.UnaryServerInfo{ FullMethod: "/", }, func(ctx context.Context, req interface{}) (interface{}, error) {