Class: Hermes::B3PropagationModelHeaders

Inherits:
Object
  • Object
show all
Defined in:
lib/hermes/b_3_propagation_model_headers.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(trace_context) ⇒ B3PropagationModelHeaders

Returns a new instance of B3PropagationModelHeaders.



22
23
24
# File 'lib/hermes/b_3_propagation_model_headers.rb', line 22

def initialize(trace_context)
  @trace_context = trace_context
end

Class Method Details

.parent_span_id_keyObject



14
15
16
# File 'lib/hermes/b_3_propagation_model_headers.rb', line 14

def self.parent_span_id_key
  "X-B3-ParentSpanId"
end

.sampled_keyObject



18
19
20
# File 'lib/hermes/b_3_propagation_model_headers.rb', line 18

def self.sampled_key
  "X-B3-Sampled"
end

.span_id_keyObject



10
11
12
# File 'lib/hermes/b_3_propagation_model_headers.rb', line 10

def self.span_id_key
  "X-B3-SpanId"
end

.trace_id_keyObject



6
7
8
# File 'lib/hermes/b_3_propagation_model_headers.rb', line 6

def self.trace_id_key
  "X-B3-TraceId"
end

Instance Method Details

#as_jsonObject



26
27
28
# File 'lib/hermes/b_3_propagation_model_headers.rb', line 26

def as_json
  to_h
end

#to_hObject



30
31
32
33
34
35
36
37
# File 'lib/hermes/b_3_propagation_model_headers.rb', line 30

def to_h
  {
    self.class.trace_id_key => trace_context.trace,
    self.class.parent_span_id_key => trace_context.parent_span,
    self.class.span_id_key => trace_context.span,
    self.class.sampled_key => ""
  }
end