Involved Source Filescontext.gocorrelation_context_propagator.go
This package implements the correlation functionality as specified
in the OpenTelemetry specification. Currently it provides a data
structure for storing correlations (Map) and a way of putting Map
object into the context and retrieving it from context.
map.go
Package-Level Type Names (total 10, in which 5 are exported)
/* sort exporteds by: | */
CorrelationContext propagates Key:Values in W3C CorrelationContext
format.
nolint:golint
Extract implements HTTPExtractor.
GetAllKeys implements HTTPPropagator.
Inject implements HTTPInjector.
T : go.opentelemetry.io/otel/api/propagation.HTTPExtractor
T : go.opentelemetry.io/otel/api/propagation.HTTPInjector
T : go.opentelemetry.io/otel/api/propagation.HTTPPropagator
Map is an immutable storage for correlations.
mrawMap
Apply creates a copy of the map with the contents of the update
applied. Apply will first drop the keys from DropSingleK and
DropMultiK, then add key-value pairs from SingleKV and MultiKV.
Foreach calls a passed callback once on each key-value pair until
all the key-value pairs of the map were iterated or the callback
returns false, whichever happens first.
HasValue returns a boolean value indicating whether the key exist
in the map.
Len returns a length of the map.
Value gets a value from correlations map and returns a boolean
value indicating whether the key exist in the map.
T : github.com/aws/aws-sdk-go/aws/corehandlers.lener
func MapFromContext(ctx context.Context) Map
func NewEmptyMap() Map
func NewMap(update MapUpdate) Map
func Map.Apply(update MapUpdate) Map
func newMap(raw rawMap) Map
func ContextWithMap(ctx context.Context, m Map) context.Context
func contextWithOneHookAndMap(ctx context.Context, kind hookKind, setHook SetHookFunc, getHook GetHookFunc, m Map) context.Context
MapUpdate contains information about correlation changes to be
made.
DropMultiK contains all the keys to be dropped from
correlations.
DropSingleK contains a single key to be dropped from
correlations. Use this to avoid an overhead of a slice
allocation if there is only one key to drop.
MultiKV contains all the key-value pairs to be added to
correlations.
SingleKV contains a single key-value pair to be added to
correlations. Use this to avoid an overhead of a slice
allocation if there is only one key-value pair to add.
func NewMap(update MapUpdate) Map
func Map.Apply(update MapUpdate) Map
func getModificationSets(update MapUpdate) (delSet, addSet keySet)
Package-Level Functions (total 14, in which 9 are exported)
ContextWithGetHook installs a hook function that will be invoked
every time MapFromContext is called. To avoid unnecessary callback
invocations (recursive or not), the callback can temporarily clear
the hooks from the context with the ContextWithNoHooks function.
Note that NewContext also calls MapFromContext, so the hook will be
invoked.
Passing nil GetHookFunc creates a context with no get hook to call.
This function should not be used by applications or libraries. It
is mostly for interoperation with other observability APIs.
ContextWithMap returns a context with the Map entered into it.
ContextWithNoHooks creates a context with all the hooks
disabled. Also returns old set and get hooks. This function can be
used to temporarily clear the context from hooks and then reinstate
them by calling ContextWithSetHook and ContextWithGetHook functions
passing the hooks returned by this function.
This function should not be used by applications or libraries. It
is mostly for interoperation with other observability APIs.
ContextWithSetHook installs a hook function that will be invoked
every time ContextWithMap is called. To avoid unnecessary callback
invocations (recursive or not), the callback can temporarily clear
the hooks from the context with the ContextWithNoHooks function.
Note that NewContext also calls ContextWithMap, so the hook will be
invoked.
Passing nil SetHookFunc creates a context with no set hook to call.
This function should not be used by applications or libraries. It
is mostly for interoperation with other observability APIs.
DefaultHTTPPropagator returns the default context correlation HTTP
propagator.
MapFromContext gets the current Map from a Context.
NewContext returns a context with the map from passed context
updated with the passed key-value pairs.
NewEmptyMap creates an empty correlations map.
NewMap creates a map with the contents of the update applied. In
this function, having an update with DropSingleK or DropMultiK
makes no sense - those fields are effectively ignored.
Package-Level Variables (only one, which is unexported)
value under this key is either of type Map or correlationsData
Package-Level Constants (total 3, none are exported)
Temporary header name until W3C finalizes format.
https://github.com/open-telemetry/opentelemetry-specification/blob/18b2752ebe6c7f0cdd8c7b2bcbdceb0ae3f5ad95/specification/correlationcontext/api.md#header-name
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin 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 @Go100and1 (reachable from the left QR code) to get the latest news of Golds.