Skip to content

Commit

Permalink
Only instrument the actual Spring TaskScheduler implementations (#8676
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Mateusz Rzeszutek committed Jun 12, 2023
1 parent ebd3118 commit 188d4c2
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package io.opentelemetry.javaagent.instrumentation.spring.scheduling.v3_1;

import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.implementsInterface;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.namedOneOf;
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
Expand All @@ -20,7 +19,12 @@
public class TaskSchedulerInstrumentation implements TypeInstrumentation {
@Override
public ElementMatcher<TypeDescription> typeMatcher() {
return implementsInterface(named("org.springframework.scheduling.TaskScheduler"));
// we're only instrumenting the "real" scheduler implementations, and skipping all the decorator
// impls
return namedOneOf(
"org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler",
"org.springframework.scheduling.concurrent.ConcurrentTaskScheduler",
"org.springframework.scheduling.commonj.TimerManagerTaskScheduler");
}

@Override
Expand Down

0 comments on commit 188d4c2

Please sign in to comment.