|
|
@ -26,10 +26,7 @@ func SetSlowThreshold(threshold time.Duration) {
|
|
|
|
func UnaryStatInterceptor(metrics *stat.Metrics) grpc.UnaryServerInterceptor {
|
|
|
|
func UnaryStatInterceptor(metrics *stat.Metrics) grpc.UnaryServerInterceptor {
|
|
|
|
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
|
|
|
|
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
|
|
|
|
handler grpc.UnaryHandler) (resp interface{}, err error) {
|
|
|
|
handler grpc.UnaryHandler) (resp interface{}, err error) {
|
|
|
|
defer handleCrash(func(r interface{}) {
|
|
|
|
|
|
|
|
err = toPanicError(r)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
startTime := timex.Now()
|
|
|
|
startTime := timex.Now()
|
|
|
|
defer func() {
|
|
|
|
defer func() {
|
|
|
|
duration := timex.Since(startTime)
|
|
|
|
duration := timex.Since(startTime)
|
|
|
|