From 05007c86bb5c32a1bea6dde3f1f4fed5e8cdedd9 Mon Sep 17 00:00:00 2001 From: maizige <37949155+wsx864321@users.noreply.github.com> Date: Sat, 27 Aug 2022 12:18:23 +0800 Subject: [PATCH] fix:duplicate copy MD (#2304) --- zrpc/internal/clientinterceptors/tracinginterceptor.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/zrpc/internal/clientinterceptors/tracinginterceptor.go b/zrpc/internal/clientinterceptors/tracinginterceptor.go index 5d4b666e..e9cbc6ef 100644 --- a/zrpc/internal/clientinterceptors/tracinginterceptor.go +++ b/zrpc/internal/clientinterceptors/tracinginterceptor.go @@ -153,11 +153,8 @@ func (w *clientStream) sendStreamEvent(eventType streamEventType, err error) { } func startSpan(ctx context.Context, method, target string) (context.Context, trace.Span) { - var md metadata.MD - requestMetadata, ok := metadata.FromOutgoingContext(ctx) - if ok { - md = requestMetadata.Copy() - } else { + md, ok := metadata.FromOutgoingContext(ctx) + if !ok { md = metadata.MD{} } tr := otel.Tracer(ztrace.TraceName)