Documentation ¶
Overview ¶
Package baggage provides functionality for storing and retrieving baggage items in Go context. For propagating the baggage, see the go.opentelemetry.io/otel/propagation package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithBaggage ¶
ContextWithBaggage returns a copy of parent with baggage.
Types ¶
type Baggage ¶
type Baggage struct {
// contains filtered or unexported fields
}
Baggage is a list of baggage members representing the baggage-string as defined by the W3C Baggage specification.
func FromContext ¶
FromContext returns the baggage contained in ctx.
func New ¶
New returns a new valid Baggage. It returns an error if it results in a Baggage exceeding limits set in that specification.
It expects all the provided members to have already been validated.
func Parse ¶
Parse attempts to decode a baggage-string from the passed string. It returns an error if the input is invalid according to the W3C Baggage specification.
If there are duplicate list-members contained in baggage, the last one defined (reading left-to-right) will be the only one kept. This diverges from the W3C Baggage specification which allows duplicate list-members, but conforms to the OpenTelemetry Baggage specification.
func (Baggage) DeleteMember ¶
DeleteMember returns a copy of the Baggage with the list-member identified by key removed.
func (Baggage) Member ¶
Member returns the baggage list-member identified by key.
If there is no list-member matching the passed key the returned Member will be a zero-value Member. The returned member is not validated, as we assume the validation happened when it was added to the Baggage.
func (Baggage) Members ¶
Members returns all the baggage list-members. The order of the returned list-members does not have significance.
The returned members are not validated, as we assume the validation happened when they were added to the Baggage.
type Member ¶
type Member struct {
// contains filtered or unexported fields
}
Member is a list-member of a baggage-string as defined by the W3C Baggage specification.
func NewMember ¶
NewMember returns a new Member from the passed arguments. An error is returned if the created Member would be invalid according to the W3C Baggage specification.
func (Member) Properties ¶
Properties returns a copy of the Member properties.
type Property ¶
type Property struct {
// contains filtered or unexported fields
}
Property is an additional metadata entry for a baggage list-member.
func NewKeyProperty ¶
NewKeyProperty returns a new Property for key.
If key is invalid, an error will be returned.
func NewKeyValueProperty ¶
NewKeyValueProperty returns a new Property for key with value.
If key or value are invalid, an error will be returned.