struct
OpenTelemetry::Attributes
- OpenTelemetry::Attributes
- Struct
- Value
- Object
Overview
Insertion-ordered telemetry attributes with unique, non-empty keys. Concurrency: immutable and safe to share.
Included Modules
- Enumerable({String, OpenTelemetry::AnyValue})
Defined in:
api/attributes.crConstant Summary
-
EMPTY =
new
Constructors
- .build(& : Builder -> ) : Attributes
- .from(value : Nil) : Attributes
- .from(value : Attributes) : Attributes
-
.from(value) : Attributes
Converts a Hash, NamedTuple, or enumerable of key-value pairs.
- .new
Instance Method Summary
- #==(other : self)
- #[]?(key : String) : AnyValue | Nil
-
#each(& : Tuple(String, AnyValue) -> ) : Nil
Must yield this collection's elements to the block.
-
#empty? : Bool
Returns
trueifselfdoes not contain any element. - #has_key?(key : String) : Bool
-
#hash(hasher)
See
Object#hash(hasher) - #keys : Array(String)
-
#merge(other : Attributes) : Attributes
Merges two collections.
-
#size : Int32
Returns the number of elements in the collection.
-
#to_h : Hash(String, AnyValue)
Creates a
Hashout of an Enumerable where each element is a 2 element structure (for instance aTupleor anArray).
Constructor Detail
Instance Method Detail
Must yield this collection's elements to the block.
Returns true if self does not contain any element.
([] of Int32).empty? # => true
([1]).empty? # => false
[nil, false].empty? # => false
#present?returns the inverse.
Merges two collections. Entries in other win on duplicate keys.
Returns the number of elements in the collection.
[1, 2, 3, 4].size # => 4
Creates a Hash out of an Enumerable where each element is a
2 element structure (for instance a Tuple or an Array).
[[:a, :b], [:c, :d]].to_h # => {:a => :b, :c => :d}
Tuple.new({:a, 1}, {:c, 2}).to_h # => {:a => 1, :c => 2}