Apply method instrumentation only to methods (#13949)

This commit is contained in:
Lauri Tulmin 2025-05-29 19:11:22 +03:00 committed by GitHub
parent 8081608fae
commit 86c46a20bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasSuperType;
import static io.opentelemetry.javaagent.instrumentation.methods.MethodSingletons.getBootstrapLoader;
import static io.opentelemetry.javaagent.instrumentation.methods.MethodSingletons.instrumenter;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.namedOneOf;
@ -55,7 +56,7 @@ public class MethodInstrumentation implements TypeInstrumentation {
@Override
public void transform(TypeTransformer transformer) {
transformer.applyAdviceToMethod(
namedOneOf(methodNames.toArray(new String[0])),
namedOneOf(methodNames.toArray(new String[0])).and(isMethod()),
mapping ->
mapping.bind(
MethodReturnType.class,