Skip to content

Commit 1e0267b

Browse files
authored
Merge branch 'open-telemetry:main' into main
2 parents acd7d4d + a96600e commit 1e0267b

File tree

54 files changed

+1327
-142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1327
-142
lines changed

.github/workflows/benchmark.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ jobs:
4343
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
4444

4545
# TODO (jack-berg): Select or build appropriate benchmarks for other key areas:
46-
# - Log SDK record & export
46+
# - Log SDK export
4747
# - Trace SDK export
4848
# - Metric SDK export
4949
# - Noop implementation
5050
- name: Run Benchmark
5151
run: |
5252
cd sdk/all/build
53-
java -jar libs/opentelemetry-sdk-*-jmh.jar -rf json MetricRecordBenchmark SpanRecordBenchmark
53+
java -jar libs/opentelemetry-sdk-*-jmh.jar -rf json MetricRecordBenchmark SpanRecordBenchmark LogRecordBenchmark
5454
5555
- name: Use CLA approved github bot
5656
run: .github/scripts/use-cla-approved-bot.sh

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import javax.annotation.Nullable;
1919
import javax.annotation.concurrent.Immutable;
2020

21+
@SuppressWarnings("deprecation")
2122
@Immutable
2223
final class ArrayBackedExtendedAttributes
2324
extends ImmutableKeyValuePairs<ExtendedAttributeKey<?>, Object> implements ExtendedAttributes {

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

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,14 @@
55

66
package io.opentelemetry.api.incubator.common;
77

8-
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.booleanArrayKey;
9-
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.booleanKey;
10-
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.doubleArrayKey;
11-
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.doubleKey;
12-
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.longArrayKey;
13-
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.longKey;
14-
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.stringArrayKey;
15-
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.stringKey;
16-
178
import io.opentelemetry.api.common.Value;
189
import io.opentelemetry.api.common.ValueType;
1910
import java.util.ArrayList;
2011
import java.util.Arrays;
2112
import java.util.List;
2213
import java.util.function.Predicate;
2314

15+
@SuppressWarnings("deprecation")
2416
class ArrayBackedExtendedAttributesBuilder implements ExtendedAttributesBuilder {
2517
private final List<Object> data;
2618

@@ -62,16 +54,16 @@ private void putValue(ExtendedAttributeKey<?> key, Value<?> valueObj) {
6254
String keyName = key.getKey();
6355
switch (valueObj.getType()) {
6456
case STRING:
65-
put(stringKey(keyName), ((Value<String>) valueObj).getValue());
57+
put(ExtendedAttributeKey.stringKey(keyName), ((Value<String>) valueObj).getValue());
6658
return;
6759
case LONG:
68-
put(longKey(keyName), ((Value<Long>) valueObj).getValue());
60+
put(ExtendedAttributeKey.longKey(keyName), ((Value<Long>) valueObj).getValue());
6961
return;
7062
case DOUBLE:
71-
put(doubleKey(keyName), ((Value<Double>) valueObj).getValue());
63+
put(ExtendedAttributeKey.doubleKey(keyName), ((Value<Double>) valueObj).getValue());
7264
return;
7365
case BOOLEAN:
74-
put(booleanKey(keyName), ((Value<Boolean>) valueObj).getValue());
66+
put(ExtendedAttributeKey.booleanKey(keyName), ((Value<Boolean>) valueObj).getValue());
7567
return;
7668
case ARRAY:
7769
List<Value<?>> arrayValues = (List<Value<?>>) valueObj.getValue();
@@ -82,28 +74,28 @@ private void putValue(ExtendedAttributeKey<?> key, Value<?> valueObj) {
8274
for (Value<?> v : arrayValues) {
8375
strings.add((String) v.getValue());
8476
}
85-
put(stringArrayKey(keyName), strings);
77+
put(ExtendedAttributeKey.stringArrayKey(keyName), strings);
8678
return;
8779
case LONG_ARRAY:
8880
List<Long> longs = new ArrayList<>(arrayValues.size());
8981
for (Value<?> v : arrayValues) {
9082
longs.add((Long) v.getValue());
9183
}
92-
put(longArrayKey(keyName), longs);
84+
put(ExtendedAttributeKey.longArrayKey(keyName), longs);
9385
return;
9486
case DOUBLE_ARRAY:
9587
List<Double> doubles = new ArrayList<>(arrayValues.size());
9688
for (Value<?> v : arrayValues) {
9789
doubles.add((Double) v.getValue());
9890
}
99-
put(doubleArrayKey(keyName), doubles);
91+
put(ExtendedAttributeKey.doubleArrayKey(keyName), doubles);
10092
return;
10193
case BOOLEAN_ARRAY:
10294
List<Boolean> booleans = new ArrayList<>(arrayValues.size());
10395
for (Value<?> v : arrayValues) {
10496
booleans.add((Boolean) v.getValue());
10597
}
106-
put(booleanArrayKey(keyName), booleans);
98+
put(ExtendedAttributeKey.booleanArrayKey(keyName), booleans);
10799
return;
108100
case VALUE:
109101
// Not coercible (empty, non-homogeneous, or unsupported element type)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
* </ul>
3131
*
3232
* @param <T> The type of value that can be set with the key.
33+
* @deprecated Use {@link AttributeKey} with {@link AttributeKey#valueKey(String)} instead.
3334
*/
35+
@Deprecated
3436
@Immutable
3537
public interface ExtendedAttributeKey<T> {
3638
/** Returns the underlying String representation of the key. */

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
* hence the types of values that are allowed for {@link ExtendedAttributes}.
1111
*
1212
* <p>This is a superset of {@link io.opentelemetry.api.common.AttributeType},
13+
*
14+
* @deprecated Use {@link io.opentelemetry.api.common.AttributeType} instead.
1315
*/
16+
@Deprecated
1417
public enum ExtendedAttributeType {
1518
// Types copied AttributeType
1619
STRING,

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@
4747
* {@link ExtendedAttributes}
4848
* <li>{@link #get(AttributeKey)} supports reading values using standard {@link AttributeKey}
4949
* </ul>
50+
*
51+
* @deprecated Use {@link Attributes} with {@link
52+
* io.opentelemetry.api.common.AttributeKey#valueKey(String)} instead.
5053
*/
54+
@Deprecated
5155
@Immutable
5256
public interface ExtendedAttributes {
5357

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

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,20 @@
55

66
package io.opentelemetry.api.incubator.common;
77

8-
import static io.opentelemetry.api.incubator.common.ArrayBackedExtendedAttributesBuilder.toList;
9-
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.booleanArrayKey;
10-
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.booleanKey;
11-
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.doubleArrayKey;
12-
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.doubleKey;
13-
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.longArrayKey;
14-
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.longKey;
15-
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.stringArrayKey;
16-
import static io.opentelemetry.api.incubator.common.ExtendedAttributeKey.stringKey;
17-
188
import io.opentelemetry.api.common.AttributeKey;
199
import io.opentelemetry.api.common.Attributes;
2010
import io.opentelemetry.api.common.Value;
2111
import java.util.Arrays;
2212
import java.util.List;
2313
import java.util.function.Predicate;
2414

25-
/** A builder of {@link ExtendedAttributes} supporting an arbitrary number of key-value pairs. */
15+
/**
16+
* A builder of {@link ExtendedAttributes} supporting an arbitrary number of key-value pairs.
17+
*
18+
* @deprecated Use {@link io.opentelemetry.api.common.AttributesBuilder} with {@link
19+
* io.opentelemetry.api.common.AttributeKey#valueKey(String)} instead.
20+
*/
21+
@Deprecated
2622
public interface ExtendedAttributesBuilder {
2723
/** Create the {@link ExtendedAttributes} from this. */
2824
ExtendedAttributes build();
@@ -85,7 +81,7 @@ default <T> ExtendedAttributesBuilder put(AttributeKey<T> key, T value) {
8581
* @return this Builder
8682
*/
8783
default ExtendedAttributesBuilder put(String key, String value) {
88-
return put(stringKey(key), value);
84+
return put(ExtendedAttributeKey.stringKey(key), value);
8985
}
9086

9187
/**
@@ -97,7 +93,7 @@ default ExtendedAttributesBuilder put(String key, String value) {
9793
* @return this Builder
9894
*/
9995
default ExtendedAttributesBuilder put(String key, long value) {
100-
return put(longKey(key), value);
96+
return put(ExtendedAttributeKey.longKey(key), value);
10197
}
10298

10399
/**
@@ -109,7 +105,7 @@ default ExtendedAttributesBuilder put(String key, long value) {
109105
* @return this Builder
110106
*/
111107
default ExtendedAttributesBuilder put(String key, double value) {
112-
return put(doubleKey(key), value);
108+
return put(ExtendedAttributeKey.doubleKey(key), value);
113109
}
114110

115111
/**
@@ -121,7 +117,7 @@ default ExtendedAttributesBuilder put(String key, double value) {
121117
* @return this Builder
122118
*/
123119
default ExtendedAttributesBuilder put(String key, boolean value) {
124-
return put(booleanKey(key), value);
120+
return put(ExtendedAttributeKey.booleanKey(key), value);
125121
}
126122

127123
/**
@@ -151,7 +147,7 @@ default ExtendedAttributesBuilder put(String key, String... value) {
151147
if (value == null) {
152148
return this;
153149
}
154-
return put(stringArrayKey(key), Arrays.asList(value));
150+
return put(ExtendedAttributeKey.stringArrayKey(key), Arrays.asList(value));
155151
}
156152

157153
/**
@@ -179,7 +175,8 @@ default ExtendedAttributesBuilder put(String key, long... value) {
179175
if (value == null) {
180176
return this;
181177
}
182-
return put(longArrayKey(key), toList(value));
178+
return put(
179+
ExtendedAttributeKey.longArrayKey(key), ArrayBackedExtendedAttributesBuilder.toList(value));
183180
}
184181

185182
/**
@@ -194,7 +191,9 @@ default ExtendedAttributesBuilder put(String key, double... value) {
194191
if (value == null) {
195192
return this;
196193
}
197-
return put(doubleArrayKey(key), toList(value));
194+
return put(
195+
ExtendedAttributeKey.doubleArrayKey(key),
196+
ArrayBackedExtendedAttributesBuilder.toList(value));
198197
}
199198

200199
/**
@@ -209,7 +208,9 @@ default ExtendedAttributesBuilder put(String key, boolean... value) {
209208
if (value == null) {
210209
return this;
211210
}
212-
return put(booleanArrayKey(key), toList(value));
211+
return put(
212+
ExtendedAttributeKey.booleanArrayKey(key),
213+
ArrayBackedExtendedAttributesBuilder.toList(value));
213214
}
214215

215216
/**

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
@@ -17,6 +17,7 @@
1717
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
1818
* any time.
1919
*/
20+
@SuppressWarnings("deprecation")
2021
public final class InternalExtendedAttributeKeyImpl<T> implements ExtendedAttributeKey<T> {
2122

2223
private final ExtendedAttributeType type;
@@ -115,7 +116,6 @@ private static int buildHashCode(ExtendedAttributeType type, String key) {
115116
* io.opentelemetry.api.common.AttributeType}.
116117
*/
117118
@Nullable
118-
@SuppressWarnings("deprecation") // Supporting deprecated EXTENDED_ATTRIBUTES until removed
119119
public static <T> AttributeKey<T> toAttributeKey(ExtendedAttributeKey<T> extendedAttributeKey) {
120120
switch (extendedAttributeKey.getType()) {
121121
case STRING:

api/incubator/src/main/java/io/opentelemetry/api/incubator/logs/ExtendedDefaultLogger.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import java.util.concurrent.TimeUnit;
1616
import javax.annotation.Nullable;
1717

18+
@SuppressWarnings("deprecation")
1819
class ExtendedDefaultLogger implements ExtendedLogger {
1920

2021
private static final Logger INSTANCE = new ExtendedDefaultLogger();

api/incubator/src/main/java/io/opentelemetry/api/incubator/logs/ExtendedLogRecordBuilder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import javax.annotation.Nullable;
1919

2020
/** Extended {@link LogRecordBuilder} with experimental APIs. */
21+
@SuppressWarnings("deprecation")
2122
public interface ExtendedLogRecordBuilder extends LogRecordBuilder {
2223

2324
// keep this class even if it is empty, since experimental methods may be added in the future.

0 commit comments

Comments
 (0)