Add version scan.
MODIFY
buildSrc/src/main/groovy/VersionScanPlugin.groovy
buildSrc/src/main/groovy/VersionScanPlugin.groovy
@@ -241,6 +241,7 @@ class VersionScanPlugin implements Plugin<Project> {
list.removeIf {
def version = it.toString().toLowerCase()
return version.contains("rc") ||
+ version.contains(".cr") ||
version.contains("alpha") ||
version.contains("beta") ||
version.contains("-b") ||

MODIFY
dd-java-agent/instrumentation/netty-4.0/netty-4.0.gradle
dd-java-agent/instrumentation/netty-4.0/netty-4.0.gradle
+apply plugin: 'version-scan'
+
+versionScan {
+ group = "io.netty"
+ module = "netty-all"
+ legacyModule = "netty"
+ versions = "[4.0.0.Final,4.1.0.Final)"
+ verifyPresent = [
+ "io.netty.channel.local.LocalEventLoop": null,
+ ]
+}
+
apply from: "${rootDir}/gradle/java.gradle"
apply plugin: 'org.unbroken-dome.test-sets'

MODIFY
dd-java-agent/instrumentation/netty-4.0/src/main/java/datadog/trace/instrumentation/netty40/NettyChannelPipelineInstrumentation.java
dd-java-agent/instrumentation/netty-4.0/src/main/java/datadog/trace/instrumentation/netty40/NettyChannelPipelineInstrumentation.java
package datadog.trace.instrumentation.netty40;
+import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
@@ -49,7 +50,9 @@ public class NettyChannelPipelineInstrumentation extends Instrumenter.Configurab
@Override
public AgentBuilder apply(final AgentBuilder agentBuilder) {
return agentBuilder
- .type(not(isInterface()).and(hasSuperType(named("io.netty.channel.ChannelPipeline"))))
+ .type(
+ not(isInterface()).and(hasSuperType(named("io.netty.channel.ChannelPipeline"))),
+ classLoaderHasClasses("io.netty.channel.local.LocalEventLoop"))
.transform(
new HelperInjector(
// client helpers

MODIFY
dd-java-agent/instrumentation/netty-4.1/netty-4.1.gradle
dd-java-agent/instrumentation/netty-4.1/netty-4.1.gradle
+apply plugin: 'version-scan'
+
+versionScan {
+ group = "io.netty"
+ module = "netty-all"
+ legacyModule = "netty"
+ versions = "[4.1.0.Final,)"
+ verifyPresent = [
+ "io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder": null,
+ ]
+}
+
apply from: "${rootDir}/gradle/java.gradle"
apply plugin: 'org.unbroken-dome.test-sets'

MODIFY
dd-java-agent/instrumentation/netty-4.1/src/main/java/datadog/trace/instrumentation/netty41/NettyChannelPipelineInstrumentation.java
dd-java-agent/instrumentation/netty-4.1/src/main/java/datadog/trace/instrumentation/netty41/NettyChannelPipelineInstrumentation.java
package datadog.trace.instrumentation.netty41;
+import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
@@ -49,7 +50,9 @@ public class NettyChannelPipelineInstrumentation extends Instrumenter.Configurab
@Override
public AgentBuilder apply(final AgentBuilder agentBuilder) {
return agentBuilder
- .type(not(isInterface()).and(hasSuperType(named("io.netty.channel.ChannelPipeline"))))
+ .type(
+ not(isInterface()).and(hasSuperType(named("io.netty.channel.ChannelPipeline"))),
+ classLoaderHasClasses("io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder"))
.transform(
new HelperInjector(
// client helpers

Add version scan.