Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/all/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {

id("otel.jmh-conventions")
id("otel.animalsniffer-conventions")
id("org.jetbrains.kotlin.jvm")
}

description = "OpenTelemetry API"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.api.common

import io.opentelemetry.api.internal.InternalAttributeKeyImpl
import javax.annotation.concurrent.Immutable

/**
* 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.
*
* @param <T> The type of value that can be set with the key.
</T> */
@Immutable
interface AttributeKey<T> {

/** Returns the underlying String representation of the key. */
val key: String?

/** Returns the type of attribute for this key. Useful for building switch statements. */
val type: AttributeType?

companion object {
/** Returns a new AttributeKey for String valued attributes. */
@JvmStatic
fun stringKey(key: String?): AttributeKey<String> {
return InternalAttributeKeyImpl.create(key, AttributeType.STRING)
}

/** Returns a new AttributeKey for Boolean valued attributes. */
@JvmStatic
fun booleanKey(key: String?): AttributeKey<Boolean> {
return InternalAttributeKeyImpl.create(key, AttributeType.BOOLEAN)
}

/** Returns a new AttributeKey for Long valued attributes. */
@JvmStatic
fun longKey(key: String?): AttributeKey<Long> {
return InternalAttributeKeyImpl.create(key, AttributeType.LONG)
}

/** Returns a new AttributeKey for Double valued attributes. */
@JvmStatic
fun doubleKey(key: String?): AttributeKey<Double> {
return InternalAttributeKeyImpl.create(key, AttributeType.DOUBLE)
}

/** Returns a new AttributeKey for List&lt;String&gt; valued attributes. */
@JvmStatic
fun stringArrayKey(key: String?): AttributeKey<List<String>> {
return InternalAttributeKeyImpl.create(key, AttributeType.STRING_ARRAY)
}

/** Returns a new AttributeKey for List&lt;Boolean&gt; valued attributes. */
@JvmStatic
fun booleanArrayKey(key: String?): AttributeKey<List<Boolean>> {
return InternalAttributeKeyImpl.create(key, AttributeType.BOOLEAN_ARRAY)
}

/** Returns a new AttributeKey for List&lt;Long&gt; valued attributes. */
@JvmStatic
fun longArrayKey(key: String?): AttributeKey<List<Long>> {
return InternalAttributeKeyImpl.create(key, AttributeType.LONG_ARRAY)
}

/** Returns a new AttributeKey for List&lt;Double&gt; valued attributes. */
@JvmStatic
fun doubleArrayKey(key: String?): AttributeKey<List<Double>> {
return InternalAttributeKeyImpl.create(key, AttributeType.DOUBLE_ARRAY)
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.api.common

/**
* An enum that represents all the possible value types for an `AttributeKey` and hence the
* types of values that are allowed for [Attributes].
*/
enum class AttributeType {
STRING,
BOOLEAN,
LONG,
DOUBLE,
STRING_ARRAY,
BOOLEAN_ARRAY,
LONG_ARRAY,
DOUBLE_ARRAY
}
177 changes: 0 additions & 177 deletions api/all/src/main/java/io/opentelemetry/api/common/Attributes.java

This file was deleted.

Loading
Loading