Skip to content

Commit 33183a3

Browse files
authored
Upgrate OTEL to 1.1.0 (#308)
* Upgrate OTEL to 1.1.0 Signed-off-by: Pavol Loffay <[email protected]> * Fixes Signed-off-by: Pavol Loffay <[email protected]> * Fix dependencies Signed-off-by: Pavol Loffay <[email protected]> * Enable undertow Signed-off-by: Pavol Loffay <[email protected]> * Disable muzzle for artifacts with no instr modules Signed-off-by: Pavol Loffay <[email protected]> * Disable vertx test Signed-off-by: Pavol Loffay <[email protected]>
1 parent 1910219 commit 33183a3

File tree

38 files changed

+59
-111
lines changed

38 files changed

+59
-111
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ smoke-test:
1818
muzzle:
1919
# daemon was causing failure "java.lang.IllegalStateException: Could not locate class file for"
2020
# for injecting helper classes from the same packages as instrumentations
21-
./gradlew muzzle --no-daemon
21+
./gradlew assemble muzzle --no-daemon
2222

2323
.PHONY: docker
2424
docker: assemble

build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ subprojects {
3131
description = "Hypertrace OpenTelemetry Javaagent"
3232

3333
extra.set("versions", mapOf(
34-
"opentelemetry" to "1.0.1",
35-
"opentelemetry_java_agent" to "1.0.1-alpha",
36-
"opentelemetry_java_agent_all" to "1.0.1",
34+
"opentelemetry" to "1.1.0",
35+
"opentelemetry_java_agent" to "1.1.0-alpha",
36+
"opentelemetry_java_agent_all" to "1.1.0",
3737
"byte_buddy" to "1.10.18",
3838
"slf4j" to "1.7.30"
3939
))

instrumentation/apache-httpclient-4.0/src/main/java/io/opentelemetry/javaagent/instrumentation/hypertrace/apachehttpclient/v4_0/ApacheHttpClientObjectRegistry.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818

1919
import io.opentelemetry.api.common.AttributeKey;
2020
import io.opentelemetry.api.trace.Span;
21-
import io.opentelemetry.javaagent.instrumentation.api.WeakMap;
21+
import io.opentelemetry.instrumentation.api.caching.Cache;
2222
import org.apache.http.HttpEntity;
2323

2424
public class ApacheHttpClientObjectRegistry {
2525

26-
public static final WeakMap<HttpEntity, SpanAndAttributeKey> entityToSpan =
27-
WeakMap.Provider.newWeakMap();
26+
public static final Cache<HttpEntity, SpanAndAttributeKey> entityToSpan =
27+
Cache.newBuilder().setWeakKeys().build();
2828

2929
public static class SpanAndAttributeKey {
3030
public final Span span;

instrumentation/apache-httpclient-4.0/src/main/java/io/opentelemetry/javaagent/instrumentation/hypertrace/apachehttpclient/v4_0/HttpEntityInstrumentation.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
public class HttpEntityInstrumentation implements TypeInstrumentation {
4949

5050
@Override
51-
public ElementMatcher<? super TypeDescription> typeMatcher() {
51+
public ElementMatcher<TypeDescription> typeMatcher() {
5252
return implementsInterface(named("org.apache.http.HttpEntity"));
5353
}
5454

@@ -138,13 +138,15 @@ public static void enter(
138138
public static void exit(
139139
@Advice.This HttpEntity thizz, @Advice.Argument(0) OutputStream outputStream) {
140140
SpanAndAttributeKey spanAndAttributeKey =
141-
ApacheHttpClientObjectRegistry.entityToSpan.remove(thizz);
141+
ApacheHttpClientObjectRegistry.entityToSpan.get(thizz);
142+
ApacheHttpClientObjectRegistry.entityToSpan.remove(thizz);
142143
if (spanAndAttributeKey == null) {
143144
return;
144145
}
145146

146147
BoundedByteArrayOutputStream bufferedOutStream =
147-
GlobalObjectRegistry.outputStreamToBufferMap.remove(outputStream);
148+
GlobalObjectRegistry.outputStreamToBufferMap.get(outputStream);
149+
GlobalObjectRegistry.outputStreamToBufferMap.remove(outputStream);
148150
try {
149151
String requestBody = bufferedOutStream.toStringWithSuppliedCharset();
150152
spanAndAttributeKey.span.setAttribute(spanAndAttributeKey.attributeKey, requestBody);

instrumentation/apache-httpclient-4.0/src/main/java/io/opentelemetry/javaagent/instrumentation/hypertrace/apachehttpclient/v4_0/readall/ApacheClientReadAllInstrumentationModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public static void exit(@Return Object response) {
221221

222222
static class HttpEntityInstrumentation implements TypeInstrumentation {
223223
@Override
224-
public ElementMatcher<? super TypeDescription> typeMatcher() {
224+
public ElementMatcher<TypeDescription> typeMatcher() {
225225
return implementsInterface(named("org.apache.http.HttpEntity"));
226226
}
227227

instrumentation/apache-httpclient-4.0/src/main/java/io/opentelemetry/javaagent/instrumentation/hypertrace/apachehttpclient/v4_0/readall/InputStreamReadAllInstrumentationModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public List<TypeInstrumentation> typeInstrumentations() {
6868
static class InputStreamInstrumentation implements TypeInstrumentation {
6969

7070
@Override
71-
public ElementMatcher<? super TypeDescription> typeMatcher() {
71+
public ElementMatcher<TypeDescription> typeMatcher() {
7272
return safeHasSuperType(namedOneOf("java.io.InputStream"));
7373
}
7474

instrumentation/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ tasks {
6363
relocate("org.checkerframework", "io.opentelemetry.javaagent.shaded.org.hypertrace.shaded.com.checkerframework")
6464
relocate("org.yaml", "io.opentelemetry.javaagent.shaded.org.hypertrace.shaded.org.yaml")
6565

66-
relocate("com.blogspot.mydailyjava", "io.opentelemetry.javaagent.shaded.org.hypertrace.shaded.com.blogspot.mydailyjava")
66+
relocate("com.blogspot.mydailyjava.weaklockfree", "io.opentelemetry.instrumentation.api.internal.shaded.weaklockfree")
6767

6868
exclude("**/module-info.class")
6969

instrumentation/grpc-1.5/src/main/java/io/opentelemetry/javaagent/instrumentation/hypertrace/grpc/v1_5/NettyHttp2HeadersInstrumentationModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public List<TypeInstrumentation> typeInstrumentations() {
6969
*/
7070
class NettyUtilsInstrumentation implements TypeInstrumentation {
7171
@Override
72-
public ElementMatcher<? super TypeDescription> typeMatcher() {
72+
public ElementMatcher<TypeDescription> typeMatcher() {
7373
return failSafe(named("io.grpc.netty.Utils"));
7474
}
7575

instrumentation/java-streams/src/main/java/io/opentelemetry/javaagent/instrumentation/hypertrace/java/inputstream/InputStreamInstrumentationModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public List<TypeInstrumentation> typeInstrumentations() {
7070
static class InputStreamInstrumentation implements TypeInstrumentation {
7171

7272
@Override
73-
public ElementMatcher<? super TypeDescription> typeMatcher() {
73+
public ElementMatcher<TypeDescription> typeMatcher() {
7474
return extendsClass(named(InputStream.class.getName()))
7575
.and(not(safeHasSuperType(named("javax.servlet.ServletInputStream"))));
7676
}

instrumentation/java-streams/src/main/java/io/opentelemetry/javaagent/instrumentation/hypertrace/java/outputstream/OutputStreamInstrumentationModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public List<TypeInstrumentation> typeInstrumentations() {
6464
static class OutputStreamInstrumentation implements TypeInstrumentation {
6565

6666
@Override
67-
public ElementMatcher<? super TypeDescription> typeMatcher() {
67+
public ElementMatcher<TypeDescription> typeMatcher() {
6868
return extendsClass(named(OutputStream.class.getName()));
6969
}
7070

0 commit comments

Comments
 (0)