package baggage
Import Path
go.opentelemetry.io/otel/internal/baggage (on go.dev)
Dependency Relation
imports one package, and imported by one package
Involved Source Files
Package baggage provides base types and functionality to store and retrieve
baggage in Go context. This package exists because the OpenTracing bridge to
OpenTelemetry needs to synchronize state whenever baggage for a context is
modified and that context contains an OpenTracing span. If it were not for
this need this package would not need to exist and the
`go.opentelemetry.io/otel/baggage` package would be the singular place where
W3C baggage is handled.
context.go
Package-Level Type Names (total 5)
GetHookFunc is a callback called when getting baggage from the context.
func ContextWithGetHook(parent context.Context, hook GetHookFunc) context.Context
Item is the value and metadata properties part of a list-member.
Properties []Property
Value string
List is the collection of baggage members. The W3C allows for duplicates,
but OpenTelemetry does not, therefore, this is represented as a map.
func ListFromContext(ctx context.Context) List
func ContextWithList(parent context.Context, list List) context.Context
Property is a metadata entry for a list-member.
HasValue indicates if a zero-value value means the property does not
have a value or if it was the zero-value.
Key string
Value string
SetHookFunc is a callback called when storing baggage in the context.
func ContextWithSetHook(parent context.Context, hook SetHookFunc) context.Context
Package-Level Functions (total 4)
ContextWithGetHook returns a copy of parent with hook configured to be
invoked every time FromContext is called.
Passing nil GetHookFunc creates a context with no get hook to call.
ContextWithList returns a copy of parent with baggage. Passing nil list
returns a context without any baggage.
ContextWithSetHook returns a copy of parent with hook configured to be
invoked every time ContextWithBaggage is called.
Passing nil SetHookFunc creates a context with no set hook to call.
ListFromContext returns the baggage contained in ctx.
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |