From e24702daad7022ef7606f301859c2dfe3d71e1fa Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sat, 20 Mar 2021 16:12:34 +0000 Subject: [PATCH] Update the TraceContext.Extract docs (#1720) How the tracecontext is extracted is important if the user wants to interact with the extracted SpanContext (i.e. as a remote span context instead of a current span context). This makes it clear where it will be extracted and what behavior to expect if the tracecontext is invalid. --- propagation/trace_context.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/propagation/trace_context.go b/propagation/trace_context.go index cb38cf416c2..014d190caec 100644 --- a/propagation/trace_context.go +++ b/propagation/trace_context.go @@ -63,6 +63,10 @@ func (tc TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) { } // Extract reads tracecontext from the carrier into a returned Context. +// +// The returned Context will be a copy of ctx and contain the extracted +// tracecontext as the remote SpanContext. If the extracted tracecontext is +// invalid, the passed ctx will be returned directly instead. func (tc TraceContext) Extract(ctx context.Context, carrier TextMapCarrier) context.Context { sc := tc.extract(carrier) if !sc.IsValid() {