Class: Atatus::TraceContext::Tracestate Private
- Inherits:
-
Object
- Object
- Atatus::TraceContext::Tracestate
- Extended by:
- Forwardable
- Defined in:
- lib/atatus/trace_context/tracestate.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Instance Attribute Summary collapse
- #entries ⇒ Object private
Class Method Summary collapse
- .parse(header) ⇒ Object private
Instance Method Summary collapse
-
#initialize(entries: {}, sample_rate: nil) ⇒ Tracestate
constructor
private
A new instance of Tracestate.
- #to_header ⇒ Object private
Constructor Details
#initialize(entries: {}, sample_rate: nil) ⇒ Tracestate
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Tracestate.
96 97 98 99 100 |
# File 'lib/atatus/trace_context/tracestate.rb', line 96 def initialize(entries: {}, sample_rate: nil) @entries = entries self.sample_rate = sample_rate if sample_rate end |
Instance Attribute Details
#entries ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
102 103 104 |
# File 'lib/atatus/trace_context/tracestate.rb', line 102 def entries @entries end |
Class Method Details
.parse(header) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/atatus/trace_context/tracestate.rb', line 106 def self.parse(header) entries = split_by_nl_and_comma(header) .each_with_object({}) do |entry, hsh| k, v = entry.split('=') hsh[k] = case k when 'es' then EsEntry.new(v) else Entry.new(k, v) end end new(entries: entries) end |
Instance Method Details
#to_header ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
122 123 124 125 126 |
# File 'lib/atatus/trace_context/tracestate.rb', line 122 def to_header return "" unless entries.any? entries.values.map(&:to_s).join(',') end |