1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-08-10 22:31:50 +02:00

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.
This commit is contained in:
Tyler Yahn
2021-03-20 16:12:34 +00:00
committed by GitHub
parent 9d4eb1f6d3
commit e24702daad

View File

@@ -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() {