struct OpenTelemetry::AnyValue

Overview

A scalar, byte sequence, array, or map suitable for telemetry attributes. Mutable input is copied and readers receive independent copies. Arrays and maps take more work to convert and render than scalars. Concurrency: immutable and safe to share.

Defined in:

api/any_value.cr

Constant Summary

EMPTY = new(nil)

Constructors

Instance Method Summary

Constructor Detail

def self.new(value : Bool | Int64 | Float64 | String | Nil) #

[View source]
def self.new(value : Array(T)) : AnyValue forall T #

[View source]
def self.new(value : Hash(String, T)) : AnyValue forall T #

[View source]
def self.new(value : AnyValue) : AnyValue #

[View source]
def self.new(value : Bytes) : AnyValue #

[View source]
def self.new(value : Int8 | Int16 | Int32 | UInt8 | UInt16 | UInt32) : AnyValue #

[View source]
def self.new(value : UInt64 | Int128 | UInt128) : AnyValue #

[View source]
def self.new(value : Float32) : AnyValue #

[View source]
def self.new(value : NamedTuple) : AnyValue #

[View source]

Instance Method Detail

def ==(other : AnyValue) : Bool #

[View source]
def []?(index : Int) : AnyValue | Nil #

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

[View source]
def as_bool? : Bool | Nil #

[View source]
def as_bytes? : Bytes | Nil #

[View source]
def as_f64? : Float64 | Nil #

[View source]
def as_i64? : Int64 | Nil #

[View source]
def as_s? : String | Nil #

[View source]
def each_element(& : AnyValue -> ) : Nil #

[View source]
def each_entry(& : String, AnyValue -> ) : Nil #

[View source]
def empty? : Bool #

[View source]
def hash(hasher) #
Description copied from struct Struct

See Object#hash(hasher)


[View source]
def kind : Kind #

[View source]
def size : Int32 #

Returns the number of elements, entries, or bytes. Scalars have size zero.


[View source]
def to_a : Array(AnyValue) | Nil #

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

[View source]
def to_s(io : IO) : Nil #

Writes the representation for protocols that carry attribute values as strings.


[View source]
def unwrap : Bool | Int64 | Float64 | String | Bytes | Array(AnyValue) | Hash(String, AnyValue) | Nil #

[View source]
def write_bytes(io : IO) : Nil #

Writes an independent byte slice when the value contains bytes.


[View source]