From af6d37c33dae7c90cd885468e6f84096fe025166 Mon Sep 17 00:00:00 2001 From: Atlan <39624029+AtlanCI@users.noreply.github.com> Date: Tue, 14 Jun 2022 00:11:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20clientinterceptors/?= =?UTF-8?q?tracinginterceptor.go=20=E6=98=BE=E7=A4=BA=E6=8E=A5=E5=8F=97?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=AD=97=E8=8A=82=E4=B8=BA0=20(#2003)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zrpc/internal/clientinterceptors/tracinginterceptor.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zrpc/internal/clientinterceptors/tracinginterceptor.go b/zrpc/internal/clientinterceptors/tracinginterceptor.go index b2148d43..d24e7551 100644 --- a/zrpc/internal/clientinterceptors/tracinginterceptor.go +++ b/zrpc/internal/clientinterceptors/tracinginterceptor.go @@ -26,9 +26,11 @@ func UnaryTracingInterceptor(ctx context.Context, method string, req, reply inte defer span.End() ztrace.MessageSent.Event(ctx, 1, req) - ztrace.MessageReceived.Event(ctx, 1, reply) - if err := invoker(ctx, method, req, reply, cc, opts...); err != nil { + err := invoker(ctx, method, req, reply, cc, opts...) + // fix: https://github.com/zeromicro/go-zero/issues/1954 + ztrace.MessageReceived.Event(ctx, 1, reply) + if err != nil { s, ok := status.FromError(err) if ok { span.SetStatus(codes.Error, s.Message())