Class: Skywalking::Tracing::SW8CorrelationCarrier
- Inherits:
-
CarrierItem
- Object
- CarrierItem
- Skywalking::Tracing::SW8CorrelationCarrier
- Defined in:
- lib/skywalking/tracing/carrier.rb
Instance Attribute Summary collapse
-
#correlation ⇒ Object
Returns the value of attribute correlation.
Attributes inherited from CarrierItem
Instance Method Summary collapse
-
#initialize ⇒ SW8CorrelationCarrier
constructor
A new instance of SW8CorrelationCarrier.
- #value ⇒ Object
- #value=(val) ⇒ Object
Constructor Details
#initialize ⇒ SW8CorrelationCarrier
Returns a new instance of SW8CorrelationCarrier.
98 99 100 101 |
# File 'lib/skywalking/tracing/carrier.rb', line 98 def initialize super(key: 'sw8-correlation') @correlation = {} end |
Instance Attribute Details
#correlation ⇒ Object
Returns the value of attribute correlation.
96 97 98 |
# File 'lib/skywalking/tracing/carrier.rb', line 96 def correlation @correlation end |
Instance Method Details
#value ⇒ Object
103 104 105 106 107 |
# File 'lib/skywalking/tracing/carrier.rb', line 103 def value return '' if @correlation.nil? || @correlation.empty? @correlation.map { |k, v| "#{Base64.strict_encode64(k)}:#{Base64.strict_encode64(v)}" }.join(',') end |
#value=(val) ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/skywalking/tracing/carrier.rb', line 109 def value=(val) @val = val return if val.nil? || val.empty? val.split(',').each do |per| parts = per.split(':') next if parts.size != 2 @correlation[Base64.strict_decode64(parts[0])] = Base64.strict_decode64(parts[1]) end end |