Muzzle AWS SDK Instrumentation
Add muzzle blocks and remove class loader matcher methods.
MODIFY
dd-java-agent/instrumentation/aws-java-sdk-1.11.0/aws-java-sdk-1.11.0.gradle
dd-java-agent/instrumentation/aws-java-sdk-1.11.0/aws-java-sdk-1.11.0.gradle
-apply plugin: 'version-scan'
-
-// Commented out because version scan doesn't catch the combination of tests.
-// HttpClientFactory is only present starting in 1.11.0
-// HandlerContextAware is added in 1.11.106
-// The combination of the two allow us to filter the ranges.
-//
-
-//versionScan {
-// group = "com.amazonaws"
-// module = "aws-java-sdk-core"
-// versions = "[1.11.0,1.11.106)"
-// verifyPresent = [
-// "com.amazonaws.http.client.HttpClientFactory": null,
-// ]
-// verifyMissing = [
-// "com.amazonaws.HandlerContextAware",
-// ]
-//}
-
-//versionScan {
-// group = "com.amazonaws"
-// module = "aws-java-sdk-core"
-// versions = "[1.11.0,)"
-// verifyPresent = [
-// "com.amazonaws.http.client.HttpClientFactory": null,
-// ]
-//}
-
-versionScan {
+muzzle {
+ pass {
group = "com.amazonaws"
module = "aws-java-sdk-core"
- versions = "[,1.11.106)"
- verifyMissing = [
- "com.amazonaws.HandlerContextAware",
- ]
+ versions = "[1.10.33,1.11.106)"
+ }
}
apply from: "${rootDir}/gradle/java.gradle"

MODIFY
dd-java-agent/instrumentation/aws-java-sdk-1.11.0/src/main/java/datadog/trace/instrumentation/aws/v0/AWSClientInstrumentation.java
dd-java-agent/instrumentation/aws-java-sdk-1.11.0/src/main/java/datadog/trace/instrumentation/aws/v0/AWSClientInstrumentation.java
package datadog.trace.instrumentation.aws.v0;
-import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
import static net.bytebuddy.matcher.ElementMatchers.declaresField;
import static net.bytebuddy.matcher.ElementMatchers.isConstructor;
import static net.bytebuddy.matcher.ElementMatchers.named;
-import static net.bytebuddy.matcher.ElementMatchers.not;
import com.amazonaws.handlers.RequestHandler2;
import com.google.auto.service.AutoService;
@@ -34,15 +32,6 @@ public final class AWSClientInstrumentation extends Instrumenter.Default {
.and(declaresField(named("requestHandler2s")));
}
- @Override
- public ElementMatcher<ClassLoader> classLoaderMatcher() {
- return classLoaderHasClasses("com.amazonaws.http.client.HttpClientFactory")
- .and(
- not(
- classLoaderHasClasses(
- "com.amazonaws.client.builder.AwsClientBuilder$EndpointConfiguration")));
- }
-
@Override
public String[] helperClassNames() {
return new String[] {

MODIFY
dd-java-agent/instrumentation/aws-java-sdk-1.11.106/aws-java-sdk-1.11.106.gradle
dd-java-agent/instrumentation/aws-java-sdk-1.11.106/aws-java-sdk-1.11.106.gradle
-apply plugin: 'version-scan'
-
-versionScan {
+muzzle {
+ pass {
group = "com.amazonaws"
module = "aws-java-sdk-core"
versions = "[1.11.106,)"
- verifyPresent = [
- "com.amazonaws.HandlerContextAware": null,
- ]
+ }
}
apply from: "${rootDir}/gradle/java.gradle"

MODIFY
dd-java-agent/instrumentation/aws-java-sdk-1.11.106/src/main/java/datadog/trace/instrumentation/aws/v106/AWSClientInstrumentation.java
dd-java-agent/instrumentation/aws-java-sdk-1.11.106/src/main/java/datadog/trace/instrumentation/aws/v106/AWSClientInstrumentation.java
package datadog.trace.instrumentation.aws.v106;
-import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
import static net.bytebuddy.matcher.ElementMatchers.declaresField;
import static net.bytebuddy.matcher.ElementMatchers.isAbstract;
import static net.bytebuddy.matcher.ElementMatchers.isConstructor;
@@ -37,11 +36,6 @@ public final class AWSClientInstrumentation extends Instrumenter.Default {
.and(declaresField(named("requestHandler2s"))));
}
- @Override
- public ElementMatcher<ClassLoader> classLoaderMatcher() {
- return classLoaderHasClasses("com.amazonaws.HandlerContextAware");
- }
-
@Override
public String[] helperClassNames() {
return new String[] {

Muzzle AWS SDK Instrumentation

Add muzzle blocks and remove class loader matcher methods.