Fix netty dependency and class version checking
MODIFY
dd-java-agent/instrumentation/netty-4.0/netty-4.0.gradle
dd-java-agent/instrumentation/netty-4.0/netty-4.0.gradle
@@ -2,11 +2,11 @@ apply plugin: 'version-scan'
versionScan {
group = "io.netty"
- module = "netty-all"
+ module = "netty-codec-http"
legacyModule = "netty"
versions = "[4.0.0.Final,4.1.0.Final)"
verifyPresent = [
- "io.netty.channel.local.LocalEventLoop": null,
+ "io.netty.handler.codec.spdy.SpdyOrHttpChooser": null,
]
}
@@ -21,7 +21,7 @@ testSets {
}
dependencies {
- compileOnly group: 'io.netty', name: 'netty-all', version: '4.0.0.Final'
+ compileOnly group: 'io.netty', name: 'netty-codec-http', version: '4.0.0.Final'
compile project(':dd-java-agent:agent-tooling')

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
@@ -53,7 +53,7 @@ public class NettyChannelPipelineInstrumentation extends Instrumenter.Default {
@Override
public ElementMatcher<? super ClassLoader> classLoaderMatcher() {
- return classLoaderHasClasses("io.netty.channel.local.LocalEventLoop");
+ return classLoaderHasClasses("io.netty.handler.codec.spdy.SpdyOrHttpChooser");
}
@Override
@@ -74,7 +74,7 @@ public class NettyChannelPipelineInstrumentation extends Instrumenter.Default {
@Override
public Map<ElementMatcher, String> transformers() {
- Map<ElementMatcher, String> transformers = new HashMap<>();
+ final Map<ElementMatcher, String> transformers = new HashMap<>();
transformers.put(
isMethod()
.and(nameStartsWith("add"))

MODIFY
dd-java-agent/instrumentation/netty-4.1/netty-4.1.gradle
dd-java-agent/instrumentation/netty-4.1/netty-4.1.gradle
@@ -2,11 +2,11 @@ apply plugin: 'version-scan'
versionScan {
group = "io.netty"
- module = "netty-all"
+ module = "netty-codec-http"
legacyModule = "netty"
versions = "[4.1.0.Final,)"
verifyPresent = [
- "io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder": null,
+ "io.netty.handler.codec.http.HttpHeaderValues": null,
]
}
@@ -21,7 +21,7 @@ testSets {
}
dependencies {
- compileOnly group: 'io.netty', name: 'netty-all', version: '4.1.0.Final'
+ compileOnly group: 'io.netty', name: 'netty-codec-http', version: '4.1.0.Final'
compile project(':dd-java-agent:agent-tooling')

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
@@ -53,7 +53,7 @@ public class NettyChannelPipelineInstrumentation extends Instrumenter.Default {
@Override
public ElementMatcher<? super ClassLoader> classLoaderMatcher() {
- return classLoaderHasClasses("io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder");
+ return classLoaderHasClasses("io.netty.handler.codec.http.HttpHeaderValues");
}
@Override
@@ -74,7 +74,7 @@ public class NettyChannelPipelineInstrumentation extends Instrumenter.Default {
@Override
public Map<ElementMatcher, String> transformers() {
- Map<ElementMatcher, String> transformers = new HashMap<>();
+ final Map<ElementMatcher, String> transformers = new HashMap<>();
transformers.put(
isMethod()
.and(nameStartsWith("add"))

Fix netty dependency and class version checking