Skip to content

Commit 1b4d0ee

Browse files
authored
Do not capture continuation on netty GlobalEventExecutor static init (#11654)
Do not capture continuation on netty GlobalEventExecutor static init GlobalEventExecutor is final Co-authored-by: andrea.marziali <andrea.marziali@datadoghq.com>
1 parent cbc8bb5 commit 1b4d0ee

6 files changed

Lines changed: 10 additions & 28 deletions

File tree

dd-java-agent/instrumentation/java/java-concurrent/java-concurrent-1.8/src/main/java/datadog/trace/instrumentation/java/concurrent/AsyncPropagatingDisableInstrumentation.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ public AsyncPropagatingDisableInstrumentation() {
4747
namedOneOf("reactor.core.scheduler.SchedulerTask", "reactor.core.scheduler.WorkerTask");
4848
private static final ElementMatcher<TypeDescription> RXJAVA2_DISABLED_TYPE_INITIALIZERS =
4949
named("io.reactivex.internal.schedulers.AbstractDirectTask");
50+
private static final ElementMatcher<TypeDescription> NETTY_GLOBAL_EVENT_EXECUTOR =
51+
namedOneOf(
52+
"io.netty.util.concurrent.GlobalEventExecutor",
53+
// shaded version
54+
"io.grpc.netty.shaded.io.netty.util.concurrent.GlobalEventExecutor");
5055
private static final ElementMatcher<TypeDescription> JAVA_HTTP_CLIENT =
5156
extendsClass(named("java.net.http.HttpClient"));
5257
private static final String LETTUCE_HANDSHAKE_HANDLER =
@@ -86,7 +91,9 @@ public String[] knownMatchingTypes() {
8691
"com.mongodb.internal.connection.DefaultConnectionPool$AsyncWorkManager",
8792
"io.reactivex.internal.schedulers.AbstractDirectTask",
8893
"jdk.internal.net.http.HttpClientImpl",
89-
LETTUCE_HANDSHAKE_HANDLER
94+
LETTUCE_HANDSHAKE_HANDLER,
95+
"io.netty.util.concurrent.GlobalEventExecutor",
96+
"io.grpc.netty.shaded.io.netty.util.concurrent.GlobalEventExecutor"
9097
};
9198
}
9299

@@ -187,6 +194,8 @@ public void methodAdvice(MethodTransformer transformer) {
187194
isTypeInitializer().and(isDeclaredBy(REACTOR_DISABLED_TYPE_INITIALIZERS)), advice);
188195
transformer.applyAdvice(
189196
isTypeInitializer().and(isDeclaredBy(RXJAVA2_DISABLED_TYPE_INITIALIZERS)), advice);
197+
transformer.applyAdvice(
198+
isTypeInitializer().and(isDeclaredBy(NETTY_GLOBAL_EVENT_EXECUTOR)), advice);
190199
transformer.applyAdvice(namedOneOf("sendAsync").and(isDeclaredBy(JAVA_HTTP_CLIENT)), advice);
191200
transformer.applyAdvice(
192201
named("channelRegistered").and(isDeclaredBy(named(LETTUCE_HANDSHAKE_HANDLER))), advice);

dd-java-agent/instrumentation/netty/netty-4.1/src/test/groovy/ReactorNettyTest.groovy

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ import java.util.concurrent.ExecutionException
1414
import java.util.concurrent.TimeUnit
1515

1616
class ReactorNettyTest extends HttpClientTest implements TestingNettyHttpNamingConventions.ClientV0 {
17-
@Override
18-
boolean useStrictTraceWrites() {
19-
// TODO fix this by making sure that spans get closed properly
20-
return false
21-
}
22-
2317
@Override
2418
boolean testCircularRedirects() {
2519
false

dd-java-agent/instrumentation/spring/spring-webflux/spring-webflux-5.0/src/bootTest/groovy/SpringWebfluxTest.groovy

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ class SpringWebfluxTest extends InstrumentationSpecification {
5353

5454
WebClient client = WebClient.builder().clientConnector(new ReactorClientHttpConnector()).build()
5555

56-
@Override
57-
boolean useStrictTraceWrites() {
58-
false
59-
}
6056

6157
def "Basic GET test #testName"() {
6258
setup:

dd-java-agent/instrumentation/spring/spring-webflux/spring-webflux-5.0/src/test/groovy/dd/trace/instrumentation/springwebflux/client/SpringWebfluxHttpClientBase.groovy

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan
2121

2222
abstract class SpringWebfluxHttpClientBase extends HttpClientTest implements TestingGenericHttpNamingConventions.ClientV0 {
2323

24-
@Override
25-
boolean useStrictTraceWrites() {
26-
// TODO fix this by making sure that spans get closed properly
27-
return false
28-
}
29-
3024
abstract WebClient createClient(CharSequence component)
3125

3226
abstract void check()

dd-java-agent/instrumentation/spring/spring-webflux/spring-webflux-6.0/src/bootTest/groovy/SpringWebfluxTest.groovy

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -859,11 +859,6 @@ class SpringWebfluxHttp11Test extends InstrumentationSpecification {
859859
}
860860
return ret
861861
}
862-
863-
@Override
864-
boolean useStrictTraceWrites() {
865-
false
866-
}
867862
}
868863

869864
class SpringWebfluxHttp2UpgradeTest extends SpringWebfluxHttp11Test {

dd-java-agent/instrumentation/spring/spring-webflux/spring-webflux-6.0/src/test/groovy/dd/trace/instrumentation/springwebflux6/client/SpringWebfluxHttpClientBase.groovy

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan
2222

2323
abstract class SpringWebfluxHttpClientBase extends HttpClientTest implements TestingGenericHttpNamingConventions.ClientV0 {
2424

25-
@Override
26-
boolean useStrictTraceWrites() {
27-
// TODO fix this by making sure that spans get closed properly
28-
return false
29-
}
30-
3125
abstract WebClient createClient(CharSequence component)
3226

3327
abstract void check()

0 commit comments

Comments
 (0)