Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface TextMapPropagator

Injects Context into and extracts it from carriers that travel in-band across process boundaries. Encoding is expected to conform to the HTTP Header Field semantics. Values are often encoded as RPC/HTTP request headers.

The carrier of propagated data on both the client (injector) and server (extractor) side is usually an object such as http headers. Propagation is usually implemented via library-specific request interceptors, where the client-side injects values and the server-side extracts them.

Hierarchy

  • TextMapPropagator

Implemented by

Index

Methods

Methods

extract

  • extract(context: Context, carrier: unknown, getter: GetterFunction): Context
  • Given a Context and a carrier, extract context values from a carrier and return a new context, created from the old context, with the extracted values.

    Parameters

    • context: Context

      the Context from which to extract values to transmit over the wire.

    • carrier: unknown

      the carrier of propagation fields, such as http request headers.

    • getter: GetterFunction

      a function which accepts a carrier and a key, and returns the value from the carrier identified by the key.

    Returns Context

inject

  • inject(context: Context, carrier: unknown, setter: SetterFunction): void
  • Injects values from a given Context into a carrier.

    OpenTelemetry defines a common set of format values (TextMapPropagator), and each has an expected carrier type.

    Parameters

    • context: Context

      the Context from which to extract values to transmit over the wire.

    • carrier: unknown

      the carrier of propagation fields, such as http request headers.

    • setter: SetterFunction

      a function which accepts a carrier, key, and value, which sets the key on the carrier to the value.

    Returns void