Module: Jaeger::Injectors

Defined in:
lib/jaeger/injectors.rb

Defined Under Namespace

Classes: B3RackCodec, JaegerBinaryCodec, JaegerRackCodec, JaegerTextMapCodec, TraceContextRackCodec

Constant Summary collapse

DEFAULT_INJECTORS =
{
  OpenTracing::FORMAT_TEXT_MAP => JaegerTextMapCodec,
  OpenTracing::FORMAT_BINARY => JaegerBinaryCodec,
  OpenTracing::FORMAT_RACK => JaegerRackCodec
}.freeze

Class Method Summary collapse

Class Method Details

.context_as_jaeger_string(span_context) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/jaeger/injectors.rb', line 5

def self.context_as_jaeger_string(span_context)
  [
    span_context.trace_id.to_s(16),
    span_context.span_id.to_s(16),
    span_context.parent_id.to_s(16),
    span_context.flags.to_s(16)
  ].join(':')
end

.prepare(injectors) ⇒ Object



74
75
76
77
78
79
80
81
# File 'lib/jaeger/injectors.rb', line 74

def self.prepare(injectors)
  DEFAULT_INJECTORS.reduce(injectors) do |acc, (format, default)|
    provided_injectors = Array(injectors[format])
    provided_injectors += [default] if provided_injectors.empty?

    acc.merge(format => provided_injectors)
  end
end