Skip to content

Commit dd5d7a0

Browse files
authored
[grid] Upgrade OpenTelemetry to 0.12.0 (#9029)
* [grid] Upgrade OpenTelemetry to 0.11.0 * [grid] Upgrade OpenTelemetry to 0.12.0
1 parent c507192 commit dd5d7a0

File tree

10 files changed

+325
-424
lines changed

10 files changed

+325
-424
lines changed

java/client/src/org/openqa/selenium/remote/tracing/EventAttribute.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ public static EventAttributeValue setValue(String... value) {
3838
return new EventAttributeValue(value);
3939
}
4040

41-
public static EventAttributeValue setValue(Long... value) {
41+
public static EventAttributeValue setValue(long... value) {
4242
return new EventAttributeValue(value);
4343
}
4444

45-
public static EventAttributeValue setValue(Double... value) {
45+
public static EventAttributeValue setValue(double... value) {
4646
return new EventAttributeValue(value);
4747
}
4848

49-
public static EventAttributeValue setValue(Boolean... value) {
49+
public static EventAttributeValue setValue(boolean... value) {
5050
return new EventAttributeValue(value);
5151
}
5252

java/client/src/org/openqa/selenium/remote/tracing/EventAttributeValue.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ public class EventAttributeValue {
2626
private final Type type;
2727
private String stringValue;
2828
private Number numberValue;
29-
private Boolean booleanValue;
29+
private boolean booleanValue;
3030
private String[] stringArrayValue;
31-
private Long[] longArrayValue;
32-
private Double[] doubleArrayValue;
33-
private Boolean[] booleanArrayValue;
31+
private long[] longArrayValue;
32+
private double[] doubleArrayValue;
33+
private boolean[] booleanArrayValue;
3434

3535
public EventAttributeValue(String value) {
3636
this.stringValue = value;
@@ -58,19 +58,19 @@ public EventAttributeValue(String[] value) {
5858
this.type = Type.STRING_ARRAY;
5959
}
6060

61-
public EventAttributeValue(Long[] value) {
61+
public EventAttributeValue(long[] value) {
6262
Require.nonNull("Value", value);
6363
this.longArrayValue = Arrays.copyOf(value, value.length);
6464
this.type = Type.LONG_ARRAY;
6565
}
6666

67-
public EventAttributeValue(Double[] value) {
67+
public EventAttributeValue(double[] value) {
6868
Require.nonNull("Value", value);
6969
this.doubleArrayValue = Arrays.copyOf(value, value.length);
7070
this.type = Type.DOUBLE_ARRAY;
7171
}
7272

73-
public EventAttributeValue(Boolean[] value) {
73+
public EventAttributeValue(boolean[] value) {
7474
Require.nonNull("Value", value);
7575
this.booleanArrayValue = Arrays.copyOf(value, value.length);
7676
this.type = Type.BOOLEAN_ARRAY;
@@ -90,11 +90,11 @@ public Boolean getBooleanValue() {
9090

9191
public String[] getStringArrayValue() { return Arrays.copyOf(stringArrayValue, stringArrayValue.length); }
9292

93-
public Long[] getLongArrayValue() { return Arrays.copyOf(longArrayValue, longArrayValue.length); }
93+
public long[] getLongArrayValue() { return Arrays.copyOf(longArrayValue, longArrayValue.length); }
9494

95-
public Double[] getDoubleArrayValue() { return Arrays.copyOf(doubleArrayValue, doubleArrayValue.length); }
95+
public double[] getDoubleArrayValue() { return Arrays.copyOf(doubleArrayValue, doubleArrayValue.length); }
9696

97-
public Boolean[] getBooleanArrayValue() { return Arrays.copyOf(booleanArrayValue, booleanArrayValue.length); }
97+
public boolean[] getBooleanArrayValue() { return Arrays.copyOf(booleanArrayValue, booleanArrayValue.length); }
9898

9999
public Type getAttributeType() {
100100
return type;

java/client/src/org/openqa/selenium/remote/tracing/opentelemetry/OpenTelemetrySpan.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.google.common.collect.ImmutableMap;
2121
import com.google.common.primitives.Primitives;
2222
import io.opentelemetry.api.common.Attributes;
23+
import io.opentelemetry.api.common.AttributesBuilder;
2324
import io.opentelemetry.context.Scope;
2425
import io.opentelemetry.context.Context;
2526
import io.opentelemetry.api.trace.SpanContext;
@@ -90,7 +91,7 @@ public Span addEvent(String name) {
9091
public Span addEvent(String name, Map<String, EventAttributeValue> attributeMap) {
9192
Require.nonNull("Name", name);
9293
Require.nonNull("Event Attribute Map", attributeMap);
93-
Attributes.Builder otAttributes = Attributes.builder();
94+
AttributesBuilder otAttributes = Attributes.builder();
9495

9596
attributeMap.forEach(
9697
(key, value) -> {

java/client/test/org/openqa/selenium/remote/tracing/opentelemetry/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ java_test_suite(
1313
artifact("io.opentelemetry:opentelemetry-api"),
1414
artifact("io.opentelemetry:opentelemetry-sdk"),
1515
artifact("io.opentelemetry:opentelemetry-sdk-common"),
16-
artifact("io.opentelemetry:opentelemetry-sdk-tracing"),
16+
artifact("io.opentelemetry:opentelemetry-sdk-trace"),
1717
artifact("io.opentelemetry:opentelemetry-context"),
1818
artifact("junit:junit"),
1919
artifact("org.assertj:assertj-core"),

java/client/test/org/openqa/selenium/remote/tracing/opentelemetry/TracerTest.java

+16-17
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import io.opentelemetry.api.OpenTelemetry;
2121
import io.opentelemetry.api.common.AttributeKey;
2222
import io.opentelemetry.api.common.Attributes;
23+
import io.opentelemetry.api.common.AttributesBuilder;
2324
import io.opentelemetry.api.trace.StatusCode;
2425
import io.opentelemetry.context.propagation.ContextPropagators;
2526
import io.opentelemetry.context.propagation.DefaultContextPropagators;
@@ -84,7 +85,7 @@ public void shouldBeAbleToCreateATracer() {
8485

8586
assertThat(values).hasSize(1);
8687
assertThat(values).element(0)
87-
.extracting(SpanData::getStatus).extracting(SpanData.Status::getCanonicalCode).isEqualTo(
88+
.extracting(SpanData::getStatus).extracting(SpanData.Status::getStatusCode).isEqualTo(
8889
StatusCode.ERROR);
8990
assertThat(values).element(0)
9091
.extracting(el -> el.getAttributes().get(AttributeKey.stringKey("cheese"))).isEqualTo("gouda");
@@ -196,7 +197,7 @@ public void canCreateASpanEventWithBooleanAttribute() {
196197
String event = "Test event";
197198
String attribute = "testBoolean";
198199

199-
Attributes.Builder attributes = Attributes.builder();
200+
AttributesBuilder attributes = Attributes.builder();
200201
attributes.put(attribute, false);
201202

202203
try (Span span = tracer.getCurrentContext().createSpan("parent")) {
@@ -218,9 +219,9 @@ public void canCreateASpanEventWithBooleanArrayAttributes() {
218219
String event = "Test event";
219220
String arrayKey = "booleanArray";
220221
String varArgsKey = "booleanVarArgs";
221-
Boolean[] booleanArray = new Boolean[]{true, false};
222+
boolean[] booleanArray = new boolean[]{true, false};
222223

223-
Attributes.Builder attributes = Attributes.builder();
224+
AttributesBuilder attributes = Attributes.builder();
224225
attributes.put(arrayKey, booleanArray);
225226
attributes.put(varArgsKey, true, false, true);
226227

@@ -245,7 +246,7 @@ public void canCreateASpanEventWithDoubleAttribute() {
245246
String attribute = "testDouble";
246247
Double attributeValue = 1.1;
247248

248-
Attributes.Builder attributes = Attributes.builder();
249+
AttributesBuilder attributes = Attributes.builder();
249250
attributes.put(attribute, attributeValue);
250251

251252
try (Span span = tracer.getCurrentContext().createSpan("parent")) {
@@ -267,9 +268,9 @@ public void canCreateASpanEventWithDoubleArrayAttributes() {
267268
String event = "Test event";
268269
String arrayKey = "doubleArray";
269270
String varArgsKey = "doubleVarArgs";
270-
Double[] doubleArray = new Double[]{4.5, 2.5};
271+
double[] doubleArray = new double[]{4.5, 2.5};
271272

272-
Attributes.Builder attributes = Attributes.builder();
273+
AttributesBuilder attributes = Attributes.builder();
273274
attributes.put(arrayKey, doubleArray);
274275
attributes.put(varArgsKey, 2.2, 5.3);
275276

@@ -294,7 +295,7 @@ public void canCreateASpanEventWithLongAttribute() {
294295
String attribute = "testLong";
295296
Long attributeValue = 500L;
296297

297-
Attributes.Builder attributes = Attributes.builder();
298+
AttributesBuilder attributes = Attributes.builder();
298299
attributes.put(attribute, attributeValue);
299300

300301
try (Span span = tracer.getCurrentContext().createSpan("parent")) {
@@ -316,9 +317,9 @@ public void canCreateASpanEventWithLongArrayAttributes() {
316317
String event = "Test event";
317318
String arrayKey = "longArray";
318319
String varArgsKey = "longVarArgs";
319-
Long[] longArray = new Long[]{400L, 200L};
320+
long[] longArray = new long[]{400L, 200L};
320321

321-
Attributes.Builder attributes = Attributes.builder();
322+
AttributesBuilder attributes = Attributes.builder();
322323
attributes.put(arrayKey, longArray);
323324
attributes.put(varArgsKey, 250L, 5L);
324325

@@ -343,7 +344,7 @@ public void canCreateASpanEventWithStringAttribute() {
343344
String attribute = "testString";
344345
String attributeValue = "attributeValue";
345346

346-
Attributes.Builder attributes = Attributes.builder();
347+
AttributesBuilder attributes = Attributes.builder();
347348
attributes.put(attribute, attributeValue);
348349

349350
try (Span span = tracer.getCurrentContext().createSpan("parent")) {
@@ -367,7 +368,7 @@ public void canCreateASpanEventWithStringArrayAttributes() {
367368
String varArgsKey = "strVarArgs";
368369
String[] strArray = new String[]{"hey", "hello"};
369370

370-
Attributes.Builder attributes = Attributes.builder();
371+
AttributesBuilder attributes = Attributes.builder();
371372
attributes.put(arrayKey, strArray);
372373
attributes.put(varArgsKey, "hi", "hola");
373374

@@ -392,7 +393,7 @@ public void canCreateASpanEventWithSameAttributeType() {
392393
String attribute = "testString";
393394
String attributeValue = "Hey";
394395

395-
Attributes.Builder attributes = Attributes.builder();
396+
AttributesBuilder attributes = Attributes.builder();
396397
attributes.put(attribute, attributeValue);
397398
attributes.put(attribute, attributeValue);
398399

@@ -415,11 +416,9 @@ public void canCreateASpanEventWithMultipleAttributeTypes() {
415416
Tracer tracer = createTracer(allSpans);
416417
String event = "Test event";
417418
String[] stringArray = new String[]{"Hey", "Hello"};
418-
Long[] longArray = new Long[]{10L, 5L};
419-
Double[] doubleArray = new Double[]{4.5, 2.5};
420-
Boolean[] booleanArray = new Boolean[]{true, false};
419+
boolean[] booleanArray = new boolean[]{true, false};
421420

422-
Attributes.Builder attributes = Attributes.builder();
421+
AttributesBuilder attributes = Attributes.builder();
423422
attributes.put("testFloat", 5.5f);
424423
attributes.put("testInt", 10);
425424
attributes.put("testStringArray", stringArray);

java/maven_deps.bzl

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ load("@rules_jvm_external//:specs.bzl", "maven")
33

44
def selenium_java_deps():
55
netty_version = "4.1.53.Final"
6-
opentelemetry_version = "0.10.0"
6+
opentelemetry_version = "0.12.0"
77

88
maven_install(
99
artifacts = [
@@ -45,7 +45,7 @@ def selenium_java_deps():
4545
"io.opentelemetry:opentelemetry-sdk-testing:%s" % opentelemetry_version,
4646
"io.opentelemetry:opentelemetry-sdk:%s" % opentelemetry_version,
4747
"io.opentelemetry:opentelemetry-sdk-common:%s" % opentelemetry_version,
48-
"io.opentelemetry:opentelemetry-sdk-tracing:%s" % opentelemetry_version,
48+
"io.opentelemetry:opentelemetry-sdk-trace:%s" % opentelemetry_version,
4949
"io.ous:jtoml:2.0.0",
5050
"it.ozimov:embedded-redis:0.7.3",
5151
"io.projectreactor:reactor-core:3.4.0",

0 commit comments

Comments
 (0)