Module: Honeycomb::AWSPropagation::MarshalTraceContext

Defined in:
lib/honeycomb/propagation/aws.rb

Overview

Serialize trace headers

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.to_trace_header(propagation_context) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/honeycomb/propagation/aws.rb', line 66

def self.to_trace_header(propagation_context)
  context = [""]
  fields = propagation_context.trace_fields
  fields.keys&.each do |key|
    context.push("#{key}=#{fields[key]}")
  end

  data_to_propagate = [
    "Root=#{propagation_context.trace_id}",
    "Parent=#{propagation_context.parent_id}",
  ]
  "#{data_to_propagate.join(';')}#{context.join(';')}"
end

Instance Method Details

#to_trace_headerObject



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/honeycomb/propagation/aws.rb', line 53

def to_trace_header
  context = [""]
  trace.fields.keys&.each do |key|
    context.push("#{key}=#{trace.fields[key]}")
  end

  data_to_propagate = [
    "Root=#{trace.id}",
    "Parent=#{id}",
  ]
  "#{data_to_propagate.join(';')}#{context.join(';')}"
end