struct OpenTelemetry::Baggage

Overview

An immutable collection of case-sensitive UTF-8 names and values, with optional metadata. Concurrency: immutable and safe to share.

Included Modules

Defined in:

api/baggage.cr

Constant Summary

EMPTY = new

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.current : Baggage #

[View source]
def self.from(context : Context) : Baggage #

[View source]
def self.new #

[View source]

Class Method Detail

def self.clear(context : Context = Context.current) : Context #

[View source]
def self.with(baggage : Baggage, context : Context = Context.current) : Context #

[View source]
def self.with(baggage : Baggage, & : -> U) : U forall U #

Activates baggage within the block.


[View source]

Instance Method Detail

def []?(name : String) : String | Nil #

[View source]
def delete(name : String) : Baggage #

[View source]
def each(& : Tuple(String, Entry) -> ) : Nil #
Description copied from module Enumerable({String, OpenTelemetry::Baggage::Entry})

Must yield this collection's elements to the block.


[View source]
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.

[View source]
def entry?(name : String) : Entry | Nil #

[View source]
def set(name : String, value : String, metadata : String | Nil = nil) : Baggage #

Returns baggage with the entry for name replaced.


[View source]
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

[View source]
def to_h : Hash(String, String) #

Returns an independent map of names to values.


[View source]