class Freddy::TraceCarrier
Carrier for rabbitmq following OpenTracing API See github.com/opentracing/opentracing-ruby/blob/master/lib/opentracing/carrier.rb
Public Class Methods
new(properties)
click to toggle source
# File lib/freddy/trace_carrier.rb, line 5 def initialize(properties) @properties = properties end
Public Instance Methods
[](key)
click to toggle source
# File lib/freddy/trace_carrier.rb, line 9 def [](key) @properties.headers && @properties.headers["x-trace-#{key}"] end
[]=(key, value)
click to toggle source
# File lib/freddy/trace_carrier.rb, line 13 def []=(key, value) @properties[:headers] ||= {} @properties[:headers]["x-trace-#{key}"] = value end
each(&block)
click to toggle source
# File lib/freddy/trace_carrier.rb, line 18 def each(&block) Hash[ (@properties.headers || {}) .select {|key, _| key =~ /^x-trace/} .map {|key, value| [key.sub(/x-trace-/, ''), value]} ].each(&block) end