Package io.opentelemetry.api.common
Interface AttributeKey<T>
- Type Parameters:
T
- The type of value that can be set with the key.
@Immutable
public interface AttributeKey<T>
This interface provides a handle for setting the values of
Attributes
. The type of value
that can be set with an implementation of this key is denoted by the type parameter.
Implementations MUST be immutable, as these are used as the keys to Maps.
-
Method Summary
Modifier and TypeMethodDescriptionstatic AttributeKey<List<Boolean>>
booleanArrayKey
(String key) Returns a new AttributeKey for List<Boolean> valued attributes.static AttributeKey<Boolean>
booleanKey
(String key) Returns a new AttributeKey for Boolean valued attributes.static AttributeKey<List<Double>>
doubleArrayKey
(String key) Returns a new AttributeKey for List<Double> valued attributes.static AttributeKey<Double>
Returns a new AttributeKey for Double valued attributes.getKey()
Returns the underlying String representation of the key.getType()
Returns the type of attribute for this key.static AttributeKey<List<Long>>
longArrayKey
(String key) Returns a new AttributeKey for List<Long> valued attributes.static AttributeKey<Long>
Returns a new AttributeKey for Long valued attributes.static AttributeKey<List<String>>
stringArrayKey
(String key) Returns a new AttributeKey for List<String> valued attributes.static AttributeKey<String>
Returns a new AttributeKey for String valued attributes.
-
Method Details
-
getKey
String getKey()Returns the underlying String representation of the key. -
getType
AttributeType getType()Returns the type of attribute for this key. Useful for building switch statements. -
stringKey
Returns a new AttributeKey for String valued attributes. -
booleanKey
Returns a new AttributeKey for Boolean valued attributes. -
longKey
Returns a new AttributeKey for Long valued attributes. -
doubleKey
Returns a new AttributeKey for Double valued attributes. -
stringArrayKey
Returns a new AttributeKey for List<String> valued attributes. -
booleanArrayKey
Returns a new AttributeKey for List<Boolean> valued attributes. -
longArrayKey
Returns a new AttributeKey for List<Long> valued attributes. -
doubleArrayKey
Returns a new AttributeKey for List<Double> valued attributes.
-