Interface ExtendedAttributeKey<T>

Type Parameters:
T - The type of value that can be set with the key.

@Immutable public interface ExtendedAttributeKey<T>
This interface provides a handle for setting the values of ExtendedAttributes. 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.

The allowed getType()s is a superset of those allowed in AttributeKey.

Convenience methods are provided for translating to / from AttributeKey:

  • Method Details

    • getKey

      String getKey()
      Returns the underlying String representation of the key.
    • getType

      Returns the type of attribute for this key. Useful for building switch statements.
    • asAttributeKey

      @Nullable default io.opentelemetry.api.common.AttributeKey<T> asAttributeKey()
      Return the equivalent AttributeKey, or null if the getType() has no equivalent AttributeType.
    • fromAttributeKey

      static <T> ExtendedAttributeKey<T> fromAttributeKey(io.opentelemetry.api.common.AttributeKey<T> attributeKey)
      Return an ExtendedAttributeKey equivalent to the attributeKey.
    • stringKey

      static ExtendedAttributeKey<String> stringKey(String key)
      Returns a new ExtendedAttributeKey for String valued attributes.
    • booleanKey

      static ExtendedAttributeKey<Boolean> booleanKey(String key)
      Returns a new ExtendedAttributeKey for Boolean valued attributes.
    • longKey

      static ExtendedAttributeKey<Long> longKey(String key)
      Returns a new ExtendedAttributeKey for Long valued attributes.
    • doubleKey

      static ExtendedAttributeKey<Double> doubleKey(String key)
      Returns a new ExtendedAttributeKey for Double valued attributes.
    • stringArrayKey

      static ExtendedAttributeKey<List<String>> stringArrayKey(String key)
      Returns a new ExtendedAttributeKey for List<String> valued attributes.
    • booleanArrayKey

      static ExtendedAttributeKey<List<Boolean>> booleanArrayKey(String key)
      Returns a new ExtendedAttributeKey for List<Boolean> valued attributes.
    • longArrayKey

      static ExtendedAttributeKey<List<Long>> longArrayKey(String key)
      Returns a new ExtendedAttributeKey for List<Long> valued attributes.
    • doubleArrayKey

      static ExtendedAttributeKey<List<Double>> doubleArrayKey(String key)
      Returns a new ExtendedAttributeKey for List<Double> valued attributes.
    • extendedAttributesKey

      static ExtendedAttributeKey<ExtendedAttributes> extendedAttributesKey(String key)
      Returns a new ExtendedAttributeKey for Map valued attributes.