Skip to content

Commit 544c86b

Browse files
committed
fix(java-concurrent): Fix FJP instrumentation on Java 21+
From Java 21+, do no more stop context capture for ForkJoinPool.execute(Runnable).
1 parent ab73c44 commit 544c86b

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

dd-java-agent/instrumentation/java-concurrent/java-concurrent-21/src/main/java/datadog/trace/instrumentation/java/concurrent/structuredconcurrency/StructuredTaskScopeInstrumentation.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
package datadog.trace.instrumentation.java.concurrent.structuredconcurrency;
22

33
import static datadog.trace.bootstrap.instrumentation.java.concurrent.AdviceUtils.capture;
4-
import static datadog.trace.bootstrap.instrumentation.java.concurrent.ExcludeFilter.ExcludeType.FORK_JOIN_TASK;
5-
import static java.util.Collections.singleton;
64
import static java.util.Collections.singletonMap;
75
import static net.bytebuddy.matcher.ElementMatchers.isConstructor;
86

97
import com.google.auto.service.AutoService;
10-
import datadog.trace.agent.tooling.ExcludeFilterProvider;
118
import datadog.trace.agent.tooling.Instrumenter;
129
import datadog.trace.agent.tooling.InstrumenterModule;
1310
import datadog.trace.api.Platform;
1411
import datadog.trace.bootstrap.ContextStore;
1512
import datadog.trace.bootstrap.InstrumentationContext;
16-
import datadog.trace.bootstrap.instrumentation.java.concurrent.ExcludeFilter;
1713
import datadog.trace.bootstrap.instrumentation.java.concurrent.State;
18-
import java.util.Collection;
1914
import java.util.Map;
2015
import net.bytebuddy.asm.Advice;
2116

@@ -27,10 +22,7 @@
2722
@SuppressWarnings("unused")
2823
@AutoService(InstrumenterModule.class)
2924
public class StructuredTaskScopeInstrumentation extends InstrumenterModule.Tracing
30-
implements Instrumenter.ForBootstrap,
31-
Instrumenter.ForSingleType,
32-
Instrumenter.HasMethodAdvice,
33-
ExcludeFilterProvider {
25+
implements Instrumenter.ForBootstrap, Instrumenter.ForSingleType, Instrumenter.HasMethodAdvice {
3426

3527
public StructuredTaskScopeInstrumentation() {
3628
super("java_concurrent", "structured_task_scope");
@@ -57,14 +49,6 @@ public void methodAdvice(MethodTransformer transformer) {
5749
transformer.applyAdvice(isConstructor(), getClass().getName() + "$ConstructorAdvice");
5850
}
5951

60-
@Override
61-
public Map<ExcludeFilter.ExcludeType, ? extends Collection<String>> excludedClasses() {
62-
// Prevent the ForkJoinPool instrumentation to enable the task scope too early on the carrier
63-
// thread rather than on the expected running thread, which is virtual by default.
64-
return singletonMap(
65-
FORK_JOIN_TASK, singleton("java.util.concurrent.ForkJoinTask$RunnableExecuteAction"));
66-
}
67-
6852
public static final class ConstructorAdvice {
6953
@Advice.OnMethodExit
7054
public static <T> void captureScope(

0 commit comments

Comments
 (0)