Class: LightStep::Propagation::LightStepPropagator

Inherits:
Object
  • Object
show all
Defined in:
lib/lightstep/propagation/lightstep_propagator.rb

Direct Known Subclasses

B3Propagator

Constant Summary collapse

CARRIER_TRACER_STATE_PREFIX =
'ot-tracer-'
CARRIER_SPAN_ID =
'ot-tracer-spanid'
CARRIER_TRACE_ID =
'ot-tracer-traceid'
CARRIER_SAMPLED =
'ot-tracer-sampled'
CARRIER_BAGGAGE_PREFIX =
'ot-baggage-'

Instance Method Summary collapse

Instance Method Details

#extract(format, carrier) ⇒ SpanContext

Extract a SpanContext from a carrier

Parameters:

  • format (OpenTracing::FORMAT_TEXT_MAP, OpenTracing::FORMAT_BINARY, OpenTracing::FORMAT_RACK)
  • carrier (Carrier)

    A carrier object of the type dictated by the specified ‘format`

Returns:

  • (SpanContext)

    the extracted SpanContext or nil if none could be found



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/lightstep/propagation/lightstep_propagator.rb', line 34

def extract(format, carrier)
  case format
  when OpenTracing::FORMAT_TEXT_MAP
    extract_from_text_map(carrier)
  when OpenTracing::FORMAT_BINARY
    warn 'Binary join format not yet implemented'
    nil
  when OpenTracing::FORMAT_RACK
    extract_from_rack(carrier)
  else
    warn 'Unknown join format'
    nil
  end
end

#inject(span_context, format, carrier) ⇒ Object

Inject a SpanContext into the given carrier

Parameters:

  • spancontext (SpanContext)
  • format (OpenTracing::FORMAT_TEXT_MAP, OpenTracing::FORMAT_BINARY)
  • carrier (Carrier)

    A carrier object of the type dictated by the specified ‘format`



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/lightstep/propagation/lightstep_propagator.rb', line 17

def inject(span_context, format, carrier)
  case format
  when OpenTracing::FORMAT_TEXT_MAP
    inject_to_text_map(span_context, carrier)
  when OpenTracing::FORMAT_BINARY
    warn 'Binary inject format not yet implemented'
  when OpenTracing::FORMAT_RACK
    inject_to_rack(span_context, carrier)
  else
    warn 'Unknown inject format'
  end
end