Skip to content

Commit 86c46a2

Browse files
authored
Apply method instrumentation only to methods (open-telemetry#13949)
1 parent 8081608 commit 86c46a2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

instrumentation/methods/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/methods/MethodInstrumentation.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasSuperType;
1111
import static io.opentelemetry.javaagent.instrumentation.methods.MethodSingletons.getBootstrapLoader;
1212
import static io.opentelemetry.javaagent.instrumentation.methods.MethodSingletons.instrumenter;
13+
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
1314
import static net.bytebuddy.matcher.ElementMatchers.named;
1415
import static net.bytebuddy.matcher.ElementMatchers.namedOneOf;
1516

@@ -55,7 +56,7 @@ public ElementMatcher<TypeDescription> typeMatcher() {
5556
@Override
5657
public void transform(TypeTransformer transformer) {
5758
transformer.applyAdviceToMethod(
58-
namedOneOf(methodNames.toArray(new String[0])),
59+
namedOneOf(methodNames.toArray(new String[0])).and(isMethod()),
5960
mapping ->
6061
mapping.bind(
6162
MethodReturnType.class,

0 commit comments

Comments
 (0)