prometheus

This commit is contained in:
wangchuxiao
2022-09-15 16:27:36 +08:00
parent 7f1acb4532
commit 02fa9142fe
14 changed files with 93 additions and 13 deletions
+7 -1
View File
@@ -17,6 +17,8 @@ import (
"strconv"
"strings"
grpcPrometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"Open_IM/pkg/common/config"
"google.golang.org/grpc"
@@ -128,7 +130,11 @@ func (rpc *rpcAuth) Run() {
promePkg.NewGrpcRequestSuccessCounter()
promePkg.NewUserRegisterCounter()
promePkg.NewUserLoginCounter()
grpcOpts = append(grpcOpts, grpc.UnaryInterceptor(promePkg.UnaryServerInterceptorProme))
grpcOpts = append(grpcOpts, []grpc.ServerOption{
grpc.UnaryInterceptor(promePkg.UnaryServerInterceptorProme),
grpc.StreamInterceptor(grpcPrometheus.StreamServerInterceptor),
grpc.UnaryInterceptor(grpcPrometheus.UnaryServerInterceptor),
}...)
}
srv := grpc.NewServer(grpcOpts...)
defer srv.GracefulStop()