tracecontext

package module
v0.0.0-...-1757c39 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2018 License: MIT Imports: 6 Imported by: 3

README

tracecontext.go

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL