Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Version represents the maximum header version supported. // The library attempts optimistic forwards compatibility with higher versions. Version = traceparent.Version )
Variables ¶
View Source
var ( // ErrInvalidHeadersMultipleTraceParent occurs when there are multiple `traceparent` headers present. ErrInvalidHeadersMultipleTraceParent = errors.New("tracecontext: Multiple traceparent headers") )
Functions ¶
This section is empty.
Types ¶
type TraceContext ¶
type TraceContext struct { TraceParent traceparent.TraceParent TraceState tracestate.TraceState }
TraceContext represents a paired TraceParent and TraceState that are intended to be propagated together.
func FromHeaders ¶
func FromHeaders(headers http.Header) (TraceContext, error)
FromHeaders attempts to parse a TraceContext from a set of headers. The returned `TraceContext` value should be considered valid so long as no error error is returned.
It is considered an error for the `traceparent` header to be invalid, but not for the `tracestate` header(s) to be invalid. If the `traceparent` header is valid and `tracestate` is not, a `TraceContext` with an empty `TraceState` will still be returned.
func (TraceContext) SetHeaders ¶
func (tc TraceContext) SetHeaders(headers http.Header)
SetHeaders sets the `traceparent` and `tracestate` headers based on the `TraceContext`'s fields.
Click to show internal directories.
Click to hide internal directories.