Class: OpenTelemetry::SDK::Baggage::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/opentelemetry/sdk/baggage/builder.rb

Overview

SDK implementation of Baggage::Builder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entries) ⇒ Builder

Returns a new instance of Builder.



14
15
16
# File 'lib/opentelemetry/sdk/baggage/builder.rb', line 14

def initialize(entries)
  @entries = entries
end

Instance Attribute Details

#entriesObject (readonly)

Returns the value of attribute entries.



12
13
14
# File 'lib/opentelemetry/sdk/baggage/builder.rb', line 12

def entries
  @entries
end

Instance Method Details

#clearObject

Clears all baggage from the to-be-created baggage



34
35
36
# File 'lib/opentelemetry/sdk/baggage/builder.rb', line 34

def clear
  @entries.clear
end

#remove_value(key) ⇒ Object

Removes key from the to-be-created baggage

Parameters:

  • key (String)

    The key to remove



29
30
31
# File 'lib/opentelemetry/sdk/baggage/builder.rb', line 29

def remove_value(key)
  @entries.delete(key)
end

#set_value(key, value) ⇒ Object

Set key-value in the to-be-created baggage

Parameters:

  • key (String)

    The key to store this value under

  • value (String)

    String value to be stored under key



22
23
24
# File 'lib/opentelemetry/sdk/baggage/builder.rb', line 22

def set_value(key, value)
  @entries[key] = value.to_s
end