From ff9bbf2b31269f073c24b045fb3635b7540b9287 Mon Sep 17 00:00:00 2001 From: Piotr Wolski Date: Mon, 18 Nov 2024 14:53:03 -0700 Subject: [PATCH] Add support for Kafka connect --- .../kafka-connect-0.11/build.gradle | 36 ++ .../kafka-connect-0.11/gradle.lockfile | 258 ++++++++++++ .../ConnectWorkerInstrumentation.java | 66 +++ .../kafka_connect/TaskListener.java | 57 +++ .../ConnectWorkerInstrumentationTest.groovy | 385 ++++++++++++++++++ .../src/test/groovy/TestSourceConnector.java | 103 +++++ settings.gradle | 1 + 7 files changed, 906 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 create mode 100644 dd-java-agent/instrumentation/kafka-connect-0.11/src/test/groovy/TestSourceConnector.java 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..f261ae370f7 --- /dev/null +++ b/dd-java-agent/instrumentation/kafka-connect-0.11/build.gradle @@ -0,0 +1,36 @@ +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 group: 'org.apache.kafka', name: 'connect-runtime', version: '0.11.0.0' + testImplementation group: 'org.springframework.kafka', name: 'spring-kafka', version: '1.3.3.RELEASE' + testImplementation group: 'org.springframework.kafka', name: 'spring-kafka-test', version: '1.3.3.RELEASE' + testImplementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.3' + testImplementation group: 'org.assertj', name: 'assertj-core', version: '2.9.+' + testImplementation group: 'org.mockito', name: 'mockito-core', version: '2.19.0' + testRuntimeOnly project(':dd-java-agent:instrumentation:spring-scheduling-3.1') + 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') +} + +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..96330415988 --- /dev/null +++ b/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/ConnectWorkerInstrumentation.java @@ -0,0 +1,66 @@ +package datadog.trace.instrumentation.kafka_connect; + +import com.google.auto.service.AutoService; +import datadog.trace.agent.tooling.Instrumenter; +import datadog.trace.agent.tooling.InstrumenterModule; +import datadog.trace.bootstrap.instrumentation.api.AgentTracer; +import net.bytebuddy.asm.Advice; +import net.bytebuddy.description.type.TypeDescription; +import net.bytebuddy.matcher.ElementMatcher; +import net.bytebuddy.matcher.ElementMatchers; +import org.apache.kafka.connect.util.ConnectorTaskId; +import org.apache.kafka.connect.runtime.TaskStatus.Listener; + +import java.util.Arrays; + +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.*; + +@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); + System.out.println("building worker task!!" + id.connector()); + } + } +} 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..e6603e1d867 --- /dev/null +++ b/dd-java-agent/instrumentation/kafka-connect-0.11/src/main/java/datadog/trace/instrumentation/kafka_connect/TaskListener.java @@ -0,0 +1,57 @@ +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{ + final private Listener delegate; + public TaskListener(Listener delegate) { + this.delegate = delegate; + + } + @Override + public void onStartup(ConnectorTaskId connectorTaskId) { + System.out.println("start up" + connectorTaskId.connector() + " on thread " + Thread.currentThread().getId()); + AgentTracer.get() + .getDataStreamsMonitoring() + .setThreadServiceName(Thread.currentThread().getId(), connectorTaskId.connector()); + delegate.onStartup(connectorTaskId); + } + + @Override + public void onPause(ConnectorTaskId connectorTaskId) { + System.out.println("pause" + connectorTaskId.connector()); + delegate.onPause(connectorTaskId); + AgentTracer.get() + .getDataStreamsMonitoring() + .clearThreadServiceName(Thread.currentThread().getId()); + } + + @Override + public void onResume(ConnectorTaskId connectorTaskId) { + System.out.println("resume" + connectorTaskId.connector()); + delegate.onResume(connectorTaskId); + AgentTracer.get() + .getDataStreamsMonitoring() + .setThreadServiceName(Thread.currentThread().getId(), connectorTaskId.connector()); + } + + @Override + public void onFailure(ConnectorTaskId connectorTaskId, Throwable throwable) { + System.out.println("failure" + connectorTaskId.connector()); + delegate.onFailure(connectorTaskId, throwable); + AgentTracer.get() + .getDataStreamsMonitoring() + .clearThreadServiceName(Thread.currentThread().getId()); + } + + @Override + public void onShutdown(ConnectorTaskId connectorTaskId) { + System.out.println("shutdown" + connectorTaskId.connector()); + delegate.onShutdown(connectorTaskId); + AgentTracer.get() + .getDataStreamsMonitoring() + .clearThreadServiceName(Thread.currentThread().getId()); + } +} 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..209da82606f --- /dev/null +++ b/dd-java-agent/instrumentation/kafka-connect-0.11/src/test/groovy/ConnectWorkerInstrumentationTest.groovy @@ -0,0 +1,385 @@ +import datadog.trace.agent.test.AgentTestRunner +import datadog.trace.common.writer.ListWriter + +import static datadog.trace.agent.test.utils.TraceUtils.basicSpan +import static datadog.trace.agent.test.utils.TraceUtils.runUnderTrace +import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeScope +import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan + +import datadog.trace.agent.test.asserts.TraceAssert +import datadog.trace.agent.test.naming.VersionedNamingTestBase +import datadog.trace.api.Config +import datadog.trace.api.DDTags +import datadog.trace.bootstrap.instrumentation.api.InstrumentationTags +import datadog.trace.bootstrap.instrumentation.api.Tags +import datadog.trace.core.DDSpan +import datadog.trace.core.datastreams.StatsGroup +import datadog.trace.test.util.Flaky +import org.apache.kafka.clients.consumer.ConsumerConfig +import org.apache.kafka.clients.consumer.ConsumerRecord +import org.apache.kafka.clients.consumer.KafkaConsumer +import org.apache.kafka.clients.producer.KafkaProducer +import org.apache.kafka.clients.producer.Producer +import org.apache.kafka.clients.producer.ProducerConfig +import org.apache.kafka.clients.producer.ProducerRecord +import org.apache.kafka.clients.producer.RecordMetadata +import org.apache.kafka.common.TopicPartition +import org.apache.kafka.common.serialization.StringSerializer +import org.junit.Rule +import org.springframework.kafka.core.DefaultKafkaConsumerFactory +import org.springframework.kafka.core.DefaultKafkaProducerFactory +import org.springframework.kafka.core.KafkaTemplate +import org.springframework.kafka.listener.BatchMessageListener +import org.springframework.kafka.listener.KafkaMessageListenerContainer +import org.springframework.kafka.listener.MessageListener +import org.springframework.kafka.test.rule.KafkaEmbedded +import org.springframework.kafka.test.utils.ContainerTestUtils +import org.springframework.kafka.test.utils.KafkaTestUtils + +import java.util.concurrent.ExecutionException +import java.util.concurrent.Future +import java.util.concurrent.LinkedBlockingQueue +import java.util.concurrent.TimeUnit + +class ConnectWorkerInstrumentationTest extends AgentTestRunner { + static final SHARED_TOPIC = "shared.topic" + + @Rule + KafkaEmbedded embeddedKafka = new KafkaEmbedded(1, true, SHARED_TOPIC) + + @Override + void configurePreAgent() { + super.configurePreAgent() + } + + public static final LinkedHashMap PRODUCER_PATHWAY_EDGE_TAGS + + // filter out Kafka poll, since the function is called in a loop, giving inconsistent results + final ListWriter.Filter dropKafkaPoll = new ListWriter.Filter() { + @Override + boolean accept(List trace) { + return !(trace.size() == 1 && + trace.get(0).getResourceName().toString().equals("kafka.poll")) + } + } + + final ListWriter.Filter dropEmptyKafkaPoll = new ListWriter.Filter() { + @Override + boolean accept(List trace) { + return !(trace.size() == 1 && + trace.get(0).getResourceName().toString().equals("kafka.poll") && + trace.get(0).getTag(InstrumentationTags.KAFKA_RECORDS_COUNT).equals(0)) + } + } + + // TraceID, start times & names changed based on the configuration, so overriding the sort to give consistent test results + private static class SortKafkaTraces implements Comparator> { + @Override + int compare(List o1, List o2) { + return rootSpanTrace(o1) - rootSpanTrace(o2) + } + + int rootSpanTrace(List trace) { + assert !trace.isEmpty() + def rootSpan = trace.get(0).localRootSpan + switch (rootSpan.operationName.toString()) { + case "parent": + return 3 + case "kafka.poll": + return 2 + default: + return 1 + } + } + } + + + static { + PRODUCER_PATHWAY_EDGE_TAGS = new LinkedHashMap<>(3) + PRODUCER_PATHWAY_EDGE_TAGS.put("direction", "out") + PRODUCER_PATHWAY_EDGE_TAGS.put("topic", SHARED_TOPIC) + PRODUCER_PATHWAY_EDGE_TAGS.put("type", "kafka") + } + + def setup() { + TEST_WRITER.setFilter(dropKafkaPoll) + } + + def "test kafka produce and consume"() { + setup: + def senderProps = KafkaTestUtils.senderProps(embeddedKafka.getBrokersAsString()) + senderProps.put(ProducerConfig.METADATA_MAX_AGE_CONFIG, 1000) + TEST_WRITER.setFilter(dropEmptyKafkaPoll) + KafkaProducer producer = new KafkaProducer<>(senderProps, new StringSerializer(), new StringSerializer()) + String clusterId = "" + producer.flush() + clusterId = producer.metadata.cluster.clusterResource().clusterId() + while (clusterId == null || clusterId.isEmpty()) { + Thread.sleep(1500) + clusterId = producer.metadata.cluster.clusterResource().clusterId() + } + + // set up the Kafka consumer properties + def consumerProperties = KafkaTestUtils.consumerProps("sender", "false", embeddedKafka) + + // create a Kafka consumer factory + def consumerFactory = new DefaultKafkaConsumerFactory(consumerProperties) + + // set the topic that needs to be consumed + def containerProperties = containerProperties() + + // create a Kafka MessageListenerContainer + def container = new KafkaMessageListenerContainer<>(consumerFactory, containerProperties) + + // create a thread safe queue to store the received message + def records = new LinkedBlockingQueue>() + + // setup a Kafka message listener + container.setupMessageListener(new MessageListener() { + @Override + void onMessage(ConsumerRecord record) { + TEST_WRITER.waitForTraces(1) // ensure consistent ordering of traces + records.add(record) + } + }) + + // start the container and underlying message listener + container.start() + + // wait until the container has the required number of assigned partitions + ContainerTestUtils.waitForAssignment(container, embeddedKafka.getPartitionsPerTopic()) + + when: + String greeting = "Hello Spring Kafka Sender!" + runUnderTrace("parent") { + producer.send(new ProducerRecord(SHARED_TOPIC, greeting)) { meta, ex -> + assert activeScope().isAsyncPropagating() + if (ex == null) { + runUnderTrace("producer callback") {} + } else { + runUnderTrace("producer exception: " + ex) {} + } + } + blockUntilChildSpansFinished(2) + } + TEST_DATA_STREAMS_WRITER.waitForGroups(2) + // wait for produce offset 0, commit offset 0 on partition 0 and 1, and commit offset 1 on 1 partition. + TEST_DATA_STREAMS_WRITER.waitForBacklogs(4) + + then: + // check that the message was received + def received = records.poll(5, TimeUnit.SECONDS) + received.value() == greeting + received.key() == null + + int nTraces = isDataStreamsEnabled() ? 3 : 2 + int produceTraceIdx = nTraces - 1 + TEST_WRITER.waitForTraces(nTraces) + def traces = (Arrays.asList(TEST_WRITER.toArray()) as List>) + Collections.sort(traces, new SortKafkaTraces()) + assertTraces(nTraces, new SortKafkaTraces()) { + trace(1) { + consumerSpan(it, consumerProperties, trace(produceTraceIdx)[2]) + } + trace(1, { + pollSpan(it) + }) + trace(3) { + basicSpan(it, "parent") + basicSpan(it, "producer callback", span(0)) + producerSpan(it, senderProps, span(0), false) + } + } + def headers = received.headers() + headers.iterator().hasNext() + new String(headers.headers("x-datadog-trace-id").iterator().next().value()) == "${traces[produceTraceIdx][2].traceId}" + new String(headers.headers("x-datadog-parent-id").iterator().next().value()) == "${traces[produceTraceIdx][2].spanId}" + + if (isDataStreamsEnabled()) { + StatsGroup first = TEST_DATA_STREAMS_WRITER.groups.find { it.parentHash == 0 } + verifyAll(first) { + edgeTags == ["direction:out", "kafka_cluster_id:$clusterId", "topic:$SHARED_TOPIC".toString(), "type:kafka"] + edgeTags.size() == 4 + } + + StatsGroup second = TEST_DATA_STREAMS_WRITER.groups.find { it.parentHash == first.hash } + verifyAll(second) { + edgeTags == [ + "direction:in", + "group:sender", + "kafka_cluster_id:$clusterId", + "topic:$SHARED_TOPIC".toString(), + "type:kafka" + ] + edgeTags.size() == 5 + } + List produce = [ + "kafka_cluster_id:$clusterId", + "partition:"+received.partition(), + "topic:"+SHARED_TOPIC, + "type:kafka_produce" + ] + List commit = [ + "consumer_group:sender", + "kafka_cluster_id:$clusterId", + "partition:"+received.partition(), + "topic:"+SHARED_TOPIC, + "type:kafka_commit" + ] + verifyAll(TEST_DATA_STREAMS_WRITER.backlogs) { + contains(new AbstractMap.SimpleEntry, Long>(commit, 1).toString()) + contains(new AbstractMap.SimpleEntry, Long>(produce, 0).toString()) + } + } + + cleanup: + producer.close() + container?.stop() + } + + def containerProperties() { + try { + // Different class names for test and latestDepTest. + return Class.forName("org.springframework.kafka.listener.config.ContainerProperties").newInstance(SHARED_TOPIC) + } catch (ClassNotFoundException | NoClassDefFoundError e) { + return Class.forName("org.springframework.kafka.listener.ContainerProperties").newInstance(SHARED_TOPIC) + } + } + + def producerSpan( + TraceAssert trace, + Map config, + DDSpan parentSpan = null, + boolean partitioned = true, + boolean tombstone = false, + String schema = null + ) { + trace.span { + serviceName service() + operationName operationForProducer() + resourceName "Produce Topic $SHARED_TOPIC" + spanType "queue" + errored false + measured true + if (parentSpan) { + childOf parentSpan + } else { + parent() + } + tags { + "$Tags.COMPONENT" "java-kafka" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_PRODUCER + "$InstrumentationTags.KAFKA_BOOTSTRAP_SERVERS" config.get(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG) + if (partitioned) { + "$InstrumentationTags.PARTITION" { it >= 0 } + } + if (tombstone) { + "$InstrumentationTags.TOMBSTONE" true + } + if ({isDataStreamsEnabled()}) { + "$DDTags.PATHWAY_HASH" { String } + if (schema != null) { + "$DDTags.SCHEMA_DEFINITION" schema + "$DDTags.SCHEMA_WEIGHT" 1 + "$DDTags.SCHEMA_TYPE" "avro" + "$DDTags.SCHEMA_OPERATION" "serialization" + "$DDTags.SCHEMA_ID" "10810872322569724838" + } + } + peerServiceFrom(InstrumentationTags.KAFKA_BOOTSTRAP_SERVERS) + defaultTags() + } + } + } + + def queueSpan( + TraceAssert trace, + DDSpan parentSpan = null + ) { + trace.span { + serviceName splitByDestination() ? "$SHARED_TOPIC" : serviceForTimeInQueue() + operationName "kafka.deliver" + resourceName "$SHARED_TOPIC" + spanType "queue" + errored false + measured true + if (parentSpan) { + childOf parentSpan + } else { + parent() + } + tags { + "$Tags.COMPONENT" "java-kafka" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_BROKER + defaultTags(true) + } + } + } + + def consumerSpan( + TraceAssert trace, + Map config, + DDSpan parentSpan = null, + Range offset = 0..0, + boolean tombstone = false + ) { + trace.span { + serviceName service() + operationName operationForConsumer() + resourceName "Consume Topic $SHARED_TOPIC" + spanType "queue" + errored false + measured true + if (parentSpan) { + childOf parentSpan + } else { + parent() + } + tags { + "$Tags.COMPONENT" "java-kafka" + "$Tags.SPAN_KIND" Tags.SPAN_KIND_CONSUMER + "$InstrumentationTags.PARTITION" { it >= 0 } + "$InstrumentationTags.OFFSET" { offset.containsWithinBounds(it as int) } + "$InstrumentationTags.CONSUMER_GROUP" "sender" + "$InstrumentationTags.KAFKA_BOOTSTRAP_SERVERS" config.get(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG) + "$InstrumentationTags.RECORD_QUEUE_TIME_MS" { it >= 0 } + "$InstrumentationTags.RECORD_END_TO_END_DURATION_MS" { it >= 0 } + if (tombstone) { + "$InstrumentationTags.TOMBSTONE" true + } + if ({isDataStreamsEnabled()}) { + "$DDTags.PATHWAY_HASH" { String } + } + defaultTags(true) + } + } + } + + def pollSpan( + TraceAssert trace, + int recordCount = 1, + DDSpan parentSpan = null, + Range offset = 0..0, + boolean tombstone = false + ) { + trace.span { + serviceName Config.get().getServiceName() + operationName "kafka.poll" + resourceName "kafka.poll" + errored false + measured false + tags { + "$InstrumentationTags.KAFKA_RECORDS_COUNT" recordCount + defaultTags(true) + } + } + } +} + + + + + + + + diff --git a/dd-java-agent/instrumentation/kafka-connect-0.11/src/test/groovy/TestSourceConnector.java b/dd-java-agent/instrumentation/kafka-connect-0.11/src/test/groovy/TestSourceConnector.java new file mode 100644 index 00000000000..4b43de16055 --- /dev/null +++ b/dd-java-agent/instrumentation/kafka-connect-0.11/src/test/groovy/TestSourceConnector.java @@ -0,0 +1,103 @@ +import org.apache.kafka.common.config.ConfigDef; +import org.apache.kafka.connect.connector.Task; +import org.apache.kafka.connect.source.SourceConnector; +import org.apache.kafka.connect.source.SourceTask; +import org.apache.kafka.connect.source.SourceRecord; +import org.apache.kafka.connect.data.Schema; +import org.apache.kafka.connect.data.SchemaBuilder; +import org.apache.kafka.connect.data.Struct; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.ArrayList; + +public class TestSourceConnector extends SourceConnector { + private String topic; + private int intervalMs; + + @Override + public String version() { + return "1.0"; + } + + @Override + public void start(Map props) { + topic = props.get("topic"); + intervalMs = Integer.parseInt(props.getOrDefault("interval.ms", "1000")); + } + + @Override + public Class taskClass() { + return TestSourceTask.class; + } + + @Override + public List> taskConfigs(int maxTasks) { + List> configs = new ArrayList<>(); + Map config = new HashMap<>(); + config.put("topic", topic); + config.put("interval.ms", String.valueOf(intervalMs)); + configs.add(config); + return configs; + } + + @Override + public void stop() { + // Nothing to do here + } + + @Override + public ConfigDef config() { + return null; + } +} + +class TestSourceTask extends SourceTask { + private String topic; + private int intervalMs; + private long lastTimestamp; + + private static final Schema VALUE_SCHEMA = SchemaBuilder.struct() + .field("message", Schema.STRING_SCHEMA) + .build(); + + @Override + public String version() { + return "1.0"; + } + + @Override + public void start(Map props) { + topic = props.get("topic"); + intervalMs = Integer.parseInt(props.get("interval.ms")); + lastTimestamp = System.currentTimeMillis(); + } + + @Override + public List poll() throws InterruptedException { + long currentTime = System.currentTimeMillis(); + if (currentTime - lastTimestamp >= intervalMs) { + lastTimestamp = currentTime; + + // Create a record with a timestamp message + Struct valueStruct = new Struct(VALUE_SCHEMA) + .put("message", "Generated at " + currentTime); + + SourceRecord record = new SourceRecord( + null, null, topic, null, VALUE_SCHEMA, valueStruct + ); + + return List.of(record); + } + + // Sleep briefly to avoid tight looping + Thread.sleep(50); + return null; + } + + @Override + public void stop() { + // Nothing to clean up + } +} diff --git a/settings.gradle b/settings.gradle index 6e6bb98a524..1e53e7169eb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -339,6 +339,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'