struct
OpenTelemetry::Baggage
- OpenTelemetry::Baggage
- Struct
- Value
- Object
Overview
An immutable collection of case-sensitive UTF-8 names and values, with optional metadata. Concurrency: immutable and safe to share.
Included Modules
- Enumerable({String, OpenTelemetry::Baggage::Entry})
Defined in:
api/baggage.crConstant Summary
-
EMPTY =
new
Constructors
Class Method Summary
- .clear(context : Context = Context.current) : Context
- .with(baggage : Baggage, context : Context = Context.current) : Context
-
.with(baggage : Baggage, & : -> U) : U forall U
Activates baggage within the block.
Instance Method Summary
- #[]?(name : String) : String | Nil
- #delete(name : String) : Baggage
-
#each(& : Tuple(String, Entry) -> ) : Nil
Must yield this collection's elements to the block.
-
#empty? : Bool
Returns
trueifselfdoes not contain any element. - #entry?(name : String) : Entry | Nil
-
#set(name : String, value : String, metadata : String | Nil = nil) : Baggage
Returns baggage with the entry for name replaced.
-
#size : Int32
Returns the number of elements in the collection.
-
#to_h : Hash(String, String)
Returns an independent map of names to values.
Constructor Detail
Class Method Detail
Activates baggage within the block.
Instance Method Detail
Description copied from module Enumerable({String, OpenTelemetry::Baggage::Entry})
Must yield this collection's elements to the block.
def empty? : Bool
#
Description copied from module Enumerable({String, OpenTelemetry::Baggage::Entry})
Returns true if self does not contain any element.
([] of Int32).empty? # => true
([1]).empty? # => false
[nil, false].empty? # => false
#present?returns the inverse.
Returns baggage with the entry for name replaced.
def size : Int32
#
Description copied from module Enumerable({String, OpenTelemetry::Baggage::Entry})
Returns the number of elements in the collection.
[1, 2, 3, 4].size # => 4