Documentation
¶
Overview ¶
Package baggage provides an implementation of storing trace-level context data, i.e. baggage. Unlike OpenTelemetry's implementation of baggage, this baggage is only propagated to child spans of the current local process. Information is not propagated with any external calls.
Index ¶
- func ContextWithAttributes(ctx context.Context, attributes []attribute.KeyValue) context.Context
- func ContextWithBaggage(ctx context.Context, tv Baggage) context.Context
- func ContextWithoutBaggage(ctx context.Context) context.Context
- type Baggage
- func (mb Baggage) Attributes() []attribute.KeyValue
- func (mb Baggage) Delete(key attribute.Key) Baggage
- func (mb Baggage) Get(key attribute.Key) attribute.Value
- func (mb Baggage) Keys() []attribute.Key
- func (mb Baggage) Len() int
- func (mb Baggage) Lookup(key attribute.Key) (val attribute.Value, ok bool)
- func (mb Baggage) Set(keyValue ...attribute.KeyValue) Baggage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithAttributes ¶
ContextWithAttributes returns a copy of ctx with attributes set.
func ContextWithBaggage ¶
ContextWithBaggage returns a copy of ctx with baggage.
Types ¶
type Baggage ¶
type Baggage struct {
// contains filtered or unexported fields
}
An immutable object safe for concurrent use.
func BaggageFromContext ¶
FromContext returns the baggage contained in ctx.
func (Baggage) Attributes ¶
Attributes returns a copy of the key-value attributes contained.
func (Baggage) Delete ¶
Delete removes the provided key, returning a new copy of Baggage. The new Baggage copy is returned that should be used.
func (Baggage) Get ¶
Get returns the value of the given key. If the key does not exist, the default value is returned.