otel: go.opentelemetry.io/otel/api/correlation Index | Files

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.


Package Files

context.go correlation_context_propagator.go doc.go map.go


var CorrelationContextHeader = "Correlation-Context"

CorrelationContextHeader is specified by W3C. nolint:golint

func DefaultHTTPPropagator Uses

func DefaultHTTPPropagator() propagation.HTTPPropagator

DefaultHTTPPropagator returns the default context correlation HTTP propagator.

func NewContext Uses

func NewContext(ctx context.Context, keyvalues ...core.KeyValue) context.Context

NewContext returns a context with the map from passed context updated with the passed key-value pairs.

func WithMap Uses

func WithMap(ctx context.Context, m Map) context.Context

WithMap returns a context with the Map entered into it.

type CorrelationContext Uses

type CorrelationContext struct{}

CorrelationContext propagates Key:Values in W3C CorrelationContext format. nolint:golint

func (CorrelationContext) Extract Uses

func (CorrelationContext) Extract(ctx context.Context, supplier propagation.HTTPSupplier) context.Context

Extract implements HTTPExtractor.

func (CorrelationContext) GetAllKeys Uses

func (CorrelationContext) GetAllKeys() []string

GetAllKeys implements HTTPPropagator.

func (CorrelationContext) Inject Uses

func (CorrelationContext) Inject(ctx context.Context, supplier propagation.HTTPSupplier)

Inject implements HTTPInjector.

type Map Uses

type Map struct {
    // contains filtered or unexported fields

Map is an immutable storage for correlations.

func FromContext Uses

func FromContext(ctx context.Context) Map

FromContext gets the current Map from a Context.

func NewEmptyMap Uses

func NewEmptyMap() Map

NewEmptyMap creates an empty correlations map.

func NewMap Uses

func NewMap(update MapUpdate) 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.

func (Map) Apply Uses

func (m Map) Apply(update MapUpdate) Map

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 Uses

func (m Map) Foreach(f func(kv core.KeyValue) bool)

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 Uses

func (m Map) HasValue(k core.Key) bool

HasValue returns a boolean value indicating whether the key exist in the map.

func (Map) Len Uses

func (m Map) Len() int

Len returns a length of the map.

func (Map) Value Uses

func (m Map) Value(k core.Key) (core.Value, bool)

Value gets a value from correlations map and returns a boolean value indicating whether the key exist in the map.

type MapUpdate Uses

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.

Package correlation imports 6 packages (graph) and is imported by 7 packages. Updated 2020-02-22. Refresh now. Tools for package owners.