Documentation ¶
Index ¶
Constants ¶
const ( // The max number of items in `tracestate` as defined by https://www.w3.org/TR/trace-context/#tracestate-header-field-values MaxStateEntries = 32 // W3C trace context header names as defined by https://www.w3.org/TR/trace-context/ TraceParentHeader = "traceparent" TraceStateHeader = "tracestate" )
const VendorInstana = "in"
Instana vendor key in the `tracestate` list
Variables ¶
Functions ¶
func TracingHandlerFunc ¶
func TracingHandlerFunc(handler http.HandlerFunc) http.HandlerFunc
TracingHandlerFunc is an HTTP middleware that forwards the W3C context found in request with the response
Types ¶
type Context ¶
Context represents the W3C trace context
func Extract ¶
Extract extracts the W3C trace context from HTTP headers. Returns ErrContextNotFound if provided value doesn't contain traceparent header.
type Flags ¶ added in v1.12.1
type Flags struct {
Sampled bool
}
Flags contains the trace flags as defined by https://www.w3.org/TR/trace-context/#trace-flags
type Parent ¶ added in v1.12.1
Parent represents trace parent extracted from `traceparent` header
func ParseParent ¶ added in v1.12.1
ParseParent parses the value of `traceparent` header according to the version defined in the first field
type State ¶ added in v1.12.1
type State []string
State is list of key=value pairs representing vendor-specific data in the trace context
func ParseState ¶ added in v1.12.1
ParseState parses the value of `tracestate` header. It strips any optional white-space chararacters preceding or following the key=value pairs. Empty list items are omitted.
func (State) Add ¶ added in v1.12.1
Put returns a new state prepended with provided vendor-specific data. It removes any existing entries for this vendor and returns the same state if vendor is empty. If the number of entries in a state reaches the MaxStateEntries, rest of the items will be truncated
func (State) Index ¶ added in v1.13.0
Index returns the index of vendor-specific data for given vendor in the state. It returns -1 if the state does not contain data for this vendor.
type Version ¶ added in v1.12.1
type Version uint8
Version represents the W3C trace context version. It defines the format of `traceparent` header
func ParseVersion ¶ added in v1.12.1
ParseVersion parses the version part of a `traceparent` header value. It returns ErrContextCorrupted if the version is malformed
func (Version) String ¶ added in v1.12.1
String returns string representation of a trace parent version. The returned value is compatible with the `traceparent` header format. The caller should take care of handling the Version_Unknown, otherwise this method will return "ff" which is considered invalid