Muzzle Kafka Client & Streams Instrumentation
Add muzzle blocks and remove class loader matcher methods.
MODIFY
dd-java-agent/instrumentation/kafka-clients-0.11/kafka-clients-0.11.gradle
dd-java-agent/instrumentation/kafka-clients-0.11/kafka-clients-0.11.gradle
-apply plugin: 'version-scan'
-
-versionScan {
+muzzle {
+ pass {
group = "org.apache.kafka"
module = "kafka-clients"
versions = "[0.11.0.0,)"
- verifyPresent = [
- 'org.apache.kafka.common.header.Header' : null,
- 'org.apache.kafka.common.header.Headers': null,
- ]
+ assertInverse = true
+ }
}
apply from: "${rootDir}/gradle/java.gradle"

MODIFY
dd-java-agent/instrumentation/kafka-clients-0.11/src/main/java/datadog/trace/instrumentation/kafka_clients/KafkaConsumerInstrumentation.java
dd-java-agent/instrumentation/kafka-clients-0.11/src/main/java/datadog/trace/instrumentation/kafka_clients/KafkaConsumerInstrumentation.java
package datadog.trace.instrumentation.kafka_clients;
-import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
import static net.bytebuddy.matcher.ElementMatchers.named;
@@ -45,12 +44,6 @@ public final class KafkaConsumerInstrumentation extends Instrumenter.Default {
return named("org.apache.kafka.clients.consumer.ConsumerRecords");
}
- @Override
- public ElementMatcher<ClassLoader> classLoaderMatcher() {
- return classLoaderHasClasses(
- "org.apache.kafka.common.header.Header", "org.apache.kafka.common.header.Headers");
- }
-
@Override
public String[] helperClassNames() {
return HELPER_CLASS_NAMES;

MODIFY
dd-java-agent/instrumentation/kafka-clients-0.11/src/main/java/datadog/trace/instrumentation/kafka_clients/KafkaProducerInstrumentation.java
dd-java-agent/instrumentation/kafka-clients-0.11/src/main/java/datadog/trace/instrumentation/kafka_clients/KafkaProducerInstrumentation.java
package datadog.trace.instrumentation.kafka_clients;
-import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
import static io.opentracing.log.Fields.ERROR_OBJECT;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
@@ -46,12 +45,6 @@ public final class KafkaProducerInstrumentation extends Instrumenter.Default {
return named("org.apache.kafka.clients.producer.KafkaProducer");
}
- @Override
- public ElementMatcher<ClassLoader> classLoaderMatcher() {
- return classLoaderHasClasses(
- "org.apache.kafka.common.header.Header", "org.apache.kafka.common.header.Headers");
- }
-
@Override
public String[] helperClassNames() {
return HELPER_CLASS_NAMES;

MODIFY
dd-java-agent/instrumentation/kafka-streams-0.11/kafka-streams-0.11.gradle
dd-java-agent/instrumentation/kafka-streams-0.11/kafka-streams-0.11.gradle
-apply plugin: 'version-scan'
-
-versionScan {
+muzzle {
+ pass {
group = "org.apache.kafka"
module = "kafka-streams"
versions = "[0.11.0.0,)"
- verifyPresent = [
- 'org.apache.kafka.streams.state.internals.OrderedBytes': null
- ]
+ }
}
apply from: "${rootDir}/gradle/java.gradle"

MODIFY
dd-java-agent/instrumentation/kafka-streams-0.11/src/main/java/datadog/trace/instrumentation/kafka_streams/KafkaStreamsProcessorInstrumentation.java
dd-java-agent/instrumentation/kafka-streams-0.11/src/main/java/datadog/trace/instrumentation/kafka_streams/KafkaStreamsProcessorInstrumentation.java
@@ -46,11 +46,6 @@ public class KafkaStreamsProcessorInstrumentation {
return named("org.apache.kafka.streams.processor.internals.PartitionGroup");
}
- @Override
- public ElementMatcher<ClassLoader> classLoaderMatcher() {
- return classLoaderHasClasses("org.apache.kafka.streams.state.internals.OrderedBytes");
- }
-
@Override
public String[] helperClassNames() {
return HELPER_CLASS_NAMES;

MODIFY
dd-java-agent/instrumentation/kafka-streams-0.11/src/main/java/datadog/trace/instrumentation/kafka_streams/KafkaStreamsSourceNodeRecordDeserializerInstrumentation.java
dd-java-agent/instrumentation/kafka-streams-0.11/src/main/java/datadog/trace/instrumentation/kafka_streams/KafkaStreamsSourceNodeRecordDeserializerInstrumentation.java
package datadog.trace.instrumentation.kafka_streams;
-import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
import static net.bytebuddy.matcher.ElementMatchers.named;
@@ -30,11 +29,6 @@ public class KafkaStreamsSourceNodeRecordDeserializerInstrumentation extends Ins
return named("org.apache.kafka.streams.processor.internals.SourceNodeRecordDeserializer");
}
- @Override
- public ElementMatcher<ClassLoader> classLoaderMatcher() {
- return classLoaderHasClasses("org.apache.kafka.streams.state.internals.OrderedBytes");
- }
-
@Override
public Map<ElementMatcher, String> transformers() {
final Map<ElementMatcher, String> transformers = new HashMap<>();

Muzzle Kafka Client & Streams Instrumentation

Add muzzle blocks and remove class loader matcher methods.