Class: ElasticAPM::TraceContext::Tracestate Private
- Inherits:
-
Object
- Object
- ElasticAPM::TraceContext::Tracestate
- Extended by:
- Forwardable
- Defined in:
- lib/elastic_apm/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.
95 96 97 98 99 |
# File 'lib/elastic_apm/trace_context/tracestate.rb', line 95 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.
101 102 103 |
# File 'lib/elastic_apm/trace_context/tracestate.rb', line 101 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.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/elastic_apm/trace_context/tracestate.rb', line 105 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.
121 122 123 124 125 |
# File 'lib/elastic_apm/trace_context/tracestate.rb', line 121 def to_header return "" unless entries.any? entries.values.map(&:to_s).join(',') end |