module OpenTelemetry::Context::Propagation
The propagation module contains APIs and utilities to interact with context and propagate across process boundaries.
The API implicitly defines 3 interfaces: TextMapPropagator
, TextMapInjector and TextMapExtractor. Concrete implementations of TextMapPropagator
are provided. Custom text map propagators can leverage these implementations or simply implement the expected interface. The interfaces are described below.
The TextMapPropagator
interface:
inject(carrier, context:, setter:) extract(carrier, context:, getter:) -> Context fields -> Array<String>
The TextMapInjector interface:
inject(carrier, context:, setter:) fields -> Array<String>
The TextMapExtractor interface:
extract(carrier, context:, getter:) -> Context
The API provides 3 TextMapPropagator
implementations:
-
A default
NoopTextMapPropagator
that implementsinject
andextract
methods as no-ops. Itsfields
method returns an empty list. -
A
TextMapPropagator
that composes an Injector and an Extractor. Itsfields
method delegates to the provided Injector. -
A
CompositeTextMapPropagator
that wraps either a list of text map propagators or a list of Injectors and a list of Extractors. Itsfields
method returns the union of fields returned by the Injectors it wraps.
Constants
- RACK_ENV_GETTER
- TEXT_MAP_GETTER
- TEXT_MAP_SETTER
Public Instance Methods
Returns a {RackEnvGetter} instance suitable for reading values from a Rack environment.
# File lib/opentelemetry/context/propagation.rb, line 72 def rack_env_getter RACK_ENV_GETTER end
Returns a {TextMapGetter} instance suitable for reading values from a hash-like carrier
# File lib/opentelemetry/context/propagation.rb, line 60 def text_map_getter TEXT_MAP_GETTER end
Returns a {TextMapSetter} instance suitable for writing values into a hash-like carrier
# File lib/opentelemetry/context/propagation.rb, line 66 def text_map_setter TEXT_MAP_SETTER end