Skip to content

Commit

Permalink
Update the TraceContext.Extract docs (#1720)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MrAlias authored Mar 20, 2021
1 parent 9d4eb1f commit e24702d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions propagation/trace_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit e24702d

Please sign in to comment.