From aa611e7be275dd7b2143a7a7113c9cbb870e3fc0 Mon Sep 17 00:00:00 2001 From: Tyler Benson Date: Thu, 29 Jul 2021 12:17:52 -0400 Subject: [PATCH] Make matcher more specific rather than remove arg matcher. --- .../KafkaStreamsProcessorInstrumentation.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dd-java-agent/instrumentation/kafka-streams-0.11/src/main/java/datadog/trace/instrumentation/kafka_streams/KafkaStreamsProcessorInstrumentation.java b/dd-java-agent/instrumentation/kafka-streams-0.11/src/main/java/datadog/trace/instrumentation/kafka_streams/KafkaStreamsProcessorInstrumentation.java index 1f4edb69a31..140acccfc7d 100644 --- a/dd-java-agent/instrumentation/kafka-streams-0.11/src/main/java/datadog/trace/instrumentation/kafka_streams/KafkaStreamsProcessorInstrumentation.java +++ b/dd-java-agent/instrumentation/kafka-streams-0.11/src/main/java/datadog/trace/instrumentation/kafka_streams/KafkaStreamsProcessorInstrumentation.java @@ -13,6 +13,8 @@ import static net.bytebuddy.matcher.ElementMatchers.isPackagePrivate; import static net.bytebuddy.matcher.ElementMatchers.isPublic; import static net.bytebuddy.matcher.ElementMatchers.returns; +import static net.bytebuddy.matcher.ElementMatchers.takesArgument; +import static net.bytebuddy.matcher.ElementMatchers.takesArguments; import com.google.auto.service.AutoService; import datadog.trace.agent.tooling.Instrumenter; @@ -102,7 +104,11 @@ public String[] helperClassNames() { @Override public void adviceTransformations(AdviceTransformation transformation) { transformation.applyAdvice( - isMethod().and(isPublic()).and(named("process")), + isMethod() + .and(isPublic()) + .and(named("process")) + // Method signature changed in 2.6. + .and(takesArguments(0).or(takesArguments(1).and(takesArgument(0, long.class)))), StopInstrumentation.class.getName() + "$StopSpanAdvice"); }