From 8e5e87a76d51c4a16613e7943f2303c818b300d3 Mon Sep 17 00:00:00 2001
From: Pavol Loffay
Date: Wed, 3 Mar 2021 19:06:45 +0100
Subject: [PATCH] Bump OTEL dependency to 0.17.0 (#280)
* Bump OTEL to 0.17.0
Signed-off-by: Pavol Loffay
* Fix smoke tests
Signed-off-by: Pavol Loffay
* Revert path
Signed-off-by: Pavol Loffay
* Rename image
Signed-off-by: Pavol Loffay
* remove
Signed-off-by: Pavol Loffay
* Fix
Signed-off-by: Pavol Loffay
* fmt
Signed-off-by: Pavol Loffay
* Fix traces exporter env var
Signed-off-by: Pavol Loffay
* Fix
Signed-off-by: Pavol Loffay
* Fix grpc test
Signed-off-by: Pavol Loffay
* Small revert
Signed-off-by: Pavol Loffay
* enable test
Signed-off-by: Pavol Loffay
* Fix propagators
Signed-off-by: Pavol Loffay
* x2
Signed-off-by: Pavol Loffay
---
build.gradle.kts | 7 ++++---
instrumentation/build.gradle.kts | 2 +-
.../v4_1/client/HttpClientRequestTracingHandler.java | 3 +--
.../client/HttpClientResponseTracingHandler.java | 3 +--
javaagent/build.gradle.kts | 4 ++--
otel-extensions/build.gradle.kts | 1 +
.../extensions/HypertraceAgentConfiguration.java | 2 +-
.../otel/extensions/HypertraceResourceProvider.java | 12 +++++++-----
.../extensions/processor/AddTagsSpanProcessor.java | 2 +-
smoke-tests/build.gradle.kts | 2 +-
.../hypertrace/agent/smoketest/AppServerTest.groovy | 3 ++-
.../hypertrace/agent/smoketest/GrpcSmokeTest.groovy | 2 +-
.../hypertrace/agent/smoketest/JettySmokeTest.groovy | 11 ++---------
.../agent/smoketest/PropagationTest.groovy | 6 +++---
.../org/hypertrace/agent/smoketest/SmokeTest.groovy | 7 ++++---
.../smoketest/SpringBootDiabledAgentSmokeTest.java | 2 +-
.../SpringBootDisabledBodyCaptureSmokeTest.java | 2 +-
.../agent/smoketest/SpringBootSmokeTest.java | 6 +++---
.../hypertrace/agent/testing/InMemoryExporter.java | 3 +--
19 files changed, 38 insertions(+), 42 deletions(-)
diff --git a/build.gradle.kts b/build.gradle.kts
index fbd8ee939..fa1be16be 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -29,9 +29,10 @@ subprojects {
description = "Hypertrace OpenTelemetry Javaagent"
extra.set("versions", mapOf(
- "opentelemetry" to "0.15.0",
- "opentelemetry_java_agent" to "0.15.1",
- "byte_buddy" to "1.10.18",
+ "opentelemetry" to "0.17.1",
+ "opentelemetry_java_agent" to "0.17.0-alpha",
+ "opentelemetry_java_agent_all" to "0.17.0",
+ "byte_buddy" to "1.10.18",
"slf4j" to "1.7.30"
))
diff --git a/instrumentation/build.gradle.kts b/instrumentation/build.gradle.kts
index 2e840ab6b..a8813bde9 100644
--- a/instrumentation/build.gradle.kts
+++ b/instrumentation/build.gradle.kts
@@ -83,6 +83,6 @@ tasks {
relocate("io.opentelemetry.spi", "io.opentelemetry.javaagent.shaded.io.opentelemetry.spi")
relocate("io.opentelemetry.context", "io.opentelemetry.javaagent.shaded.io.opentelemetry.context")
relocate("io.opentelemetry.extension.kotlin", "io.opentelemetry.javaagent.shaded.io.opentelemetry.extension.kotlin")
- relocate ("io.opentelemetry.extension.trace.propagation", "io.opentelemetry.javaagent.shaded.io.opentelemetry.extension.trace.propagation")
+ relocate("io.opentelemetry.extension.aws", "io.opentelemetry.javaagent.shaded.io.opentelemetry.extension.aws")
}
}
diff --git a/instrumentation/netty/netty-4.1/src/main/java/io/opentelemetry/javaagent/instrumentation/hypertrace/netty/v4_1/client/HttpClientRequestTracingHandler.java b/instrumentation/netty/netty-4.1/src/main/java/io/opentelemetry/javaagent/instrumentation/hypertrace/netty/v4_1/client/HttpClientRequestTracingHandler.java
index 55ed819fc..1496aafe1 100644
--- a/instrumentation/netty/netty-4.1/src/main/java/io/opentelemetry/javaagent/instrumentation/hypertrace/netty/v4_1/client/HttpClientRequestTracingHandler.java
+++ b/instrumentation/netty/netty-4.1/src/main/java/io/opentelemetry/javaagent/instrumentation/hypertrace/netty/v4_1/client/HttpClientRequestTracingHandler.java
@@ -51,8 +51,7 @@ public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise prm) {
Channel channel = ctx.channel();
Context context =
channel
- .attr(
- io.opentelemetry.javaagent.instrumentation.netty.v4_1.AttributeKeys.CLIENT_CONTEXT)
+ .attr(io.opentelemetry.instrumentation.netty.v4_1.AttributeKeys.CLIENT_CONTEXT)
.get();
if (context == null) {
ctx.write(msg, prm);
diff --git a/instrumentation/netty/netty-4.1/src/main/java/io/opentelemetry/javaagent/instrumentation/hypertrace/netty/v4_1/client/HttpClientResponseTracingHandler.java b/instrumentation/netty/netty-4.1/src/main/java/io/opentelemetry/javaagent/instrumentation/hypertrace/netty/v4_1/client/HttpClientResponseTracingHandler.java
index 05350bbd7..a4ccc6443 100644
--- a/instrumentation/netty/netty-4.1/src/main/java/io/opentelemetry/javaagent/instrumentation/hypertrace/netty/v4_1/client/HttpClientResponseTracingHandler.java
+++ b/instrumentation/netty/netty-4.1/src/main/java/io/opentelemetry/javaagent/instrumentation/hypertrace/netty/v4_1/client/HttpClientResponseTracingHandler.java
@@ -54,8 +54,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) {
Channel channel = ctx.channel();
Context context =
channel
- .attr(
- io.opentelemetry.javaagent.instrumentation.netty.v4_1.AttributeKeys.CLIENT_CONTEXT)
+ .attr(io.opentelemetry.instrumentation.netty.v4_1.AttributeKeys.CLIENT_CONTEXT)
.get();
if (context == null) {
ctx.fireChannelRead(msg);
diff --git a/javaagent/build.gradle.kts b/javaagent/build.gradle.kts
index 3568330eb..fb0cebe7f 100644
--- a/javaagent/build.gradle.kts
+++ b/javaagent/build.gradle.kts
@@ -11,7 +11,7 @@ dependencies {
// update the dependencies also in the instrumentations sub-projects
// https://oss.jfrog.org/artifactory/oss-snapshot-local/io/opentelemetry/instrumentation/auto/
// https://dl.bintray.com/open-telemetry/maven/
- implementation("io.opentelemetry.javaagent", "opentelemetry-javaagent", version = "${versions["opentelemetry_java_agent"]}", classifier = "all")
+ implementation("io.opentelemetry.javaagent", "opentelemetry-javaagent", version = "${versions["opentelemetry_java_agent_all"]}", classifier = "all")
implementation(project(":filter-api"))
}
@@ -60,7 +60,7 @@ tasks {
relocate("io.opentelemetry.spi", "io.opentelemetry.javaagent.shaded.io.opentelemetry.spi")
relocate("io.opentelemetry.context", "io.opentelemetry.javaagent.shaded.io.opentelemetry.context")
relocate("io.opentelemetry.extension.kotlin", "io.opentelemetry.javaagent.shaded.io.opentelemetry.extension.kotlin")
- relocate("io.opentelemetry.extension.trace.propagation", "io.opentelemetry.javaagent.shaded.io.opentelemetry.extension.trace.propagation")
+ relocate("io.opentelemetry.extension.aws", "io.opentelemetry.javaagent.shaded.io.opentelemetry.extension.aws")
mergeServiceFiles {
include("inst/META-INF/services/*")
diff --git a/otel-extensions/build.gradle.kts b/otel-extensions/build.gradle.kts
index 626e124cc..5a18e15df 100644
--- a/otel-extensions/build.gradle.kts
+++ b/otel-extensions/build.gradle.kts
@@ -16,5 +16,6 @@ dependencies {
implementation("net.bytebuddy:byte-buddy:${versions["byte_buddy"]}")
annotationProcessor("com.google.auto.service:auto-service:1.0-rc7")
+ testImplementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure:${versions["opentelemetry"]}-alpha")
testImplementation("io.opentelemetry:opentelemetry-sdk:${versions["opentelemetry"]}")
}
diff --git a/otel-extensions/src/main/java/org/hypertrace/agent/otel/extensions/HypertraceAgentConfiguration.java b/otel-extensions/src/main/java/org/hypertrace/agent/otel/extensions/HypertraceAgentConfiguration.java
index 2de8abb89..193151729 100644
--- a/otel-extensions/src/main/java/org/hypertrace/agent/otel/extensions/HypertraceAgentConfiguration.java
+++ b/otel-extensions/src/main/java/org/hypertrace/agent/otel/extensions/HypertraceAgentConfiguration.java
@@ -32,7 +32,7 @@
public class HypertraceAgentConfiguration implements PropertySource {
// https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/sdk-environment-variables.md
- private static final String OTEL_TRACE_EXPORTER = "otel.trace.exporter";
+ private static final String OTEL_TRACE_EXPORTER = "otel.traces.exporter";
private static final String OTEL_METRICS_EXPORTER = "otel.metrics.exporter";
private static final String OTEL_PROPAGATORS = "otel.propagators";
private static final String OTEL_EXPORTER_ZIPKIN_ENDPOINT = "otel.exporter.zipkin.endpoint";
diff --git a/otel-extensions/src/main/java/org/hypertrace/agent/otel/extensions/HypertraceResourceProvider.java b/otel-extensions/src/main/java/org/hypertrace/agent/otel/extensions/HypertraceResourceProvider.java
index 2ed6e2627..f8133cbc7 100644
--- a/otel-extensions/src/main/java/org/hypertrace/agent/otel/extensions/HypertraceResourceProvider.java
+++ b/otel-extensions/src/main/java/org/hypertrace/agent/otel/extensions/HypertraceResourceProvider.java
@@ -19,25 +19,27 @@
import com.google.auto.service.AutoService;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.common.AttributesBuilder;
-import io.opentelemetry.sdk.resources.ResourceAttributes;
-import io.opentelemetry.sdk.resources.ResourceProvider;
+import io.opentelemetry.sdk.autoconfigure.ConfigProperties;
+import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
+import io.opentelemetry.sdk.resources.Resource;
+import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import org.hypertrace.agent.config.Config.AgentConfig;
import org.hypertrace.agent.core.config.HypertraceConfig;
@AutoService(ResourceProvider.class)
-public class HypertraceResourceProvider extends ResourceProvider {
+public class HypertraceResourceProvider implements ResourceProvider {
private final CgroupsReader cgroupsReader = new CgroupsReader();
private final AgentConfig agentConfig = HypertraceConfig.get();
@Override
- protected Attributes getAttributes() {
+ public Resource createResource(ConfigProperties config) {
AttributesBuilder builder = Attributes.builder();
String containerId = this.cgroupsReader.readContainerId();
if (containerId != null && !containerId.isEmpty()) {
builder.put(ResourceAttributes.CONTAINER_ID, containerId);
}
builder.put(ResourceAttributes.SERVICE_NAME, agentConfig.getServiceName().getValue());
- return builder.build();
+ return Resource.create(builder.build());
}
}
diff --git a/otel-extensions/src/main/java/org/hypertrace/agent/otel/extensions/processor/AddTagsSpanProcessor.java b/otel-extensions/src/main/java/org/hypertrace/agent/otel/extensions/processor/AddTagsSpanProcessor.java
index 131382537..be8b64d57 100644
--- a/otel-extensions/src/main/java/org/hypertrace/agent/otel/extensions/processor/AddTagsSpanProcessor.java
+++ b/otel-extensions/src/main/java/org/hypertrace/agent/otel/extensions/processor/AddTagsSpanProcessor.java
@@ -18,10 +18,10 @@
import io.opentelemetry.context.Context;
import io.opentelemetry.sdk.common.CompletableResultCode;
-import io.opentelemetry.sdk.resources.ResourceAttributes;
import io.opentelemetry.sdk.trace.ReadWriteSpan;
import io.opentelemetry.sdk.trace.ReadableSpan;
import io.opentelemetry.sdk.trace.SpanProcessor;
+import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import org.hypertrace.agent.otel.extensions.CgroupsReader;
public class AddTagsSpanProcessor implements SpanProcessor {
diff --git a/smoke-tests/build.gradle.kts b/smoke-tests/build.gradle.kts
index edb9090ee..218ad8174 100644
--- a/smoke-tests/build.gradle.kts
+++ b/smoke-tests/build.gradle.kts
@@ -37,4 +37,4 @@ tasks.test {
doFirst {
jvmArgs("-Dsmoketest.javaagent.path=${shadowTask.archiveFile.get()}")
}
-}
\ No newline at end of file
+}
diff --git a/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/AppServerTest.groovy b/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/AppServerTest.groovy
index 1528c7d3f..28516dcdf 100644
--- a/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/AppServerTest.groovy
+++ b/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/AppServerTest.groovy
@@ -7,6 +7,7 @@ package org.hypertrace.agent.smoketest
import okhttp3.MediaType
import okhttp3.RequestBody
+import spock.lang.Ignore
import static org.junit.Assume.assumeTrue
@@ -358,4 +359,4 @@ abstract class AppServerTest extends SmokeTest {
[serverVersion, jdk]
]
}
-}
\ No newline at end of file
+}
diff --git a/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/GrpcSmokeTest.groovy b/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/GrpcSmokeTest.groovy
index 263028027..c946142c7 100644
--- a/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/GrpcSmokeTest.groovy
+++ b/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/GrpcSmokeTest.groovy
@@ -13,7 +13,7 @@ import spock.lang.Unroll
class GrpcSmokeTest extends SmokeTest {
protected String getTargetImage(String jdk, String serverVersion) {
- "ghcr.io/open-telemetry/java-test-containers:smoke-grpc-jdk$jdk-20210129.520311770"
+ "ghcr.io/open-telemetry/java-test-containers:smoke-grpc-jdk$jdk-20210218.577304952"
}
@Unroll
diff --git a/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/JettySmokeTest.groovy b/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/JettySmokeTest.groovy
index 4f773e5db..93bde24ea 100644
--- a/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/JettySmokeTest.groovy
+++ b/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/JettySmokeTest.groovy
@@ -20,14 +20,7 @@ class JettySmokeTest extends AppServerTest {
}
def getJettySpanName() {
- if (serverVersion == "9.4.35") {
- //this need to be present till we sync HT java agent with at least v.0.18.x of OTEL which uniformly returns
- //HandlerWrapper.handle
- "HandlerCollection.handle"
- }
- else {
- "HandlerList.handle"
- }
+ "HandlerWrapper.handle"
}
@Override
@@ -39,4 +32,4 @@ class JettySmokeTest extends AppServerTest {
}
return path
}
-}
\ No newline at end of file
+}
diff --git a/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/PropagationTest.groovy b/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/PropagationTest.groovy
index fc2af7e1b..b35371b34 100644
--- a/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/PropagationTest.groovy
+++ b/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/PropagationTest.groovy
@@ -14,7 +14,7 @@ abstract class PropagationTest extends SmokeTest {
@Override
protected String getTargetImage(String jdk, String serverVersion) {
- "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk$jdk-20210129.520311771"
+ "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk$jdk-20210218.577304949"
}
def "Should propagate test"() {
@@ -78,7 +78,7 @@ class JaegerPropagationTest extends PropagationTest {
class OtTracerPropagationTest extends SmokeTest {
@Override
protected String getTargetImage(String jdk, String serverVersion) {
- "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk$jdk-20210129.520311771"
+ "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk$jdk-20210218.577304949"
}
// OtTracer only propagates lower half of trace ID so we have to mangle the trace IDs similar to
@@ -109,7 +109,7 @@ class OtTracerPropagationTest extends SmokeTest {
@Override
protected Map getExtraEnv() {
- return ["otel.propagators": "ottracer"]
+ return ["otel.propagators": "ottrace"]
}
}
diff --git a/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/SmokeTest.groovy b/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/SmokeTest.groovy
index 55e22c37f..1ad93402a 100644
--- a/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/SmokeTest.groovy
+++ b/smoke-tests/src/test/groovy/org/hypertrace/agent/smoketest/SmokeTest.groovy
@@ -42,7 +42,8 @@ abstract class SmokeTest extends Specification {
private Backend backend = Backend.getInstance()
@Shared
- protected String agentPath = System.getProperty("smoketest.javaagent.path")
+// protected String agentPath = "/Users/ploffay/projects/hypertrace/javaagent/javaagent/build/libs/hypertrace-agent-0.10.4-SNAPSHOT-all.jar"// System.getProperty("smoketest.javaagent.path")
+ protected String agentPath = System.getProperty("smoketest.javaagent.path")
@Shared
protected GenericContainer target
@@ -84,7 +85,7 @@ abstract class SmokeTest extends Specification {
.withEnv("OTEL_EXPORTER_OTLP_ENDPOINT", "http://collector:55680")
.withEnv("HT_SERVICE_NAME", "CIService")
.withEnv("HT_REPORTING_ENDPOINT", "http://collector:9411/api/v2/spans")
- .withEnv("OTEL_TRACE_EXPORTER", "otlp")
+ .withEnv("OTEL_TRACES_EXPORTER", "otlp")
.withImagePullPolicy(PullPolicy.alwaysPull())
.withEnv(extraEnv)
customizeContainer(target)
@@ -278,4 +279,4 @@ abstract class SmokeTest extends Specification {
network?.close()
}
}
-}
\ No newline at end of file
+}
diff --git a/smoke-tests/src/test/java/org/hypertrace/agent/smoketest/SpringBootDiabledAgentSmokeTest.java b/smoke-tests/src/test/java/org/hypertrace/agent/smoketest/SpringBootDiabledAgentSmokeTest.java
index 8af24a34a..e40789645 100644
--- a/smoke-tests/src/test/java/org/hypertrace/agent/smoketest/SpringBootDiabledAgentSmokeTest.java
+++ b/smoke-tests/src/test/java/org/hypertrace/agent/smoketest/SpringBootDiabledAgentSmokeTest.java
@@ -33,7 +33,7 @@ public class SpringBootDiabledAgentSmokeTest extends AbstractSmokeTest {
protected String getTargetImage(int jdk) {
return "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk"
+ jdk
- + "-20210209.550405798";
+ + "-20210218.577304949";
}
private GenericContainer app;
diff --git a/smoke-tests/src/test/java/org/hypertrace/agent/smoketest/SpringBootDisabledBodyCaptureSmokeTest.java b/smoke-tests/src/test/java/org/hypertrace/agent/smoketest/SpringBootDisabledBodyCaptureSmokeTest.java
index 49f2fdddf..8f9ecc72b 100644
--- a/smoke-tests/src/test/java/org/hypertrace/agent/smoketest/SpringBootDisabledBodyCaptureSmokeTest.java
+++ b/smoke-tests/src/test/java/org/hypertrace/agent/smoketest/SpringBootDisabledBodyCaptureSmokeTest.java
@@ -38,7 +38,7 @@ public class SpringBootDisabledBodyCaptureSmokeTest extends AbstractSmokeTest {
protected String getTargetImage(int jdk) {
return "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk"
+ jdk
- + "-20210209.550405798";
+ + "-20210218.577304949";
}
private GenericContainer app;
diff --git a/smoke-tests/src/test/java/org/hypertrace/agent/smoketest/SpringBootSmokeTest.java b/smoke-tests/src/test/java/org/hypertrace/agent/smoketest/SpringBootSmokeTest.java
index d2ec97101..90746ddf9 100644
--- a/smoke-tests/src/test/java/org/hypertrace/agent/smoketest/SpringBootSmokeTest.java
+++ b/smoke-tests/src/test/java/org/hypertrace/agent/smoketest/SpringBootSmokeTest.java
@@ -17,7 +17,7 @@
package org.hypertrace.agent.smoketest;
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;
-import io.opentelemetry.sdk.resources.ResourceAttributes;
+import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
@@ -35,14 +35,14 @@
// key = "SMOKETEST_JAVAAGENT_PATH",
// value =
//
-// "/Users/ploffay/projects/hypertrace/javaagent/javaagent/build/libs/hypertrace-agent-0.3.3-SNAPSHOT-all.jar")
+// "/Users/ploffay/projects/hypertrace/javaagent/javaagent/build/libs/hypertrace-agent-0.10.4-SNAPSHOT-all.jar")
public class SpringBootSmokeTest extends AbstractSmokeTest {
@Override
protected String getTargetImage(int jdk) {
return "ghcr.io/open-telemetry/java-test-containers:smoke-springboot-jdk"
+ jdk
- + "-20210209.550405798";
+ + "-20210218.577304949";
}
private static GenericContainer app;
diff --git a/testing-common/src/main/java/org/hypertrace/agent/testing/InMemoryExporter.java b/testing-common/src/main/java/org/hypertrace/agent/testing/InMemoryExporter.java
index 93689495a..ad2bd0141 100644
--- a/testing-common/src/main/java/org/hypertrace/agent/testing/InMemoryExporter.java
+++ b/testing-common/src/main/java/org/hypertrace/agent/testing/InMemoryExporter.java
@@ -75,8 +75,7 @@ public void onStart(Context context, ReadWriteSpan readWriteSpan) {
sd.getParentSpanId(),
sd.getInstrumentationLibraryInfo());
synchronized (tracesLock) {
- spanOrders.put(
- readWriteSpan.getSpanContext().getSpanIdAsHexString(), nextSpanOrder.getAndIncrement());
+ spanOrders.put(readWriteSpan.getSpanContext().getSpanId(), nextSpanOrder.getAndIncrement());
}
}