diff --git a/protocol/dubbo/listener.go b/protocol/dubbo/listener.go index 69b45e4abb9444e3031102b807277a073460f318..430c4e49d81d4d5d151a545e1a130fd4ac3fbdc5 100644 --- a/protocol/dubbo/listener.go +++ b/protocol/dubbo/listener.go @@ -331,16 +331,15 @@ func (h *RpcServerHandler) OnCron(session getty.Session) { } } -// rebuild the context by attachment. +// rebuildCtx rebuild the context by attachment. // Once we decided to transfer more context's key-value, we should change this. // now we only support rebuild the tracing context func rebuildCtx(inv *invocation.RPCInvocation) context.Context { ctx := context.Background() - // actually, if user do not use any opentracing framework, it will always be error. + // actually, if user do not use any opentracing framework, the err will not be nil. spanCtx, err := opentracing.GlobalTracer().Extract(opentracing.TextMap, opentracing.TextMapCarrier(inv.Attachments())) - if err == nil { ctx = context.WithValue(ctx, constant.TRACING_REMOTE_SPAN_CTX, spanCtx) }