From e64755bc62fcbbd9aab321137593e0b611b87769 Mon Sep 17 00:00:00 2001 From: Piotr Wolski Date: Tue, 10 Dec 2024 17:41:45 -0700 Subject: [PATCH 1/5] Add kafka connect instrumentation --- .../kafka-connect-0.11/build.gradle | 37 +++ .../kafka-connect-0.11/gradle.lockfile | 258 ++++++++++++++++++ .../ConnectWorkerInstrumentation.java | 61 +++++ .../kafka_connect/TaskListener.java | 43 +++ .../ConnectWorkerInstrumentationTest.groovy | 182 ++++++++++++ settings.gradle | 1 + 6 files changed, 582 insertions(+) create mode 100644 dd-java-agent/instrumentation/kafka-connect-0.11/build.gradle create mode 100644 dd-java-agent/instrumentation/kafka-connect-0.11/gradle.lockfile create mode 100644 dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/ConnectWorkerInstrumentation.java create mode 100644 dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/TaskListener.java create mode 100644 dd-java-agent/instrumentation/kafka-connect-0.11/src/test/groovy/ConnectWorkerInstrumentationTest.groovy diff --git a/dd-java-agent/instrumentation/kafka-connect-0.11/build.gradle b/dd-java-agent/instrumentation/kafka-connect-0.11/build.gradle new file mode 100644 index 00000000000..117bff84bfb --- /dev/null +++ b/dd-java-agent/instrumentation/kafka-connect-0.11/build.gradle @@ -0,0 +1,37 @@ +muzzle { + pass { + group = "org.apache.kafka" + module = "connect-runtime" + versions = "[0.11.0.0,)" + assertInverse = true + } +} + +apply from: "$rootDir/gradle/java.gradle" + +dependencies { + compileOnly group: 'org.apache.kafka', name: 'connect-runtime', version: '0.11.0.0' + + testImplementation(testFixtures(project(':dd-java-agent:agent-iast'))) + testRuntimeOnly project(':dd-java-agent:instrumentation:iast-instrumenter') + testRuntimeOnly project(':dd-java-agent:instrumentation:java-lang') + testRuntimeOnly project(':dd-java-agent:instrumentation:java-io') + testRuntimeOnly project(':dd-java-agent:instrumentation:jackson-core') + testRuntimeOnly project(':dd-java-agent:instrumentation:jackson-core:jackson-core-2.8') + testImplementation(group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.10') + testImplementation group: 'org.assertj', name: 'assertj-core', version: '2.9.+' + testImplementation group: 'org.mockito', name: 'mockito-core', version: '2.19.0' + testImplementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.3' + testImplementation 'org.apache.kafka:connect-api:2.7.0' // Fixed version + testImplementation 'org.apache.kafka:connect-runtime:2.7.0' + testImplementation 'org.apache.kafka:connect-file:2.7.0' // For FileStreamSourceConnector + testImplementation 'org.apache.kafka:kafka-clients:2.7.0' + // Spring Kafka Test library + testImplementation 'org.springframework.kafka:spring-kafka-test:2.7.9' // Version compatible with Kafka 2.7.x + testRuntimeOnly project(':dd-java-agent:instrumentation:kafka-clients-0.11') +} + +configurations.testRuntimeClasspath { + // spock-core depends on assertj version that is not compatible with kafka-clients + resolutionStrategy.force 'org.assertj:assertj-core:2.9.1' +} diff --git a/dd-java-agent/instrumentation/kafka-connect-0.11/gradle.lockfile b/dd-java-agent/instrumentation/kafka-connect-0.11/gradle.lockfile new file mode 100644 index 00000000000..eb091a85891 --- /dev/null +++ b/dd-java-agent/instrumentation/kafka-connect-0.11/gradle.lockfile @@ -0,0 +1,258 @@ +# This is a Gradle generated file for dependency locking. +# Manual edits can break the build and are not advised. +# This file is expected to be part of source control. +cafe.cryptography:curve25519-elisabeth:0.1.0=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +cafe.cryptography:ed25519-elisabeth:0.1.0=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +ch.qos.logback:logback-classic:1.2.3=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +ch.qos.logback:logback-core:1.2.3=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.101tec:zkclient:0.10=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.beust:jcommander:1.78=iastLatestDepTest3RuntimeClasspath,latestDepTestRuntimeClasspath,testRuntimeClasspath +com.blogspot.mydailyjava:weak-lock-free:0.17=compileClasspath,iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.datadoghq.okhttp3:okhttp:3.12.15=compileClasspath,iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.datadoghq.okio:okio:1.17.6=compileClasspath,iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.datadoghq:dd-javac-plugin-client:0.1.7=compileClasspath,iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleBootstrap,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.datadoghq:java-dogstatsd-client:4.4.0=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.datadoghq:sketches-java:0.8.3=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-annotations:2.13.3=latestDepTestRuntimeClasspath +com.fasterxml.jackson.core:jackson-annotations:2.15.3=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath +com.fasterxml.jackson.core:jackson-annotations:2.9.10=latestDepTestCompileClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-core:2.13.3=latestDepTestRuntimeClasspath +com.fasterxml.jackson.core:jackson-core:2.15.3=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath +com.fasterxml.jackson.core:jackson-core:2.9.10=latestDepTestCompileClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-databind:2.13.3=latestDepTestRuntimeClasspath +com.fasterxml.jackson.core:jackson-databind:2.15.3=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath +com.fasterxml.jackson.core:jackson-databind:2.9.10=latestDepTestCompileClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.dataformat:jackson-dataformat-csv:2.13.3=latestDepTestRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.13.3=latestDepTestRuntimeClasspath +com.fasterxml.jackson.module:jackson-module-scala_2.13:2.13.3=latestDepTestRuntimeClasspath +com.fasterxml.jackson:jackson-bom:2.13.3=latestDepTestRuntimeClasspath +com.github.javaparser:javaparser-core:3.25.1=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.github.jnr:jffi:1.3.13=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.github.jnr:jnr-a64asm:1.0.0=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.github.jnr:jnr-constants:0.10.4=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.github.jnr:jnr-enxio:0.32.17=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.github.jnr:jnr-ffi:2.2.16=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.github.jnr:jnr-posix:3.1.19=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.github.jnr:jnr-unixsocket:0.38.22=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.github.jnr:jnr-x86asm:1.0.2=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.github.luben:zstd-jni:1.5.2-1=latestDepTestRuntimeClasspath +com.github.luben:zstd-jni:1.5.6-3=iastLatestDepTest3RuntimeClasspath +com.github.spotbugs:spotbugs-annotations:4.2.0=compileClasspath,iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.github.spotbugs:spotbugs-annotations:4.7.3=spotbugs +com.github.spotbugs:spotbugs:4.7.3=spotbugs +com.github.stefanbirkner:system-rules:1.19.0=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.auto.service:auto-service-annotations:1.0-rc7=annotationProcessor,compileClasspath,iastLatestDepTest3AnnotationProcessor,iastLatestDepTest3CompileClasspath,latestDepTestAnnotationProcessor,latestDepTestCompileClasspath,testAnnotationProcessor,testCompileClasspath +com.google.auto.service:auto-service:1.0-rc7=annotationProcessor,iastLatestDepTest3AnnotationProcessor,latestDepTestAnnotationProcessor,testAnnotationProcessor +com.google.auto:auto-common:0.10=annotationProcessor,iastLatestDepTest3AnnotationProcessor,latestDepTestAnnotationProcessor,testAnnotationProcessor +com.google.code.findbugs:jsr305:3.0.2=annotationProcessor,compileClasspath,iastLatestDepTest3AnnotationProcessor,iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestAnnotationProcessor,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,spotbugs,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath +com.google.code.gson:gson:2.9.1=spotbugs +com.google.errorprone:error_prone_annotations:2.2.0=annotationProcessor,iastLatestDepTest3AnnotationProcessor,latestDepTestAnnotationProcessor,testAnnotationProcessor +com.google.guava:failureaccess:1.0.1=annotationProcessor,iastLatestDepTest3AnnotationProcessor,latestDepTestAnnotationProcessor,testAnnotationProcessor +com.google.guava:guava:20.0=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:guava:27.0.1-jre=annotationProcessor,iastLatestDepTest3AnnotationProcessor,latestDepTestAnnotationProcessor,testAnnotationProcessor +com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=annotationProcessor,iastLatestDepTest3AnnotationProcessor,latestDepTestAnnotationProcessor,testAnnotationProcessor +com.google.j2objc:j2objc-annotations:1.1=annotationProcessor,iastLatestDepTest3AnnotationProcessor,latestDepTestAnnotationProcessor,testAnnotationProcessor +com.google.re2j:re2j:1.7=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.squareup.moshi:moshi:1.11.0=compileClasspath,iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.squareup.okhttp3:logging-interceptor:3.12.12=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.squareup.okhttp3:okhttp:3.12.12=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.squareup.okio:okio:1.17.5=compileClasspath,iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.thoughtworks.paranamer:paranamer:2.8=latestDepTestRuntimeClasspath +com.thoughtworks.qdox:qdox:1.12.1=iastLatestDepTest3RuntimeClasspath,latestDepTestRuntimeClasspath,testRuntimeClasspath +com.typesafe.scala-logging:scala-logging_2.13:3.9.4=latestDepTestRuntimeClasspath +com.yammer.metrics:metrics-core:2.2.0=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +commons-cli:commons-cli:1.4=latestDepTestRuntimeClasspath +commons-codec:commons-codec:1.15=spotbugs +commons-fileupload:commons-fileupload:1.5=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +commons-io:commons-io:2.11.0=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +commons-logging:commons-logging:1.2=testCompileClasspath,testRuntimeClasspath +de.thetaphi:forbiddenapis:3.1=compileClasspath +info.picocli:picocli:4.6.3=iastLatestDepTest3RuntimeClasspath,latestDepTestRuntimeClasspath,testRuntimeClasspath +io.dropwizard.metrics:metrics-core:4.1.12.1=latestDepTestRuntimeClasspath +io.micrometer:micrometer-commons:1.13.4=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath +io.micrometer:micrometer-observation:1.13.4=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath +io.netty:netty-buffer:4.1.63.Final=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +io.netty:netty-codec:4.1.63.Final=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +io.netty:netty-common:4.1.63.Final=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +io.netty:netty-handler:4.1.63.Final=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +io.netty:netty-resolver:4.1.63.Final=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +io.netty:netty-transport-native-epoll:4.1.63.Final=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +io.netty:netty-transport-native-unix-common:4.1.63.Final=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +io.netty:netty-transport:4.1.63.Final=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +io.sqreen:libsqreen:11.0.1=iastLatestDepTest3RuntimeClasspath,latestDepTestRuntimeClasspath,testRuntimeClasspath +javax.activation:activation:1.1=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.servlet:javax.servlet-api:3.1.0=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.xml.bind:jaxb-api:2.2.3=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.xml.stream:stax-api:1.0-2=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +jaxen:jaxen:1.2.0=spotbugs +jline:jline:2.14.6=iastLatestDepTest3RuntimeClasspath,latestDepTestRuntimeClasspath,testRuntimeClasspath +junit:junit-dep:4.11=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +junit:junit:4.13.2=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +log4j:log4j:1.2.16=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,testCompileClasspath,testRuntimeClasspath +net.bytebuddy:byte-buddy-agent:1.14.18=compileClasspath,iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +net.bytebuddy:byte-buddy:1.14.18=compileClasspath,iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +net.java.dev.jna:jna-platform:5.8.0=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +net.java.dev.jna:jna:5.8.0=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +net.jcip:jcip-annotations:1.0=compileClasspath,iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,spotbugs,testCompileClasspath,testRuntimeClasspath +net.jpountz.lz4:lz4:1.3.0=compileClasspath,testCompileClasspath,testRuntimeClasspath +net.sf.jopt-simple:jopt-simple:5.0.3=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,testCompileClasspath,testRuntimeClasspath +net.sf.jopt-simple:jopt-simple:5.0.4=latestDepTestRuntimeClasspath +net.sf.saxon:Saxon-HE:11.4=spotbugs +net.sourceforge.argparse4j:argparse4j:0.7.0=latestDepTestRuntimeClasspath +org.apache.ant:ant-antlr:1.10.12=iastLatestDepTest3RuntimeClasspath,latestDepTestRuntimeClasspath,testRuntimeClasspath +org.apache.ant:ant-antlr:1.9.15=codenarc +org.apache.ant:ant-junit:1.10.12=iastLatestDepTest3RuntimeClasspath,latestDepTestRuntimeClasspath,testRuntimeClasspath +org.apache.ant:ant-junit:1.9.15=codenarc +org.apache.ant:ant-launcher:1.10.12=iastLatestDepTest3RuntimeClasspath,latestDepTestRuntimeClasspath,testRuntimeClasspath +org.apache.ant:ant:1.10.12=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.bcel:bcel:6.5.0=spotbugs +org.apache.commons:commons-lang3:3.12.0=spotbugs +org.apache.commons:commons-text:1.10.0=spotbugs +org.apache.httpcomponents.client5:httpclient5:5.1.3=spotbugs +org.apache.httpcomponents.core5:httpcore5-h2:5.1.3=spotbugs +org.apache.httpcomponents.core5:httpcore5:5.1.3=spotbugs +org.apache.kafka:kafka-clients:0.11.0.0=compileClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.kafka:kafka-clients:3.2.3=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.apache.kafka:kafka-clients:3.8.0=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath +org.apache.kafka:kafka-metadata:3.2.3=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.apache.kafka:kafka-raft:3.2.3=latestDepTestRuntimeClasspath +org.apache.kafka:kafka-server-common:3.2.3=latestDepTestRuntimeClasspath +org.apache.kafka:kafka-storage-api:3.2.3=latestDepTestRuntimeClasspath +org.apache.kafka:kafka-storage:3.2.3=latestDepTestRuntimeClasspath +org.apache.kafka:kafka-streams-test-utils:3.2.3=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.apache.kafka:kafka-streams:3.2.3=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.apache.kafka:kafka_2.11:0.11.0.0=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.kafka:kafka_2.13:3.2.3=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.apache.logging.log4j:log4j-api:2.19.0=spotbugs +org.apache.logging.log4j:log4j-core:2.19.0=spotbugs +org.apache.yetus:audience-annotations:0.5.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.apache.zookeeper:zookeeper-jute:3.6.3=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.apache.zookeeper:zookeeper:3.4.10=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.zookeeper:zookeeper:3.6.3=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.apiguardian:apiguardian-api:1.1.2=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.assertj:assertj-core:2.9.1=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.assertj:assertj-core:3.19.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.bitbucket.b_c:jose4j:0.7.9=latestDepTestRuntimeClasspath +org.checkerframework:checker-qual:2.5.2=annotationProcessor,iastLatestDepTest3AnnotationProcessor,latestDepTestAnnotationProcessor,testAnnotationProcessor +org.codehaus.groovy:groovy-all:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-ant:2.5.14=codenarc +org.codehaus.groovy:groovy-ant:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-astbuilder:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-cli-picocli:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-console:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-datetime:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-docgenerator:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-groovydoc:2.5.14=codenarc +org.codehaus.groovy:groovy-groovydoc:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-groovysh:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-jmx:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-json:2.5.14=codenarc +org.codehaus.groovy:groovy-json:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-jsr223:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-macro:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-nio:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-servlet:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-sql:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-swing:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-templates:2.5.14=codenarc +org.codehaus.groovy:groovy-templates:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-test-junit5:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-test:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-testng:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-xml:2.5.14=codenarc +org.codehaus.groovy:groovy-xml:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy:2.5.14=codenarc +org.codehaus.groovy:groovy:3.0.17=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.mojo:animal-sniffer-annotations:1.17=annotationProcessor,iastLatestDepTest3AnnotationProcessor,latestDepTestAnnotationProcessor,testAnnotationProcessor +org.codenarc:CodeNarc:2.2.0=codenarc +org.dom4j:dom4j:2.1.3=spotbugs +org.eclipse.jetty:jetty-http:9.4.56.v20240826=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.eclipse.jetty:jetty-io:9.4.56.v20240826=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.eclipse.jetty:jetty-server:9.4.56.v20240826=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.eclipse.jetty:jetty-util:9.4.56.v20240826=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.gmetrics:GMetrics:1.1=codenarc +org.hamcrest:hamcrest-core:1.3=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hamcrest:hamcrest:2.2=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.jctools:jctools-core:3.3.0=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-api:5.9.2=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-engine:5.9.2=iastLatestDepTest3RuntimeClasspath,latestDepTestRuntimeClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-commons:1.9.2=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-engine:1.9.2=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-launcher:1.9.2=iastLatestDepTest3RuntimeClasspath,latestDepTestRuntimeClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-runner:1.9.2=iastLatestDepTest3RuntimeClasspath,latestDepTestRuntimeClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-suite-api:1.9.2=iastLatestDepTest3RuntimeClasspath,latestDepTestRuntimeClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-suite-commons:1.9.2=iastLatestDepTest3RuntimeClasspath,latestDepTestRuntimeClasspath,testRuntimeClasspath +org.junit:junit-bom:5.9.1=spotbugs +org.junit:junit-bom:5.9.2=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.lz4:lz4-java:1.8.0=iastLatestDepTest3RuntimeClasspath,latestDepTestRuntimeClasspath +org.mockito:mockito-core:2.19.0=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.objenesis:objenesis:3.3=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.opentest4j:opentest4j:1.2.0=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.ow2.asm:asm-analysis:9.2=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +org.ow2.asm:asm-analysis:9.4=spotbugs +org.ow2.asm:asm-commons:9.2=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +org.ow2.asm:asm-commons:9.4=spotbugs +org.ow2.asm:asm-tree:9.2=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +org.ow2.asm:asm-tree:9.4=spotbugs +org.ow2.asm:asm-util:9.2=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +org.ow2.asm:asm-util:9.4=spotbugs +org.ow2.asm:asm:9.2=iastLatestDepTest3RuntimeClasspath,instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +org.ow2.asm:asm:9.4=spotbugs +org.rocksdb:rocksdbjni:6.29.4.1=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.scala-lang.modules:scala-collection-compat_2.13:2.6.0=latestDepTestRuntimeClasspath +org.scala-lang.modules:scala-java8-compat_2.13:1.0.2=latestDepTestRuntimeClasspath +org.scala-lang.modules:scala-parser-combinators_2.11:1.0.4=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.scala-lang:scala-library:2.11.11=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.scala-lang:scala-library:2.13.8=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.scala-lang:scala-reflect:2.13.8=latestDepTestRuntimeClasspath +org.slf4j:jcl-over-slf4j:1.7.30=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.slf4j:jul-to-slf4j:1.7.30=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.slf4j:log4j-over-slf4j:1.7.30=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.slf4j:slf4j-api:1.7.30=compileClasspath,iastLatestDepTest3CompileClasspath,instrumentPluginClasspath,latestDepTestCompileClasspath,muzzleBootstrap,muzzleTooling,runtimeClasspath,testCompileClasspath +org.slf4j:slf4j-api:1.7.32=testRuntimeClasspath +org.slf4j:slf4j-api:1.7.36=iastLatestDepTest3RuntimeClasspath,latestDepTestRuntimeClasspath +org.slf4j:slf4j-api:2.0.0=spotbugs,spotbugsSlf4j +org.slf4j:slf4j-simple:2.0.0=spotbugsSlf4j +org.spockframework:spock-core:2.2-groovy-3.0=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.spockframework:spock-junit4:2.2-groovy-3.0=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.kafka:spring-kafka-test:1.3.3.RELEASE=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.kafka:spring-kafka-test:2.9.13=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.springframework.kafka:spring-kafka:1.3.3.RELEASE=testCompileClasspath,testRuntimeClasspath +org.springframework.kafka:spring-kafka:2.9.13=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.springframework.kafka:spring-kafka:3.2.4=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath +org.springframework.retry:spring-retry:1.2.2.RELEASE=testCompileClasspath,testRuntimeClasspath +org.springframework.retry:spring-retry:1.3.4=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.springframework.retry:spring-retry:2.0.9=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath +org.springframework:spring-aop:4.3.14.RELEASE=testCompileClasspath,testRuntimeClasspath +org.springframework:spring-aop:5.3.29=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.springframework:spring-aop:6.1.13=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath +org.springframework:spring-beans:4.3.14.RELEASE=testCompileClasspath,testRuntimeClasspath +org.springframework:spring-beans:5.3.29=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.springframework:spring-beans:6.1.13=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath +org.springframework:spring-context:4.3.14.RELEASE=testCompileClasspath,testRuntimeClasspath +org.springframework:spring-context:5.3.29=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.springframework:spring-context:6.1.13=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath +org.springframework:spring-core:4.3.14.RELEASE=testCompileClasspath,testRuntimeClasspath +org.springframework:spring-core:5.3.29=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.springframework:spring-core:6.1.13=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath +org.springframework:spring-expression:4.3.14.RELEASE=testCompileClasspath,testRuntimeClasspath +org.springframework:spring-expression:5.3.29=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.springframework:spring-expression:6.1.13=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath +org.springframework:spring-jcl:5.3.29=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.springframework:spring-jcl:6.1.13=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath +org.springframework:spring-messaging:4.3.14.RELEASE=testCompileClasspath,testRuntimeClasspath +org.springframework:spring-messaging:5.3.29=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.springframework:spring-messaging:6.1.13=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath +org.springframework:spring-test:4.3.14.RELEASE=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-test:5.3.29=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.springframework:spring-tx:4.3.14.RELEASE=testCompileClasspath,testRuntimeClasspath +org.springframework:spring-tx:5.3.29=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.springframework:spring-tx:6.1.13=iastLatestDepTest3CompileClasspath,iastLatestDepTest3RuntimeClasspath +org.testng:testng:7.5=iastLatestDepTest3RuntimeClasspath,latestDepTestRuntimeClasspath,testRuntimeClasspath +org.webjars:jquery:3.5.1=iastLatestDepTest3RuntimeClasspath,latestDepTestRuntimeClasspath,testRuntimeClasspath +org.xerial.snappy:snappy-java:1.1.10.5=iastLatestDepTest3RuntimeClasspath +org.xerial.snappy:snappy-java:1.1.2.6=compileClasspath,testCompileClasspath,testRuntimeClasspath +org.xerial.snappy:snappy-java:1.1.8.4=latestDepTestRuntimeClasspath +org.xmlresolver:xmlresolver:4.4.3=spotbugs +xml-apis:xml-apis:1.4.01=spotbugs +empty=spotbugsPlugins diff --git a/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/ConnectWorkerInstrumentation.java b/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/ConnectWorkerInstrumentation.java new file mode 100644 index 00000000000..70549a3c25b --- /dev/null +++ b/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/ConnectWorkerInstrumentation.java @@ -0,0 +1,61 @@ +package datadog.trace.instrumentation.kafka_connect; + +import static datadog.trace.agent.tooling.bytebuddy.matcher.HierarchyMatchers.extendsClass; +import static datadog.trace.agent.tooling.bytebuddy.matcher.NameMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.*; + +import com.google.auto.service.AutoService; +import datadog.trace.agent.tooling.Instrumenter; +import datadog.trace.agent.tooling.InstrumenterModule; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.kafka.connect.runtime.TaskStatus.Listener; +import org.apache.kafka.connect.util.ConnectorTaskId; + +@AutoService(InstrumenterModule.class) +public final class ConnectWorkerInstrumentation extends InstrumenterModule.Tracing + implements Instrumenter.ForTypeHierarchy { + + static final String TARGET_TYPE = "org.apache.kafka.connect.runtime.WorkerTask"; + + public ConnectWorkerInstrumentation() { + super("kafka", "kafka-connect"); + } + + @Override + public String[] helperClassNames() { + return new String[] { + packageName + ".TaskListener", + }; + } + + @Override + public String hierarchyMarkerType() { + return TARGET_TYPE; + } + + @Override + public ElementMatcher hierarchyMatcher() { + return extendsClass(named(hierarchyMarkerType())); + } + + @Override + public void methodAdvice(MethodTransformer transformer) { + transformer.applyAdvice( + isConstructor() + .and(takesArgument(0, named("org.apache.kafka.connect.util.ConnectorTaskId"))) + .and(takesArgument(1, named("org.apache.kafka.connect.runtime.TaskStatus$Listener"))), + ConnectWorkerInstrumentation.class.getName() + "$ConstructorAdvice"); + } + + public static class ConstructorAdvice { + + @Advice.OnMethodEnter(suppress = Throwable.class) + public static void wrap( + @Advice.Argument(value = 0, readOnly = true) ConnectorTaskId id, + @Advice.Argument(value = 1, readOnly = false) Listener statusListener) { + statusListener = new TaskListener(statusListener); + } + } +} diff --git a/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/TaskListener.java b/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/TaskListener.java new file mode 100644 index 00000000000..f902ee9c373 --- /dev/null +++ b/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/TaskListener.java @@ -0,0 +1,43 @@ +package datadog.trace.instrumentation.kafka_connect; + +import datadog.trace.bootstrap.instrumentation.api.AgentTracer; +import org.apache.kafka.connect.runtime.TaskStatus.Listener; +import org.apache.kafka.connect.util.ConnectorTaskId; + +public class TaskListener implements Listener { + private final Listener delegate; + + public TaskListener(Listener delegate) { + this.delegate = delegate; + } + + @Override + public void onStartup(ConnectorTaskId connectorTaskId) { + AgentTracer.get().getDataStreamsMonitoring().setThreadServiceName(connectorTaskId.connector()); + delegate.onStartup(connectorTaskId); + } + + @Override + public void onPause(ConnectorTaskId connectorTaskId) { + delegate.onPause(connectorTaskId); + AgentTracer.get().getDataStreamsMonitoring().clearThreadServiceName(); + } + + @Override + public void onResume(ConnectorTaskId connectorTaskId) { + delegate.onResume(connectorTaskId); + AgentTracer.get().getDataStreamsMonitoring().setThreadServiceName(connectorTaskId.connector()); + } + + @Override + public void onFailure(ConnectorTaskId connectorTaskId, Throwable throwable) { + delegate.onFailure(connectorTaskId, throwable); + AgentTracer.get().getDataStreamsMonitoring().clearThreadServiceName(); + } + + @Override + public void onShutdown(ConnectorTaskId connectorTaskId) { + delegate.onShutdown(connectorTaskId); + AgentTracer.get().getDataStreamsMonitoring().clearThreadServiceName(); + } +} diff --git a/dd-java-agent/instrumentation/kafka-connect-0.11/src/test/groovy/ConnectWorkerInstrumentationTest.groovy b/dd-java-agent/instrumentation/kafka-connect-0.11/src/test/groovy/ConnectWorkerInstrumentationTest.groovy new file mode 100644 index 00000000000..5aa97b3ed5f --- /dev/null +++ b/dd-java-agent/instrumentation/kafka-connect-0.11/src/test/groovy/ConnectWorkerInstrumentationTest.groovy @@ -0,0 +1,182 @@ +import datadog.trace.agent.test.AgentTestRunner +import datadog.trace.core.datastreams.StatsGroup +import org.apache.kafka.clients.admin.AdminClient +import org.apache.kafka.clients.admin.AdminClientConfig +import org.apache.kafka.clients.admin.DescribeClusterResult +import org.apache.kafka.clients.consumer.ConsumerConfig +import org.apache.kafka.clients.consumer.ConsumerRecords +import org.apache.kafka.clients.consumer.KafkaConsumer +import org.apache.kafka.common.utils.Time +import org.apache.kafka.connect.connector.policy.AllConnectorClientConfigOverridePolicy +import org.apache.kafka.connect.connector.policy.ConnectorClientConfigOverridePolicy +import org.apache.kafka.connect.runtime.Herder +import org.apache.kafka.connect.runtime.rest.entities.ConnectorInfo +import org.apache.kafka.connect.runtime.standalone.StandaloneConfig +import org.apache.kafka.connect.runtime.standalone.StandaloneHerder +import org.apache.kafka.connect.runtime.Worker +import org.apache.kafka.connect.runtime.WorkerConfig +import org.apache.kafka.connect.runtime.isolation.Plugins +import org.apache.kafka.connect.storage.FileOffsetBackingStore +import org.apache.kafka.connect.util.Callback +import org.springframework.kafka.test.EmbeddedKafkaBroker +import spock.lang.Shared + +import java.time.Duration +import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit + +class ConnectWorkerInstrumentationTest extends AgentTestRunner { + @Shared + EmbeddedKafkaBroker embeddedKafka = new EmbeddedKafkaBroker(1, false, 1, 'test-topic') + + def setupSpec() { + embeddedKafka.afterPropertiesSet() // Initializes the broker + } + + def cleanupSpec() { + embeddedKafka.destroy() + } + + @Override + void configurePreAgent() { + super.configurePreAgent() + } + + def "test kafka-connect instrumentation"() { + // Kafka bootstrap servers from the embedded broker + String bootstrapServers = embeddedKafka.getBrokersAsString() + + // Retrieve Kafka cluster ID + // Create an AdminClient to interact with the Kafka cluster + Properties adminProps = new Properties() + adminProps.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers) + String clusterId = null + try (AdminClient adminClient = AdminClient.create(adminProps)) { + DescribeClusterResult describeClusterResult = adminClient.describeCluster() + clusterId = describeClusterResult.clusterId().get() // Retrieve the cluster ID + } + assert clusterId != null : "Cluster ID is null" + + // Create a temporary file with a test message + File tempFile = File.createTempFile("test-message", ".txt") + + // Worker properties + Properties workerProps = new Properties() + workerProps.put(WorkerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers) + workerProps.put(WorkerConfig.KEY_CONVERTER_CLASS_CONFIG, "org.apache.kafka.connect.storage.StringConverter") + workerProps.put(WorkerConfig.VALUE_CONVERTER_CLASS_CONFIG, "org.apache.kafka.connect.storage.StringConverter") + workerProps.put(StandaloneConfig.OFFSET_STORAGE_FILE_FILENAME_CONFIG, "/tmp/connect.offsets") + workerProps.put(WorkerConfig.INTERNAL_KEY_CONVERTER_CLASS_CONFIG, "org.apache.kafka.connect.json.JsonConverter") + workerProps.put(WorkerConfig.INTERNAL_VALUE_CONVERTER_CLASS_CONFIG, "org.apache.kafka.connect.json.JsonConverter") + workerProps.put(WorkerConfig.PLUGIN_PATH_CONFIG, "") // Required but can be empty for built-in connectors + workerProps.put("plugin.scan.classpath", "true") + + Map workerPropsMap = workerProps.stringPropertyNames() + .collectEntries { [(it): workerProps.getProperty(it)] } + + // Create the Connect worker + Time time = Time.SYSTEM + Plugins plugins = new Plugins(workerPropsMap) + plugins.compareAndSwapWithDelegatingLoader() + String workerId = "worker-1" + + FileOffsetBackingStore offsetBackingStore = new FileOffsetBackingStore() + WorkerConfig workerConfig = new StandaloneConfig(workerPropsMap) + offsetBackingStore.configure(workerConfig) + ConnectorClientConfigOverridePolicy connectorClientConfigOverridePolicy = new AllConnectorClientConfigOverridePolicy() + Worker worker = new Worker(workerId, time, plugins, workerConfig, offsetBackingStore, connectorClientConfigOverridePolicy) + Herder herder = new StandaloneHerder(worker, clusterId, connectorClientConfigOverridePolicy) + + // Start worker and herder + worker.start() + herder.start() + + // Connector configuration + Map connectorProps = [ + 'name' : 'file-source-connector', + 'connector.class': 'org.apache.kafka.connect.file.FileStreamSourceConnector', + 'tasks.max' : '1', + 'file' : tempFile.getAbsolutePath(), + 'topic' : 'test-topic' + ] + + // Latch to wait for connector addition + CountDownLatch connectorAddedLatch = new CountDownLatch(1) + Callback> addConnectorCallback = new Callback>() { + @Override + void onCompletion(Throwable error, Herder.Created result) { + if (error != null) { + error.printStackTrace() + } else { + println "Connector added successfully." + } + connectorAddedLatch.countDown() + } + } + + when: + // Add the connector to the herder + herder.putConnectorConfig("file-source-connector", connectorProps, false, addConnectorCallback) + + // Wait for the connector to be added + boolean connectorAdded = connectorAddedLatch.await(10, TimeUnit.SECONDS) + assert connectorAdded : "Connector was not added in time" + + tempFile.write("Hello Kafka\n") + + // Consume the message from Kafka + Properties consumerProps = new Properties() + consumerProps.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers) + consumerProps.put(ConsumerConfig.GROUP_ID_CONFIG, "test-consumer-group") + consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest") + consumerProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringDeserializer") + consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringDeserializer") + + KafkaConsumer consumer = new KafkaConsumer<>(consumerProps) + consumer.subscribe(['test-topic']) + + String receivedMessage = null + for (int i = 0; i < 10; i++) { // Try for up to 10 seconds + ConsumerRecords records = consumer.poll(Duration.ofSeconds(1)) + if (!records.isEmpty()) { + receivedMessage = records.iterator().next().value() + break + } + } + TEST_DATA_STREAMS_WRITER.waitForGroups(2) + + then: + receivedMessage == "Hello Kafka" + + StatsGroup first = TEST_DATA_STREAMS_WRITER.groups.find { it.parentHash == 0 } + verifyAll(first) { + edgeTags == ["direction:out", "kafka_cluster_id:$clusterId", "topic:test-topic", "type:kafka"] + edgeTags.size() == 4 + } + + StatsGroup second = TEST_DATA_STREAMS_WRITER.groups.find { it.parentHash == first.hash } + verifyAll(second) { + edgeTags == [ + "direction:in", + "group:test-consumer-group", + "kafka_cluster_id:$clusterId", + "topic:test-topic", + "type:kafka" + ] + edgeTags.size() == 5 + } + TEST_DATA_STREAMS_WRITER.getServices().contains('file-source-connector') + + + cleanup: + consumer?.close() + herder?.stop() + worker?.stop() + tempFile?.delete() + } + + @Override + protected boolean isDataStreamsEnabled() { + return true + } +} diff --git a/settings.gradle b/settings.gradle index ba347d220fe..ecdc4c42dce 100644 --- a/settings.gradle +++ b/settings.gradle @@ -349,6 +349,7 @@ include ':dd-java-agent:instrumentation:kafka-clients-0.11' include 'dd-java-agent:instrumentation:kafka-clients-3.8' include ':dd-java-agent:instrumentation:kafka-streams-0.11' include ':dd-java-agent:instrumentation:kafka-streams-1.0' +include ':dd-java-agent:instrumentation:kafka-connect-0.11' include ':dd-java-agent:instrumentation:karate' include ':dd-java-agent:instrumentation:kotlin-coroutines' include ':dd-java-agent:instrumentation:kotlin-coroutines:coroutines-1.3' From d0432752f132b7a79cf82a91afeec4d988542d5e Mon Sep 17 00:00:00 2001 From: Piotr Wolski Date: Tue, 10 Dec 2024 18:32:29 -0700 Subject: [PATCH 2/5] muzzle instrumentation before 0.11 --- .../kafka_connect/ConnectWorkerInstrumentation.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/ConnectWorkerInstrumentation.java b/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/ConnectWorkerInstrumentation.java index 70549a3c25b..e4ae35bfed4 100644 --- a/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/ConnectWorkerInstrumentation.java +++ b/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/ConnectWorkerInstrumentation.java @@ -10,6 +10,7 @@ import net.bytebuddy.asm.Advice; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.matcher.ElementMatcher; +import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.connect.runtime.TaskStatus.Listener; import org.apache.kafka.connect.util.ConnectorTaskId; @@ -57,5 +58,11 @@ public static void wrap( @Advice.Argument(value = 1, readOnly = false) Listener statusListener) { statusListener = new TaskListener(statusListener); } + + public static void muzzleCheck(ConsumerRecord record) { + // KafkaConsumerInstrumentation only applies for kafka versions with headers + // Make an explicit call so ConsumerCoordinatorInstrumentation does the same + record.headers(); + } } } From 65c39256cb1b74d3d1e6e006e30f05c39404e0a2 Mon Sep 17 00:00:00 2001 From: Piotr Wolski Date: Wed, 11 Dec 2024 09:10:06 -0700 Subject: [PATCH 3/5] update service name in right order --- .../trace/instrumentation/kafka_connect/TaskListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/TaskListener.java b/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/TaskListener.java index f902ee9c373..871bc326693 100644 --- a/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/TaskListener.java +++ b/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/TaskListener.java @@ -25,8 +25,8 @@ public void onPause(ConnectorTaskId connectorTaskId) { @Override public void onResume(ConnectorTaskId connectorTaskId) { - delegate.onResume(connectorTaskId); AgentTracer.get().getDataStreamsMonitoring().setThreadServiceName(connectorTaskId.connector()); + delegate.onResume(connectorTaskId); } @Override From 63200d69d0ded7886c96e025f9fbc656fe53b936 Mon Sep 17 00:00:00 2001 From: Piotr Wolski Date: Wed, 11 Dec 2024 09:23:27 -0700 Subject: [PATCH 4/5] sort gradle includes --- settings.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/settings.gradle b/settings.gradle index ecdc4c42dce..41c55a18d48 100644 --- a/settings.gradle +++ b/settings.gradle @@ -344,12 +344,12 @@ include ':dd-java-agent:instrumentation:junit-5.3' include ':dd-java-agent:instrumentation:junit-5.3:junit-5.8' include ':dd-java-agent:instrumentation:junit-5.3:cucumber-junit-5' include ':dd-java-agent:instrumentation:junit-5.3:spock-junit-5' -include ':dd-java-agent:instrumentation:kafka-common' include ':dd-java-agent:instrumentation:kafka-clients-0.11' -include 'dd-java-agent:instrumentation:kafka-clients-3.8' +include ':dd-java-agent:instrumentation:kafka-clients-3.8' +include ':dd-java-agent:instrumentation:kafka-common' +include ':dd-java-agent:instrumentation:kafka-connect-0.11' include ':dd-java-agent:instrumentation:kafka-streams-0.11' include ':dd-java-agent:instrumentation:kafka-streams-1.0' -include ':dd-java-agent:instrumentation:kafka-connect-0.11' include ':dd-java-agent:instrumentation:karate' include ':dd-java-agent:instrumentation:kotlin-coroutines' include ':dd-java-agent:instrumentation:kotlin-coroutines:coroutines-1.3' From 67e1e7bce6f19edff373a68c200f5306ffd60752 Mon Sep 17 00:00:00 2001 From: Piotr Wolski Date: Wed, 11 Dec 2024 10:15:02 -0700 Subject: [PATCH 5/5] Put delegate calls in try / finally --- .../kafka-connect-0.11/build.gradle | 3 +++ .../kafka_connect/TaskListener.java | 21 +++++++++++++------ .../ConnectWorkerInstrumentationTest.groovy | 13 ++++++------ 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/dd-java-agent/instrumentation/kafka-connect-0.11/build.gradle b/dd-java-agent/instrumentation/kafka-connect-0.11/build.gradle index 117bff84bfb..d5717e78304 100644 --- a/dd-java-agent/instrumentation/kafka-connect-0.11/build.gradle +++ b/dd-java-agent/instrumentation/kafka-connect-0.11/build.gradle @@ -29,6 +29,9 @@ dependencies { // Spring Kafka Test library testImplementation 'org.springframework.kafka:spring-kafka-test:2.7.9' // Version compatible with Kafka 2.7.x testRuntimeOnly project(':dd-java-agent:instrumentation:kafka-clients-0.11') + testRuntimeOnly project(':dd-java-agent:instrumentation:kafka-clients-3.8') + testRuntimeOnly project(':dd-java-agent:instrumentation:kafka-streams-0.11') + testRuntimeOnly project(':dd-java-agent:instrumentation:kafka-streams-1.0') } configurations.testRuntimeClasspath { diff --git a/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/TaskListener.java b/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/TaskListener.java index 871bc326693..c30ab4062e1 100644 --- a/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/TaskListener.java +++ b/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/TaskListener.java @@ -19,8 +19,11 @@ public void onStartup(ConnectorTaskId connectorTaskId) { @Override public void onPause(ConnectorTaskId connectorTaskId) { - delegate.onPause(connectorTaskId); - AgentTracer.get().getDataStreamsMonitoring().clearThreadServiceName(); + try { + delegate.onPause(connectorTaskId); + } finally { + AgentTracer.get().getDataStreamsMonitoring().clearThreadServiceName(); + } } @Override @@ -31,13 +34,19 @@ public void onResume(ConnectorTaskId connectorTaskId) { @Override public void onFailure(ConnectorTaskId connectorTaskId, Throwable throwable) { - delegate.onFailure(connectorTaskId, throwable); - AgentTracer.get().getDataStreamsMonitoring().clearThreadServiceName(); + try { + delegate.onFailure(connectorTaskId, throwable); + } finally { + AgentTracer.get().getDataStreamsMonitoring().clearThreadServiceName(); + } } @Override public void onShutdown(ConnectorTaskId connectorTaskId) { - delegate.onShutdown(connectorTaskId); - AgentTracer.get().getDataStreamsMonitoring().clearThreadServiceName(); + try { + delegate.onShutdown(connectorTaskId); + } finally { + AgentTracer.get().getDataStreamsMonitoring().clearThreadServiceName(); + } } } diff --git a/dd-java-agent/instrumentation/kafka-connect-0.11/src/test/groovy/ConnectWorkerInstrumentationTest.groovy b/dd-java-agent/instrumentation/kafka-connect-0.11/src/test/groovy/ConnectWorkerInstrumentationTest.groovy index 5aa97b3ed5f..48c69d7d115 100644 --- a/dd-java-agent/instrumentation/kafka-connect-0.11/src/test/groovy/ConnectWorkerInstrumentationTest.groovy +++ b/dd-java-agent/instrumentation/kafka-connect-0.11/src/test/groovy/ConnectWorkerInstrumentationTest.groovy @@ -150,20 +150,21 @@ class ConnectWorkerInstrumentationTest extends AgentTestRunner { StatsGroup first = TEST_DATA_STREAMS_WRITER.groups.find { it.parentHash == 0 } verifyAll(first) { - edgeTags == ["direction:out", "kafka_cluster_id:$clusterId", "topic:test-topic", "type:kafka"] - edgeTags.size() == 4 + assert [ + "direction:out", + "topic:test-topic", + "type:kafka" + ].every( tag -> edgeTags.contains(tag) ) } StatsGroup second = TEST_DATA_STREAMS_WRITER.groups.find { it.parentHash == first.hash } verifyAll(second) { - edgeTags == [ + assert [ "direction:in", "group:test-consumer-group", - "kafka_cluster_id:$clusterId", "topic:test-topic", "type:kafka" - ] - edgeTags.size() == 5 + ].every( tag -> edgeTags.contains(tag) ) } TEST_DATA_STREAMS_WRITER.getServices().contains('file-source-connector')