|
@@ -33,12 +33,12 @@ var (
|
|
)
|
|
)
|
|
|
|
|
|
func UnaryPromMetricInterceptor() grpc.UnaryServerInterceptor {
|
|
func UnaryPromMetricInterceptor() grpc.UnaryServerInterceptor {
|
|
- return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
|
|
|
|
|
|
+ return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (
|
|
|
|
+ interface{}, error) {
|
|
startTime := timex.Now()
|
|
startTime := timex.Now()
|
|
resp, err := handler(ctx, req)
|
|
resp, err := handler(ctx, req)
|
|
metricServerReqDur.Observe(int64(timex.Since(startTime)/time.Millisecond), info.FullMethod)
|
|
metricServerReqDur.Observe(int64(timex.Since(startTime)/time.Millisecond), info.FullMethod)
|
|
metricServerReqCodeTotal.Inc(info.FullMethod, strconv.Itoa(int(status.Code(err))))
|
|
metricServerReqCodeTotal.Inc(info.FullMethod, strconv.Itoa(int(status.Code(err))))
|
|
return resp, err
|
|
return resp, err
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|