Module: OpenTelemetry::Propagator::B3::TextMapExtractor

Included in:
Multi::TextMapPropagator, Single::TextMapPropagator
Defined in:
lib/opentelemetry/propagator/b3/text_map_extractor.rb

Overview

Extracts trace context using the b3 single or multi header formats, favouring b3 single header.

Instance Method Summary collapse

Instance Method Details

#extract(carrier, context: Context.current, getter: Context::Propagation.text_map_getter) ⇒ Context

Extract trace context from the supplied carrier. The b3 single header takes precedence over the multi-header format. If extraction fails, the original context will be returned.

Parameters:

  • carrier (Carrier)

    The carrier to get the header from

  • context (optional Context) (defaults to: Context.current)

    Context to be updated with the trace context extracted from the carrier. Defaults to Context.current.

  • getter (optional Getter) (defaults to: Context::Propagation.text_map_getter)

    If the optional getter is provided, it will be used to read the header from the carrier, otherwise the default text map getter will be used.

Returns:

  • (Context)

    context updated with extracted baggage, or the original context if extraction fails



47
48
49
# File 'lib/opentelemetry/propagator/b3/text_map_extractor.rb', line 47

def extract(carrier, context: Context.current, getter: Context::Propagation.text_map_getter)
  extract_b3_single_header(carrier, context, getter) || extract_b3_multi_header(carrier, context, getter) || context
end