Class: Jaeger::Injectors::B3RackCodec

Inherits:
Object
  • Object
show all
Defined in:
lib/jaeger/injectors.rb

Class Method Summary collapse

Class Method Details

.inject(span_context, carrier) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/jaeger/injectors.rb', line 40

def self.inject(span_context, carrier)
  carrier['x-b3-traceid'] = TraceId.to_hex(span_context.trace_id)
  carrier['x-b3-spanid'] = TraceId.to_hex(span_context.span_id)
  carrier['x-b3-parentspanid'] = TraceId.to_hex(span_context.parent_id)

  # flags (for debug) and sampled headers are mutually exclusive
  if span_context.flags == Jaeger::SpanContext::Flags::DEBUG
    carrier['x-b3-flags'] = '1'
  else
    carrier['x-b3-sampled'] = span_context.flags.to_s(16)
  end
end