Class: Atatus::TraceContext::Tracestate::EsEntry Private

Inherits:
Object
  • Object
show all
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.

Constant Summary collapse

ASSIGN =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

':'
SPLIT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

';'
SHORT_TO_LONG =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{ 's' => 'sample_rate' }.freeze
LONG_TO_SHORT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{ 'sample_rate' => 's' }.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values = nil) ⇒ EsEntry

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 EsEntry.



48
49
50
# File 'lib/atatus/trace_context/tracestate.rb', line 48

def initialize(values = nil)
  parse(values)
end

Instance Attribute Details

#sample_rateObject

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.



52
53
54
# File 'lib/atatus/trace_context/tracestate.rb', line 52

def sample_rate
  @sample_rate
end

Instance Method Details

#empty?Boolean

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:

  • (Boolean)


64
65
66
# File 'lib/atatus/trace_context/tracestate.rb', line 64

def empty?
  !sample_rate
end

#keyObject

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.



54
55
56
# File 'lib/atatus/trace_context/tracestate.rb', line 54

def key
  'es'
end

#to_sObject

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.



74
75
76
77
78
# File 'lib/atatus/trace_context/tracestate.rb', line 74

def to_s
  return nil if empty?

  "es=#{value}"
end

#valueObject

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.



58
59
60
61
62
# File 'lib/atatus/trace_context/tracestate.rb', line 58

def value
  LONG_TO_SHORT.map do |l, s|
    "#{s}#{ASSIGN}#{send(l)}"
  end.join(SPLIT)
end