v0.24.0 Latest Latest

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

Go to latest
Published: Nov 3, 2022 License: Apache-2.0 Imports: 2 Imported by: 18



Package tracestate implements support for the Tracestate header of the W3C TraceContext propagation format.



This section is empty.


This section is empty.


This section is empty.


type Entry

type Entry struct {
	// Key is an opaque string up to 256 characters printable. It MUST begin with a lowercase letter,
	// and can only contain lowercase letters a-z, digits 0-9, underscores _, dashes -, asterisks *, and
	// forward slashes /.
	Key string

	// Value is an opaque string up to 256 characters printable ASCII RFC0020 characters (i.e., the
	// range 0x20 to 0x7E) except comma , and =.
	Value string

Entry represents one key-value pair in a list of key-value pair of Tracestate.

type Tracestate

type Tracestate struct {
	// contains filtered or unexported fields

Tracestate represents tracing-system specific context in a list of key-value pairs. Tracestate allows different vendors propagate additional information and inter-operate with their legacy Id formats.

func New

func New(parent *Tracestate, entries ...Entry) (*Tracestate, error)

New creates a Tracestate object from a parent and/or entries (key-value pair). Entries from the parent are copied if present. The entries passed to this function are inserted in front of those copied from the parent. If an entry copied from the parent contains the same key as one of the entry in entries then the entry copied from the parent is removed. See add func.

An error is returned with nil Tracestate if

  1. one or more entry in entries is invalid.
  2. two or more entries in the input entries have the same key.
  3. the number of entries combined from the parent and the input entries exceeds maxKeyValuePairs. (duplicate entry is counted only once).

func (*Tracestate) Entries

func (ts *Tracestate) Entries() []Entry

Entries returns a slice of Entry.

Jump to

Keyboard shortcuts

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