From 0ee0b54474e71b3127f41f816f8e506e23e7d773 Mon Sep 17 00:00:00 2001 From: jiwen624 Date: Fri, 12 Nov 2021 14:59:55 -0800 Subject: [PATCH] fix instrumentation dependency issues --- .../AoStatementInstrumentation.java | 16 ++++++---------- .../AoHandlerAdapterInstrumentation.java | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/instrumentation/jdbc/src/main/java/com/appoptics/opentelemetry/instrumentation/AoStatementInstrumentation.java b/instrumentation/jdbc/src/main/java/com/appoptics/opentelemetry/instrumentation/AoStatementInstrumentation.java index e9ed6a6e..f73dd1ba 100644 --- a/instrumentation/jdbc/src/main/java/com/appoptics/opentelemetry/instrumentation/AoStatementInstrumentation.java +++ b/instrumentation/jdbc/src/main/java/com/appoptics/opentelemetry/instrumentation/AoStatementInstrumentation.java @@ -6,22 +6,17 @@ package com.appoptics.opentelemetry.instrumentation; import io.opentelemetry.context.Context; -import io.opentelemetry.context.Scope; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer; -import io.opentelemetry.javaagent.instrumentation.api.CallDepthThreadLocalMap; +//import io.opentelemetry.javaagent.instrumentation.api.CallDepthThreadLocalMap; import net.bytebuddy.asm.Advice; -import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.matcher.ElementMatcher; import java.sql.Statement; -import java.util.Map; import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.implementsInterface; -import static io.opentelemetry.javaagent.extension.matcher.ClassLoaderMatcher.hasClassesNamed; -import static io.opentelemetry.javaagent.instrumentation.api.Java8BytecodeBridge.currentContext; -import static java.util.Collections.singletonMap; +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed; import static net.bytebuddy.matcher.ElementMatchers.*; /** @@ -52,9 +47,10 @@ public static class StatementAdvice { //@Advice.OnMethodEnter(suppress = Throwable.class) @Advice.OnMethodEnter public static void onEnter() { - if (CallDepthThreadLocalMap.getCallDepth(Statement.class).get() != 1) { //only report back when depth is one to avoid duplications - return; - } + // TODO: CallDepthThreadLocalMap is no longer public. See what we can do +// if (CallDepthThreadLocalMap.getCallDepth(Statement.class).get() != 1) { //only report back when depth is one to avoid duplications +// return; +// } AoStatementTracer.writeStackTrace(Context.current()); } } diff --git a/instrumentation/spring/spring-webmvc-3.1/src/main/java/com/appoptics/opentelemetry/instrumentation/AoHandlerAdapterInstrumentation.java b/instrumentation/spring/spring-webmvc-3.1/src/main/java/com/appoptics/opentelemetry/instrumentation/AoHandlerAdapterInstrumentation.java index e1af58f4..2fe78184 100644 --- a/instrumentation/spring/spring-webmvc-3.1/src/main/java/com/appoptics/opentelemetry/instrumentation/AoHandlerAdapterInstrumentation.java +++ b/instrumentation/spring/spring-webmvc-3.1/src/main/java/com/appoptics/opentelemetry/instrumentation/AoHandlerAdapterInstrumentation.java @@ -18,7 +18,7 @@ import javax.servlet.http.HttpServletRequest; import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.implementsInterface; -import static io.opentelemetry.javaagent.extension.matcher.ClassLoaderMatcher.hasClassesNamed; +import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed; import static net.bytebuddy.matcher.ElementMatchers.*; /**