package correlation
import "go.opentelemetry.io/otel/api/correlation"
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.
Index ¶
- func ContextWithMap(ctx context.Context, m Map) context.Context
- func DefaultHTTPPropagator() propagation.HTTPPropagator
- func NewContext(ctx context.Context, keyvalues ...core.KeyValue) context.Context
- type CorrelationContext
- func (CorrelationContext) Extract(ctx context.Context, supplier propagation.HTTPSupplier) context.Context
- func (CorrelationContext) GetAllKeys() []string
- func (CorrelationContext) Inject(ctx context.Context, supplier propagation.HTTPSupplier)
- type Map
- func MapFromContext(ctx context.Context) Map
- func NewEmptyMap() Map
- func NewMap(update MapUpdate) Map
- func (m Map) Apply(update MapUpdate) Map
- func (m Map) Foreach(f func(kv core.KeyValue) bool)
- func (m Map) HasValue(k core.Key) bool
- func (m Map) Len() int
- func (m Map) Value(k core.Key) (core.Value, bool)
- type MapUpdate
Functions ¶
func ContextWithMap ¶
ContextWithMap returns a context with the Map entered into it.
func DefaultHTTPPropagator ¶
func DefaultHTTPPropagator() propagation.HTTPPropagator
DefaultHTTPPropagator returns the default context correlation HTTP propagator.
func NewContext ¶
NewContext returns a context with the map from passed context updated with the passed key-value pairs.
Types ¶
type CorrelationContext ¶
type CorrelationContext struct{}
CorrelationContext propagates Key:Values in W3C CorrelationContext format. nolint:golint
func (CorrelationContext) Extract ¶
func (CorrelationContext) Extract(ctx context.Context, supplier propagation.HTTPSupplier) context.Context
Extract implements HTTPExtractor.
func (CorrelationContext) GetAllKeys ¶
func (CorrelationContext) GetAllKeys() []string
GetAllKeys implements HTTPPropagator.
func (CorrelationContext) Inject ¶
func (CorrelationContext) Inject(ctx context.Context, supplier propagation.HTTPSupplier)
Inject implements HTTPInjector.
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map is an immutable storage for correlations.
func MapFromContext ¶
MapFromContext gets the current Map from a Context.
func NewEmptyMap ¶
func NewEmptyMap() Map
NewEmptyMap creates an empty correlations map.
func NewMap ¶
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.
func (Map) Apply ¶
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.
func (Map) Foreach ¶
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.
func (Map) HasValue ¶
HasValue returns a boolean value indicating whether the key exist in the map.
func (Map) Len ¶
Len returns a length of the map.
func (Map) Value ¶
Value gets a value from correlations map and returns a boolean value indicating whether the key exist in the map.
type MapUpdate ¶
type MapUpdate struct { // 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. DropSingleK core.Key // DropMultiK contains all the keys to be dropped from // correlations. DropMultiK []core.Key // 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. SingleKV core.KeyValue // MultiKV contains all the key-value pairs to be added to // correlations. MultiKV []core.KeyValue }
MapUpdate contains information about correlation changes to be made.
Source Files ¶
context.go correlation_context_propagator.go doc.go map.go
- Version
- v0.2.3
- Published
- Mar 4, 2020
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 2 hours ago –
Tools for package owners.