class OpenTelemetry::API::Resource
Defined in:
api/resource.crConstructors
-
.new(attrs)
Create a new Resource that has been intialized by the provided key/value pairs.
-
.new
Create an empty Resource.
Instance Method Summary
-
#[](key)
Retrieve the value for a key in the Resource.
-
#[]=(key, value)
Assign a value to a key in the Resource.
-
#[]?(key)
Retrieve a value for a key in the Resource.
- #attributes : Hash(String, AnyAttribute)
- #attributes=(attributes : Hash(String, AnyAttribute))
- #dropped_attribute_count : UInt32
- #dropped_attribute_count=(dropped_attribute_count : UInt32)
-
#empty?
Return true if the resource is empty.
-
#get_attribute(key)
Alias for
#[]
-
#get_attribute?(key)
Alias for
#[]?
-
#set_attribute(key, value)
Alias for
#[]=
- #to_json(json : JSON::Builder)
-
#to_json
Export the resource with a JSON representation.
-
#to_protobuf
Export the resource to its protocol buffer representation.
Instance methods inherited from class OpenTelemetry::API::AbstractResource
[](key)
[],
[]=(key, value)
[]=,
[]?(key)
[]?,
attributes
attributes,
attributes=(attributes : Hash(String, AnyAttribute))
attributes=,
dropped_attribute_count
dropped_attribute_count,
dropped_attribute_count=(dropped_attribute_count : UInt32)
dropped_attribute_count=,
empty?
empty?,
get_attribute(key)
get_attribute,
get_attribute?(key)
get_attribute?,
set_attribute(key, value)
set_attribute,
to_json(json : JSON::Builder)to_json to_json, to_protobuf to_protobuf
Constructor methods inherited from class OpenTelemetry::API::AbstractResource
new(attrs)new new
Instance methods inherited from module OpenTelemetry::Sendable
size
size,
to_json(json : JSON::Builder)to_json to_json, to_protobuf to_protobuf
Constructor Detail
def self.new(attrs)
#
Create a new Resource that has been intialized by the provided key/value pairs.
This initialization will support any seed object that provides an #each
method
which takes a two-argument block.
Instance Method Detail
def []?(key)
#
Retrieve a value for a key in the Resource. Return nil instead of an exception if the key is not present.