Skip to content

Commit f66919d

Browse files
committed
POC: Complex attributes (Option A)
1 parent 9868c85 commit f66919d

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

api/all/src/main/java/io/opentelemetry/api/common/AttributeKey.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ public interface AttributeKey<T> {
2626
/** Returns the type of attribute for this key. Useful for building switch statements. */
2727
AttributeType getType();
2828

29-
// TODO (jack-berg): uncomment when extended attributes are promoted from incubator to API
30-
// default ExtendedAttributeKey<T> asExtendedAttributeKey() {
31-
// return InternalAttributeKeyImpl.toExtendedAttributeKey(this);
32-
// }
33-
3429
/** Returns a new AttributeKey for String valued attributes. */
3530
static AttributeKey<String> stringKey(String key) {
3631
return InternalAttributeKeyImpl.create(key, AttributeType.STRING);
@@ -70,4 +65,16 @@ static AttributeKey<List<Long>> longArrayKey(String key) {
7065
static AttributeKey<List<Double>> doubleArrayKey(String key) {
7166
return InternalAttributeKeyImpl.create(key, AttributeType.DOUBLE_ARRAY);
7267
}
68+
69+
static AttributeKey<byte[]> byteArrayKey(String key) {
70+
return InternalAttributeKeyImpl.create(key, AttributeType.BYTE_ARRAY);
71+
}
72+
73+
static AttributeKey<List<Value<?>>> valueArrayKey(String key) {
74+
return InternalAttributeKeyImpl.create(key, AttributeType.VALUE_ARRAY);
75+
}
76+
77+
static AttributeKey<Attributes> mapKey(String key) {
78+
return InternalAttributeKeyImpl.create(key, AttributeType.MAP);
79+
}
7380
}

api/all/src/main/java/io/opentelemetry/api/common/AttributeType.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@ public enum AttributeType {
1717
STRING_ARRAY,
1818
BOOLEAN_ARRAY,
1919
LONG_ARRAY,
20-
DOUBLE_ARRAY
20+
DOUBLE_ARRAY,
21+
BYTE_ARRAY,
22+
VALUE_ARRAY,
23+
MAP
2124
}

api/all/src/main/java/io/opentelemetry/api/common/Value.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ static Value<List<KeyValue>> of(Map<String, Value<?>> value) {
8484
return KeyValueList.createFromMap(value);
8585
}
8686

87+
static Value<List<KeyValue>> of(Attributes attributes) {
88+
// TODO
89+
}
90+
8791
/** Returns the type of this {@link Value}. Useful for building switch statements. */
8892
ValueType getType();
8993

0 commit comments

Comments
 (0)