Source File
spanref.go
Belonging Package
go.pact.im/x/traces
package tracesimport// SpanRef is the immutable, comparable identity of a span propagated to child// spans and across process boundaries.type SpanRef struct {// TraceID identifies the trace.TraceID TraceID// SpanID identifies the span within the trace.SpanID SpanID// Sampled reports whether the span is sampled.Sampled bool}// IsValid reports whether both [SpanRef.TraceID] and [SpanRef.SpanID] are// valid.func ( SpanRef) () bool {return .TraceID.IsValid() && .SpanID.IsValid()}type contextKey struct{}// NewContext returns a copy of ctx carrying ref. It is intended for crossing// API boundaries that cannot accept a parent [SpanRef] explicitly.func ( context.Context, SpanRef) context.Context {return context.WithValue(, contextKey{}, )}// FromContext returns the [SpanRef] stored in ctx by [NewContext], or the// zero [SpanRef] if none is present.func ( context.Context) SpanRef {, := .Value(contextKey{}).(SpanRef)return}
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64)