Documentation ¶
Overview ¶
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.
Index ¶
- func ContextWithGetHook(parent context.Context, hook GetHookFunc) context.Context
- func ContextWithList(parent context.Context, list List) context.Context
- func ContextWithSetHook(parent context.Context, hook SetHookFunc) context.Context
- type GetHookFunc
- type Item
- type List
- type Property
- type SetHookFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithGetHook ¶
func ContextWithGetHook(parent context.Context, hook GetHookFunc) context.Context
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.
func ContextWithList ¶ added in v1.0.0
ContextWithList returns a copy of parent with baggage. Passing nil list returns a context without any baggage.
func ContextWithSetHook ¶
func ContextWithSetHook(parent context.Context, hook SetHookFunc) context.Context
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.
Types ¶
type GetHookFunc ¶
GetHookFunc is a callback called when getting baggage from the context.
type List ¶ added in v1.0.0
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 ¶ added in v1.0.0
ListFromContext returns the baggage contained in ctx.