struct OpenTelemetry::Trace::TraceState

Overview

An ordered collection of validated W3C tracestate members. Concurrency: immutable and safe to share.

Included Modules

Defined in:

api/trace/trace_state.cr

Constant Summary

EMPTY = new([] of ::Tuple(String, String))
MAX_MEMBERS = 32

Constructors

Instance Method Summary

Constructor Detail

def self.parse(header : String) : TraceState #

Parses a W3C Trace Context Level 2 header. Invalid headers yield an empty state.


[View source]

Instance Method Detail

def ==(other : self) #

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

[View source]
def delete(key : String) : TraceState #

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

Must yield this collection's elements to the block.


[View source]
def empty? : Bool #
Description copied from module Enumerable({String, String})

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 hash(hasher) #
Description copied from struct Struct

See Object#hash(hasher)


def set(key : String, value : String) : TraceState #

Places a member first, removing the rightmost member if necessary.


[View source]
def size : Int32 #
Description copied from module Enumerable({String, String})

Returns the number of elements in the collection.

[1, 2, 3, 4].size # => 4

[View source]
def to_header : String #

[View source]