diff --git a/dd-java-agent/instrumentation/spring-scheduling-3.1/src/main/java/datadog/trace/instrumentation/springscheduling/SpringSchedulingInstrumentation.java b/dd-java-agent/instrumentation/spring-scheduling-3.1/src/main/java/datadog/trace/instrumentation/springscheduling/SpringSchedulingInstrumentation.java index c2b29f6b8d2..f77251982fe 100644 --- a/dd-java-agent/instrumentation/spring-scheduling-3.1/src/main/java/datadog/trace/instrumentation/springscheduling/SpringSchedulingInstrumentation.java +++ b/dd-java-agent/instrumentation/spring-scheduling-3.1/src/main/java/datadog/trace/instrumentation/springscheduling/SpringSchedulingInstrumentation.java @@ -1,16 +1,22 @@ package datadog.trace.instrumentation.springscheduling; +import static datadog.trace.bootstrap.instrumentation.java.concurrent.ExcludeFilter.ExcludeType.RUNNABLE; import static net.bytebuddy.matcher.ElementMatchers.isConstructor; import static net.bytebuddy.matcher.ElementMatchers.takesArgument; import com.google.auto.service.AutoService; +import datadog.trace.agent.tooling.ExcludeFilterProvider; import datadog.trace.agent.tooling.Instrumenter; import datadog.trace.agent.tooling.InstrumenterModule; +import datadog.trace.bootstrap.instrumentation.java.concurrent.ExcludeFilter; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; import net.bytebuddy.asm.Advice; @AutoService(InstrumenterModule.class) public final class SpringSchedulingInstrumentation extends InstrumenterModule.Tracing - implements Instrumenter.ForSingleType { + implements Instrumenter.ForSingleType, ExcludeFilterProvider { public SpringSchedulingInstrumentation() { super("spring-scheduling"); @@ -35,6 +41,14 @@ public void methodAdvice(MethodTransformer transformer) { getClass().getName() + "$SpringSchedulingAdvice"); } + @Override + public Map> excludedClasses() { + return Collections.singletonMap( + RUNNABLE, + Collections.singleton( + "org.springframework.scheduling.config.Task$OutcomeTrackingRunnable")); + } + public static class SpringSchedulingAdvice { @Advice.OnMethodEnter(suppress = Throwable.class) public static void onConstruction(