Skip to content

Commit e2a9dd9

Browse files
committed
Rename EXTENDED_ATTRIBUTES to MAP
1 parent 36ca9b8 commit e2a9dd9

File tree

10 files changed

+20
-26
lines changed

10 files changed

+20
-26
lines changed

api/incubator/src/main/java/io/opentelemetry/api/incubator/common/ExtendedAttributeKey.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ static ExtendedAttributeKey<List<Double>> doubleArrayKey(String key) {
9393
return fromAttributeKey(AttributeKey.doubleArrayKey(key));
9494
}
9595

96-
/** Returns a new ExtendedAttributeKey for Map valued attributes. */
97-
static ExtendedAttributeKey<ExtendedAttributes> extendedAttributesKey(String key) {
98-
return InternalExtendedAttributeKeyImpl.create(key, ExtendedAttributeType.EXTENDED_ATTRIBUTES);
96+
/** Returns a new ExtendedAttributeKey for map valued attributes. */
97+
static ExtendedAttributeKey<ExtendedAttributes> mapKey(String key) {
98+
return InternalExtendedAttributeKeyImpl.create(key, ExtendedAttributeType.MAP);
9999
}
100100
}

api/incubator/src/main/java/io/opentelemetry/api/incubator/common/ExtendedAttributeType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ public enum ExtendedAttributeType {
2222
LONG_ARRAY,
2323
DOUBLE_ARRAY,
2424
// Extended types unique to ExtendedAttributes
25-
EXTENDED_ATTRIBUTES;
25+
MAP;
2626
}

api/incubator/src/main/java/io/opentelemetry/api/incubator/common/ExtendedAttributes.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
*
1919
* <p>"extended" refers an extended set of allowed value types compared to standard {@link
2020
* Attributes}. Notably, {@link ExtendedAttributes} values can be of type {@link
21-
* ExtendedAttributeType#EXTENDED_ATTRIBUTES}, allowing nested {@link ExtendedAttributes} of
22-
* arbitrary depth.
21+
* ExtendedAttributeType#MAP}, allowing nested {@link ExtendedAttributes} of arbitrary depth.
2322
*
2423
* <p>Where standard {@link Attributes} are accepted everyone that OpenTelemetry represents key /
2524
* value pairs, {@link ExtendedAttributes} are only accepted in select places, such as log records

api/incubator/src/main/java/io/opentelemetry/api/incubator/common/ExtendedAttributesBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ default ExtendedAttributesBuilder put(String key, boolean value) {
9494
* @return this Builder
9595
*/
9696
default <T> ExtendedAttributesBuilder put(String key, ExtendedAttributes value) {
97-
return put(ExtendedAttributeKey.extendedAttributesKey(key), value);
97+
return put(ExtendedAttributeKey.mapKey(key), value);
9898
}
9999

100100
/**

api/incubator/src/main/java/io/opentelemetry/api/incubator/internal/InternalExtendedAttributeKeyImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public static <T> AttributeKey<T> toAttributeKey(ExtendedAttributeKey<T> extende
138138
case DOUBLE_ARRAY:
139139
return InternalAttributeKeyImpl.create(
140140
extendedAttributeKey.getKey(), AttributeType.DOUBLE_ARRAY);
141-
case EXTENDED_ATTRIBUTES:
141+
case MAP:
142142
return null;
143143
}
144144
throw new IllegalArgumentException(

api/incubator/src/test/java/io/opentelemetry/api/incubator/common/ExtendedAttributeKeyTest.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ private static Stream<Arguments> attributeKeyArgs() {
7676
"key",
7777
ExtendedAttributeType.DOUBLE_ARRAY,
7878
AttributeKey.doubleArrayKey("key")),
79-
Arguments.of(
80-
ExtendedAttributeKey.extendedAttributesKey("key"),
81-
"key",
82-
ExtendedAttributeType.EXTENDED_ATTRIBUTES,
83-
null));
79+
Arguments.of(ExtendedAttributeKey.mapKey("key"), "key", ExtendedAttributeType.MAP, null));
8480
}
8581
}

api/incubator/src/test/java/io/opentelemetry/api/incubator/common/ExtendedAttributesTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private static void assertEquals(
9595
assertThat(actual.size()).isEqualTo(expected.size());
9696
actual.forEach(
9797
(key, value) -> {
98-
if (key.getType() == ExtendedAttributeType.EXTENDED_ATTRIBUTES) {
98+
if (key.getType() == ExtendedAttributeType.MAP) {
9999
assertEquals(
100100
((ExtendedAttributes) value).asMap(),
101101
(Map<String, Object>) expected.get(key.getKey()));
@@ -161,7 +161,7 @@ private static ExtendedAttributes fromMap(Map<String, Object> map) {
161161
map.forEach(
162162
(key, value) -> {
163163
ExtendedAttributeKey<?> extendedAttributeKey = getKey(key, value);
164-
if (extendedAttributeKey.getType() == ExtendedAttributeType.EXTENDED_ATTRIBUTES) {
164+
if (extendedAttributeKey.getType() == ExtendedAttributeType.MAP) {
165165
builder.put(
166166
(ExtendedAttributeKey<ExtendedAttributes>) extendedAttributeKey,
167167
fromMap((Map<String, Object>) value));
@@ -249,7 +249,7 @@ private static Stream<Arguments> attributesArgs() {
249249
Arguments.of(
250250
ExtendedAttributes.builder()
251251
.put(
252-
ExtendedAttributeKey.extendedAttributesKey("key"),
252+
ExtendedAttributeKey.mapKey("key"),
253253
ExtendedAttributes.builder().put("child", "value").build())
254254
.build(),
255255
ImmutableMap.builder()
@@ -287,7 +287,7 @@ private static Map<String, Object> toMap(ExtendedAttributes extendedAttributes)
287287
Map<String, Object> map = new HashMap<>();
288288
extendedAttributes.forEach(
289289
(key, value) -> {
290-
if (key.getType() == ExtendedAttributeType.EXTENDED_ATTRIBUTES) {
290+
if (key.getType() == ExtendedAttributeType.MAP) {
291291
map.put(key.getKey(), toMap((ExtendedAttributes) value));
292292
return;
293293
}
@@ -314,8 +314,8 @@ private static ExtendedAttributeKey<?> getKey(String key, Object value) {
314314
return ExtendedAttributeKey.longArrayKey(key);
315315
case DOUBLE_ARRAY:
316316
return ExtendedAttributeKey.doubleArrayKey(key);
317-
case EXTENDED_ATTRIBUTES:
318-
return ExtendedAttributeKey.extendedAttributesKey(key);
317+
case MAP:
318+
return ExtendedAttributeKey.mapKey(key);
319319
}
320320
throw new IllegalArgumentException();
321321
}
@@ -353,7 +353,7 @@ private static ExtendedAttributeType getType(Object value) {
353353
}
354354
}
355355
if ((value instanceof Map)) {
356-
return ExtendedAttributeType.EXTENDED_ATTRIBUTES;
356+
return ExtendedAttributeType.MAP;
357357
}
358358
throw new IllegalArgumentException("Unrecognized value type: " + value);
359359
}

api/incubator/src/test/java/io/opentelemetry/api/incubator/logs/ExtendedLogsBridgeApiUsageTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ private static String flipCoin() {
104104
AttributeKey<List<Double>> doubleArrKey = AttributeKey.doubleArrayKey("acme.double_array");
105105

106106
// Extended keys
107-
ExtendedAttributeKey<ExtendedAttributes> mapKey =
108-
ExtendedAttributeKey.extendedAttributesKey("acme.map");
107+
ExtendedAttributeKey<ExtendedAttributes> mapKey = ExtendedAttributeKey.mapKey("acme.map");
109108

110109
@Test
111110
@SuppressLogger(ExtendedLogsBridgeApiUsageTest.class)
@@ -148,7 +147,7 @@ void extendedAttributesUsage() {
148147
// acme.double_array(DOUBLE_ARRAY): [1.1, 2.2]
149148
// acme.long(LONG): 1
150149
// acme.long_array(LONG_ARRAY): [1, 2]
151-
// acme.map(EXTENDED_ATTRIBUTES): {childLong=1, childStr="value"}
150+
// acme.map(MAP): {childLong=1, childStr="value"}
152151
// acme.string(STRING): value
153152
// acme.string_array(STRING_ARRAY): [value1, value2]
154153
extendedAttributes.forEach(

exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/ExtendedAttributeKeyValueStatelessMarshaler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public int getBinarySerializedSize(
168168
(List<Object>) value,
169169
AttributeArrayAnyValueStatelessMarshaler.INSTANCE,
170170
context);
171-
case EXTENDED_ATTRIBUTES:
171+
case MAP:
172172
return StatelessMarshalerUtil.sizeMessageWithContext(
173173
AnyValue.KVLIST_VALUE,
174174
(ExtendedAttributes) value,
@@ -213,7 +213,7 @@ public void writeTo(
213213
AttributeArrayAnyValueStatelessMarshaler.INSTANCE,
214214
context);
215215
return;
216-
case EXTENDED_ATTRIBUTES:
216+
case MAP:
217217
output.serializeMessageWithContext(
218218
AnyValue.KVLIST_VALUE,
219219
(ExtendedAttributes) value,

exporters/otlp/common/src/main/java/io/opentelemetry/exporter/internal/otlp/IncubatingUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ private static KeyValueMarshaler create(ExtendedAttributeKey<?> attributeKey, Ob
110110
case DOUBLE_ARRAY:
111111
return new KeyValueMarshaler(
112112
keyUtf8, ArrayAnyValueMarshaler.createDouble((List<Double>) value));
113-
case EXTENDED_ATTRIBUTES:
113+
case MAP:
114114
return new KeyValueMarshaler(
115115
keyUtf8,
116116
new KeyValueListAnyValueMarshaler(

0 commit comments

Comments
 (0)