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

package propagation

import "go.opentelemetry.io/otel/api/propagation"

Package propagation provides support for propagating context over HTTP.


Package Files

doc.go propagation.go

func ExtractHTTP Uses

func ExtractHTTP(ctx context.Context, props Propagators, supplier HTTPSupplier) context.Context

ExtractHTTP applies props.HTTPExtractors() to the passed context and the supplier and returns the combined result context.

func InjectHTTP Uses

func InjectHTTP(ctx context.Context, props Propagators, supplier HTTPSupplier)

InjectHTTP applies props.HTTPInjectors() to the passed context and the supplier.

type Config Uses

type Config struct {
    // contains filtered or unexported fields

Config contains the current set of extractors and injectors.

type HTTPExtractor Uses

type HTTPExtractor interface {
    // Extract method retrieves encoded information using supplier
    // from the associated carrier, decodes it and creates a new
    // context containing the decoded information.
    // Information can be a correlation context or a remote span
    // context. In case of span context, the propagator should
    // store it in the context using
    // trace.ContextWithRemoteSpanContext. In case of correlation
    // context, the propagator should use correlation.WithMap to
    // store it in the context.
    Extract(ctx context.Context, supplier HTTPSupplier) context.Context

HTTPExtractor extracts information from a HTTPSupplier into a context.

type HTTPInjector Uses

type HTTPInjector interface {
    // Inject method retrieves information from the context,
    // encodes it into propagator specific format and then injects
    // the encoded information using supplier into an associated
    // carrier.
    Inject(ctx context.Context, supplier HTTPSupplier)

HTTPInjector injects information into a HTTPSupplier.

type HTTPPropagator Uses

type HTTPPropagator interface {

    // GetAllKeys returns the HTTP header names used.
    GetAllKeys() []string

HTTPPropagator is the interface to inject to and extract from HTTPSupplier.

type HTTPSupplier Uses

type HTTPSupplier interface {
    // Get method retrieves a single value for a given key.
    Get(key string) string
    // Set method stores a single value for a given key. Note that
    // this should not be appending a value to some array, but
    // rather overwrite the old value.
    Set(key string, value string)

HTTPSupplier is an interface that specifies methods to retrieve and store a single value for a key to an associated carrier. It is implemented by http.Headers.

type Option Uses

type Option func(*Config)

Option support passing configuration parameters to New().

func WithExtractors Uses

func WithExtractors(ext ...HTTPExtractor) Option

WithExtractors appends to the optional extractor set.

func WithInjectors Uses

func WithInjectors(inj ...HTTPInjector) Option

WithInjectors appends to the optional injector set.

type Propagators Uses

type Propagators interface {
    // HTTPExtractors returns the configured extractors.
    HTTPExtractors() []HTTPExtractor

    // HTTPInjectors returns the configured injectors.
    HTTPInjectors() []HTTPInjector

Propagators is the interface to a set of injectors and extractors for all supported carrier formats. It can be used to chain multiple propagators into a single entity.

func New Uses

func New(options ...Option) Propagators

New returns a standard Propagators implementation.

Package propagation imports 1 packages (graph) and is imported by 16 packages. Updated 2020-09-17. Refresh now. Tools for package owners.