Class: OpenTelemetry::Context::Propagation::NoopTextMapPropagator

Inherits:
Object
  • Object
show all
Defined in:
lib/opentelemetry/context/propagation/noop_text_map_propagator.rb

Overview

A no-op text map propagator implementation

Instance Method Summary collapse

Instance Method Details

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

Extracts and returns context from a carrier. Returns the provided context and logs a warning if an error if extraction fails.

Parameters:

  • carrier (Object)

    The carrier to extract context from.

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

    Context to be updated with the state 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 getter will be used.

Returns:

  • (Context)

    a new context updated with state extracted from the carrier



37
38
39
# File 'lib/opentelemetry/context/propagation/noop_text_map_propagator.rb', line 37

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

#fieldsArray<String>

Returns the predefined propagation fields. If your carrier is reused, you should delete the fields returned by this method before calling inject.

Returns:

  • (Array<String>)

    a list of fields that will be used by this propagator.



45
46
47
# File 'lib/opentelemetry/context/propagation/noop_text_map_propagator.rb', line 45

def fields
  EMPTY_LIST
end

#inject(carrier, context: Context.current, setter: Context::Propagation.text_map_setter) ⇒ Object

Injects the provided context into a carrier.

Parameters:

  • carrier (Object)

    A mutable carrier to inject context into.

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

    Context to be injected into carrier. Defaults to Context.current.

  • setter (optional Setter) (defaults to: Context::Propagation.text_map_setter)

    If the optional setter is provided, it will be used to write context into the carrier, otherwise the default setter will be used.



23
# File 'lib/opentelemetry/context/propagation/noop_text_map_propagator.rb', line 23

def inject(carrier, context: Context.current, setter: Context::Propagation.text_map_setter); end