Skip to content

[grid] Upgrade OpenTelemetry to 0.12.0 #9029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 7, 2021
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ public static EventAttributeValue setValue(String... value) {
return new EventAttributeValue(value);
}

public static EventAttributeValue setValue(Long... value) {
public static EventAttributeValue setValue(long... value) {
return new EventAttributeValue(value);
}

public static EventAttributeValue setValue(Double... value) {
public static EventAttributeValue setValue(double... value) {
return new EventAttributeValue(value);
}

public static EventAttributeValue setValue(Boolean... value) {
public static EventAttributeValue setValue(boolean... value) {
return new EventAttributeValue(value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public class EventAttributeValue {
private final Type type;
private String stringValue;
private Number numberValue;
private Boolean booleanValue;
private boolean booleanValue;
private String[] stringArrayValue;
private Long[] longArrayValue;
private Double[] doubleArrayValue;
private Boolean[] booleanArrayValue;
private long[] longArrayValue;
private double[] doubleArrayValue;
private boolean[] booleanArrayValue;

public EventAttributeValue(String value) {
this.stringValue = value;
Expand Down Expand Up @@ -58,19 +58,19 @@ public EventAttributeValue(String[] value) {
this.type = Type.STRING_ARRAY;
}

public EventAttributeValue(Long[] value) {
public EventAttributeValue(long[] value) {
Require.nonNull("Value", value);
this.longArrayValue = Arrays.copyOf(value, value.length);
this.type = Type.LONG_ARRAY;
}

public EventAttributeValue(Double[] value) {
public EventAttributeValue(double[] value) {
Require.nonNull("Value", value);
this.doubleArrayValue = Arrays.copyOf(value, value.length);
this.type = Type.DOUBLE_ARRAY;
}

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

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

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

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

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

public Type getAttributeType() {
return type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.primitives.Primitives;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.context.Scope;
import io.opentelemetry.context.Context;
import io.opentelemetry.api.trace.SpanContext;
Expand Down Expand Up @@ -90,7 +91,7 @@ public Span addEvent(String name) {
public Span addEvent(String name, Map<String, EventAttributeValue> attributeMap) {
Require.nonNull("Name", name);
Require.nonNull("Event Attribute Map", attributeMap);
Attributes.Builder otAttributes = Attributes.builder();
AttributesBuilder otAttributes = Attributes.builder();

attributeMap.forEach(
(key, value) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ java_test_suite(
artifact("io.opentelemetry:opentelemetry-api"),
artifact("io.opentelemetry:opentelemetry-sdk"),
artifact("io.opentelemetry:opentelemetry-sdk-common"),
artifact("io.opentelemetry:opentelemetry-sdk-tracing"),
artifact("io.opentelemetry:opentelemetry-sdk-trace"),
artifact("io.opentelemetry:opentelemetry-context"),
artifact("junit:junit"),
artifact("org.assertj:assertj-core"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.api.trace.StatusCode;
import io.opentelemetry.context.propagation.ContextPropagators;
import io.opentelemetry.context.propagation.DefaultContextPropagators;
Expand Down Expand Up @@ -84,7 +85,7 @@ public void shouldBeAbleToCreateATracer() {

assertThat(values).hasSize(1);
assertThat(values).element(0)
.extracting(SpanData::getStatus).extracting(SpanData.Status::getCanonicalCode).isEqualTo(
.extracting(SpanData::getStatus).extracting(SpanData.Status::getStatusCode).isEqualTo(
StatusCode.ERROR);
assertThat(values).element(0)
.extracting(el -> el.getAttributes().get(AttributeKey.stringKey("cheese"))).isEqualTo("gouda");
Expand Down Expand Up @@ -196,7 +197,7 @@ public void canCreateASpanEventWithBooleanAttribute() {
String event = "Test event";
String attribute = "testBoolean";

Attributes.Builder attributes = Attributes.builder();
AttributesBuilder attributes = Attributes.builder();
attributes.put(attribute, false);

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

Attributes.Builder attributes = Attributes.builder();
AttributesBuilder attributes = Attributes.builder();
attributes.put(arrayKey, booleanArray);
attributes.put(varArgsKey, true, false, true);

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

Attributes.Builder attributes = Attributes.builder();
AttributesBuilder attributes = Attributes.builder();
attributes.put(attribute, attributeValue);

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

Attributes.Builder attributes = Attributes.builder();
AttributesBuilder attributes = Attributes.builder();
attributes.put(arrayKey, doubleArray);
attributes.put(varArgsKey, 2.2, 5.3);

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

Attributes.Builder attributes = Attributes.builder();
AttributesBuilder attributes = Attributes.builder();
attributes.put(attribute, attributeValue);

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

Attributes.Builder attributes = Attributes.builder();
AttributesBuilder attributes = Attributes.builder();
attributes.put(arrayKey, longArray);
attributes.put(varArgsKey, 250L, 5L);

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

Attributes.Builder attributes = Attributes.builder();
AttributesBuilder attributes = Attributes.builder();
attributes.put(attribute, attributeValue);

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

Attributes.Builder attributes = Attributes.builder();
AttributesBuilder attributes = Attributes.builder();
attributes.put(arrayKey, strArray);
attributes.put(varArgsKey, "hi", "hola");

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

Attributes.Builder attributes = Attributes.builder();
AttributesBuilder attributes = Attributes.builder();
attributes.put(attribute, attributeValue);
attributes.put(attribute, attributeValue);

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

Attributes.Builder attributes = Attributes.builder();
AttributesBuilder attributes = Attributes.builder();
attributes.put("testFloat", 5.5f);
attributes.put("testInt", 10);
attributes.put("testStringArray", stringArray);
Expand Down
4 changes: 2 additions & 2 deletions java/maven_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ load("@rules_jvm_external//:specs.bzl", "maven")

def selenium_java_deps():
netty_version = "4.1.53.Final"
opentelemetry_version = "0.10.0"
opentelemetry_version = "0.12.0"

maven_install(
artifacts = [
Expand Down Expand Up @@ -45,7 +45,7 @@ def selenium_java_deps():
"io.opentelemetry:opentelemetry-sdk-testing:%s" % opentelemetry_version,
"io.opentelemetry:opentelemetry-sdk:%s" % opentelemetry_version,
"io.opentelemetry:opentelemetry-sdk-common:%s" % opentelemetry_version,
"io.opentelemetry:opentelemetry-sdk-tracing:%s" % opentelemetry_version,
"io.opentelemetry:opentelemetry-sdk-trace:%s" % opentelemetry_version,
"io.ous:jtoml:2.0.0",
"it.ozimov:embedded-redis:0.7.3",
"io.projectreactor:reactor-core:3.4.0",
Expand Down
Loading