Convert apache-http, akka, and play to muzzle plugin
MODIFY
dd-java-agent/instrumentation/akka-http-10.0/akka-http-10.0.gradle
dd-java-agent/instrumentation/akka-http-10.0/akka-http-10.0.gradle
@@ -16,6 +16,20 @@ compileLagomTestGroovy {
targetCompatibility = 1.8
}
+
+muzzle {
+ pass {
+ group = 'com.typesafe.akka'
+ module = 'akka-http_2.11'
+ versions = "[10.0.0,10.0.12)"
+ }
+ pass {
+ group = 'com.typesafe.akka'
+ module = 'akka-http_2.12'
+ versions = "[10.0.0,10.0.12)"
+ }
+}
+
dependencies {
compileOnly group: 'com.typesafe.akka', name: 'akka-http_2.11', version: '10.0.0'

MODIFY
dd-java-agent/instrumentation/apache-httpclient-4.3/apache-httpclient-4.3.gradle
dd-java-agent/instrumentation/apache-httpclient-4.3/apache-httpclient-4.3.gradle
-apply plugin: 'version-scan'
+apply from: "${rootDir}/gradle/java.gradle"
-versionScan {
+muzzle {
+ pass {
group = "org.apache.httpcomponents"
module = "httpclient"
versions = "[4.3,)"
- legacyGroup = "commons-httpclient"
- legacyModule = "commons-httpclient"
- verifyPresent = [
- // The commented out classes are required for the instrumentation (this is checked by our bytebuddy rules).
- // Once the verifier can report on the failed versions these classes can be commented out and the pass range can be widened.
-
- // "org.apache.http.HttpException" : null,
- // "org.apache.http.HttpRequest" : null,
- // "org.apache.http.client.RedirectStrategy" : null,
- "org.apache.http.client.methods.CloseableHttpResponse": null,
- "org.apache.http.client.methods.HttpExecutionAware" : null,
- "org.apache.http.client.methods.HttpRequestWrapper" : null,
- "org.apache.http.client.protocol.HttpClientContext" : null,
- // "org.apache.http.conn.routing.HttpRoute" : null,
- "org.apache.http.impl.execchain.ClientExecChain" : null
- ]
}
-
-apply from: "${rootDir}/gradle/java.gradle"
+ pass {
+ group = "commons-httpclient"
+ module = "commons-httpclient"
+ versions = "[4.3,)"
+ }
+ fail {
+ group = "org.apache.httpcomponents"
+ module = "httpclient"
+ versions = "[,4.3)"
+ }
+}
apply plugin: 'org.unbroken-dome.test-sets'

MODIFY
dd-java-agent/instrumentation/apache-httpclient-4.3/src/main/java/datadog/trace/instrumentation/apachehttpclient/ApacheHttpClientInstrumentation.java
dd-java-agent/instrumentation/apache-httpclient-4.3/src/main/java/datadog/trace/instrumentation/apachehttpclient/ApacheHttpClientInstrumentation.java
package datadog.trace.instrumentation.apachehttpclient;
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasSuperType;
-import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
import static io.opentracing.log.Fields.ERROR_OBJECT;
import static net.bytebuddy.matcher.ElementMatchers.isAbstract;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
@@ -36,22 +35,6 @@ public class ApacheHttpClientInstrumentation extends Instrumenter.Default {
.or(safeHasSuperType(named("org.apache.http.impl.client.CloseableHttpClient")));
}
- @Override
- public ElementMatcher<ClassLoader> classLoaderMatcher() {
- return classLoaderHasClasses(
- "org.apache.http.HttpException",
- "org.apache.http.HttpRequest",
- "org.apache.http.client.RedirectStrategy",
- "org.apache.http.client.methods.CloseableHttpResponse",
- "org.apache.http.client.methods.HttpExecutionAware",
- "org.apache.http.client.methods.HttpRequestWrapper",
- "org.apache.http.client.protocol.HttpClientContext",
- "org.apache.http.conn.routing.HttpRoute",
- "org.apache.http.impl.execchain.ClientExecChain",
- "org.apache.http.impl.client.CloseableHttpClient",
- "org.apache.http.impl.client.InternalHttpClient");
- }
-
@Override
public String[] helperClassNames() {
return new String[] {

MODIFY
dd-java-agent/instrumentation/play-2.4/play-2.4.gradle
dd-java-agent/instrumentation/play-2.4/play-2.4.gradle
@@ -7,6 +7,19 @@ testSets {
latestDepTest
}
+muzzle {
+ pass {
+ group = 'com.typesafe.play'
+ module = 'play_2.11'
+ versions = '[2.4.0,2.7.0-M1)'
+ }
+ pass {
+ group = 'com.typesafe.play'
+ module = 'play_2.12'
+ versions = '[2.4.0,2.7.0-M1)'
+ }
+}
+
dependencies {
compileOnly group: 'com.typesafe.play', name: 'play_2.11', version: '2.4.0'

MODIFY
dd-java-agent/instrumentation/play-2.4/src/main/java/datadog/trace/instrumentation/play/PlayInstrumentation.java
dd-java-agent/instrumentation/play-2.4/src/main/java/datadog/trace/instrumentation/play/PlayInstrumentation.java
package datadog.trace.instrumentation.play;
import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasSuperType;
-import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClassWithMethod;
-import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
import static io.opentracing.log.Fields.ERROR_OBJECT;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.returns;
@@ -50,18 +48,6 @@ public final class PlayInstrumentation extends Instrumenter.Default {
return safeHasSuperType(named("play.api.mvc.Action"));
}
- @Override
- public ElementMatcher<ClassLoader> classLoaderMatcher() {
- return classLoaderHasClasses(
- "akka.japi.JavaPartialFunction",
- "play.api.mvc.Action",
- "play.api.mvc.Result",
- "scala.Option",
- "scala.Tuple2",
- "scala.concurrent.Future")
- .and(classLoaderHasClassWithMethod("play.api.mvc.Request", "tags"));
- }
-
@Override
public String[] helperClassNames() {
return new String[] {

Convert apache-http, akka, and play to muzzle plugin