config path

This commit is contained in:
wangchuxiao 2023-02-23 19:44:22 +08:00
parent b41a0a66ef
commit 9f8833baa1

View File

@ -6,7 +6,7 @@ import (
"OpenIM/pkg/common/constant" "OpenIM/pkg/common/constant"
"OpenIM/pkg/common/log" "OpenIM/pkg/common/log"
"OpenIM/pkg/common/middleware" "OpenIM/pkg/common/middleware"
promePkg "OpenIM/pkg/common/prome" "OpenIM/pkg/common/prome"
"flag" "flag"
"fmt" "fmt"
"github.com/OpenIMSDK/openKeeper" "github.com/OpenIMSDK/openKeeper"
@ -39,11 +39,11 @@ func start(rpcPorts []int, rpcRegisterName string, prometheusPorts []int, rpcFn
} }
options = append(options, grpc.UnaryInterceptor(middleware.RpcServerInterceptor)) // ctx 中间件 options = append(options, grpc.UnaryInterceptor(middleware.RpcServerInterceptor)) // ctx 中间件
if config.Config.Prometheus.Enable { if config.Config.Prometheus.Enable {
promePkg.NewGrpcRequestCounter() prome.NewGrpcRequestCounter()
promePkg.NewGrpcRequestFailedCounter() prome.NewGrpcRequestFailedCounter()
promePkg.NewGrpcRequestSuccessCounter() prome.NewGrpcRequestSuccessCounter()
options = append(options, []grpc.ServerOption{ options = append(options, []grpc.ServerOption{
// grpc.UnaryInterceptor(promePkg.UnaryServerInterceptorProme), grpc.UnaryInterceptor(prome.UnaryServerInterceptorPrometheus),
grpc.StreamInterceptor(grpcPrometheus.StreamServerInterceptor), grpc.StreamInterceptor(grpcPrometheus.StreamServerInterceptor),
grpc.UnaryInterceptor(grpcPrometheus.UnaryServerInterceptor), grpc.UnaryInterceptor(grpcPrometheus.UnaryServerInterceptor),
}...) }...)
@ -55,7 +55,7 @@ func start(rpcPorts []int, rpcRegisterName string, prometheusPorts []int, rpcFn
return err return err
} }
if config.Config.Prometheus.Enable { if config.Config.Prometheus.Enable {
err := promePkg.StartPromeSrv(*flagPrometheusPort) err := prome.StartPromeSrv(*flagPrometheusPort)
if err != nil { if err != nil {
return err return err
} }