Skip to content

Commit 4cea17c

Browse files
committed
wip
1 parent 0f5d84f commit 4cea17c

10 files changed

Lines changed: 439 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,36 @@
11

22
apply from: "$rootDir/gradle/java.gradle"
33

4+
sourceSets {
5+
register("main_java25") {
6+
java {
7+
srcDirs = [file('src/main/java25')]
8+
}
9+
}
10+
named("main_java25") {
11+
compileClasspath += sourceSets.main.output
12+
runtimeClasspath += sourceSets.main.output
13+
}
14+
named("test") {
15+
compileClasspath += sourceSets.main_java25.output
16+
runtimeClasspath += sourceSets.main_java25.output
17+
}
18+
}
19+
420
dependencies {
521
implementation project(':dd-java-agent:agent-debugger:debugger-bootstrap')
622

723
testImplementation group: 'com.newrelic.agent.java', name: 'newrelic-api', version: '6.+'
824
}
25+
26+
tasks.named("jar") {
27+
from(sourceSets.main_java25.output)
28+
}
29+
30+
tasks.named("compileMain_java25Java") {
31+
configureCompiler(
32+
it,
33+
25,
34+
JavaVersion.VERSION_1_8,
35+
"Java 25 sourceset for FFM native tracing advice.")
36+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
plugins {
2+
id 'idea'
3+
}
4+
5+
muzzle {
6+
pass {
7+
coreJdk('22')
8+
}
9+
}
10+
11+
apply from: "$rootDir/gradle/java.gradle"
12+
apply from: "$rootDir/gradle/slf4j-simple.gradle"
13+
14+
tracerJava {
15+
addSourceSetFor(JavaVersion.VERSION_25)
16+
}
17+
18+
testJvmConstraints {
19+
minJavaVersion = JavaVersion.VERSION_22
20+
}
21+
22+
idea {
23+
module {
24+
jdkName = '25'
25+
}
26+
}
27+
28+
29+
tasks.named("compileMain_java25Java", JavaCompile) {
30+
configureCompiler(it, 25, JavaVersion.VERSION_1_8)
31+
}
32+
33+
tasks.named("compileTestGroovy", GroovyCompile) {
34+
configureCompiler(it, 25)
35+
}
36+
dependencies {
37+
implementation project(':dd-java-agent:instrumentation:datadog:tracing:trace-annotation')
38+
}
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# This is a Gradle generated file for dependency locking.
2+
# Manual edits can break the build and are not advised.
3+
# This file is expected to be part of source control.
4+
cafe.cryptography:curve25519-elisabeth:0.1.0=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
5+
cafe.cryptography:ed25519-elisabeth:0.1.0=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
6+
ch.qos.logback:logback-classic:1.2.13=testCompileClasspath
7+
ch.qos.logback:logback-core:1.2.13=testCompileClasspath
8+
com.blogspot.mydailyjava:weak-lock-free:0.17=buildTimeInstrumentationPlugin,compileClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
9+
com.datadoghq.okhttp3:okhttp:3.12.15=buildTimeInstrumentationPlugin,compileClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
10+
com.datadoghq.okio:okio:1.17.6=buildTimeInstrumentationPlugin,compileClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
11+
com.datadoghq:dd-instrument-java:0.0.3=buildTimeInstrumentationPlugin,compileClasspath,muzzleBootstrap,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
12+
com.datadoghq:dd-javac-plugin-client:0.2.2=buildTimeInstrumentationPlugin,compileClasspath,muzzleBootstrap,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
13+
com.datadoghq:java-dogstatsd-client:4.4.3=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
14+
com.datadoghq:sketches-java:0.8.3=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
15+
com.github.javaparser:javaparser-core:3.25.6=codenarc
16+
com.github.jnr:jffi:1.3.14=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
17+
com.github.jnr:jnr-a64asm:1.0.0=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
18+
com.github.jnr:jnr-constants:0.10.4=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
19+
com.github.jnr:jnr-enxio:0.32.19=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
20+
com.github.jnr:jnr-ffi:2.2.18=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
21+
com.github.jnr:jnr-posix:3.1.21=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
22+
com.github.jnr:jnr-unixsocket:0.38.24=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
23+
com.github.jnr:jnr-x86asm:1.0.2=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
24+
com.github.spotbugs:spotbugs-annotations:4.9.8=compileClasspath,spotbugs,testCompileClasspath,testRuntimeClasspath
25+
com.github.spotbugs:spotbugs:4.9.8=spotbugs
26+
com.github.stephenc.jcip:jcip-annotations:1.0-1=spotbugs
27+
com.google.auto.service:auto-service-annotations:1.1.1=annotationProcessor,compileClasspath,testAnnotationProcessor,testCompileClasspath
28+
com.google.auto.service:auto-service:1.1.1=annotationProcessor,testAnnotationProcessor
29+
com.google.auto:auto-common:1.2.1=annotationProcessor,testAnnotationProcessor
30+
com.google.code.findbugs:jsr305:3.0.2=annotationProcessor,compileClasspath,spotbugs,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
31+
com.google.code.gson:gson:2.13.2=spotbugs
32+
com.google.errorprone:error_prone_annotations:2.18.0=annotationProcessor,testAnnotationProcessor
33+
com.google.errorprone:error_prone_annotations:2.41.0=spotbugs
34+
com.google.guava:failureaccess:1.0.1=annotationProcessor,testAnnotationProcessor
35+
com.google.guava:guava:20.0=testCompileClasspath,testRuntimeClasspath
36+
com.google.guava:guava:32.0.1-jre=annotationProcessor,testAnnotationProcessor
37+
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=annotationProcessor,testAnnotationProcessor
38+
com.google.j2objc:j2objc-annotations:2.8=annotationProcessor,testAnnotationProcessor
39+
com.google.re2j:re2j:1.7=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
40+
com.squareup.moshi:moshi:1.11.0=buildTimeInstrumentationPlugin,compileClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
41+
com.squareup.okhttp3:logging-interceptor:3.12.12=testCompileClasspath,testRuntimeClasspath
42+
com.squareup.okhttp3:okhttp:3.12.12=testCompileClasspath,testRuntimeClasspath
43+
com.squareup.okio:okio:1.17.5=buildTimeInstrumentationPlugin,compileClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
44+
com.thoughtworks.qdox:qdox:1.12.1=codenarc
45+
commons-fileupload:commons-fileupload:1.5=testCompileClasspath,testRuntimeClasspath
46+
commons-io:commons-io:2.11.0=testCompileClasspath,testRuntimeClasspath
47+
commons-io:commons-io:2.20.0=spotbugs
48+
de.thetaphi:forbiddenapis:3.10=compileClasspath
49+
io.leangen.geantyref:geantyref:1.3.16=testRuntimeClasspath
50+
io.sqreen:libsqreen:17.3.0=testRuntimeClasspath
51+
javax.servlet:javax.servlet-api:3.1.0=testCompileClasspath,testRuntimeClasspath
52+
jaxen:jaxen:2.0.0=spotbugs
53+
junit:junit:4.13.2=testRuntimeClasspath
54+
net.bytebuddy:byte-buddy-agent:1.18.3=buildTimeInstrumentationPlugin,compileClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
55+
net.bytebuddy:byte-buddy:1.18.3=buildTimeInstrumentationPlugin,compileClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
56+
net.java.dev.jna:jna-platform:5.8.0=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
57+
net.java.dev.jna:jna:5.8.0=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
58+
net.sf.saxon:Saxon-HE:12.9=spotbugs
59+
org.apache.ant:ant-antlr:1.10.14=codenarc
60+
org.apache.ant:ant-junit:1.10.14=codenarc
61+
org.apache.bcel:bcel:6.11.0=spotbugs
62+
org.apache.commons:commons-lang3:3.19.0=spotbugs
63+
org.apache.commons:commons-text:1.14.0=spotbugs
64+
org.apache.logging.log4j:log4j-api:2.25.2=spotbugs
65+
org.apache.logging.log4j:log4j-core:2.25.2=spotbugs
66+
org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath
67+
org.checkerframework:checker-qual:3.33.0=annotationProcessor,testAnnotationProcessor
68+
org.codehaus.groovy:groovy-ant:3.0.23=codenarc
69+
org.codehaus.groovy:groovy-docgenerator:3.0.23=codenarc
70+
org.codehaus.groovy:groovy-groovydoc:3.0.23=codenarc
71+
org.codehaus.groovy:groovy-json:3.0.23=codenarc
72+
org.codehaus.groovy:groovy-json:3.0.25=testCompileClasspath,testRuntimeClasspath
73+
org.codehaus.groovy:groovy-templates:3.0.23=codenarc
74+
org.codehaus.groovy:groovy-xml:3.0.23=codenarc
75+
org.codehaus.groovy:groovy:3.0.23=codenarc
76+
org.codehaus.groovy:groovy:3.0.25=testCompileClasspath,testRuntimeClasspath
77+
org.codenarc:CodeNarc:3.7.0=codenarc
78+
org.dom4j:dom4j:2.2.0=spotbugs
79+
org.gmetrics:GMetrics:2.1.0=codenarc
80+
org.hamcrest:hamcrest-core:1.3=testRuntimeClasspath
81+
org.hamcrest:hamcrest:3.0=testCompileClasspath,testRuntimeClasspath
82+
org.jctools:jctools-core-jdk11:4.0.6=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
83+
org.jctools:jctools-core:4.0.6=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
84+
org.junit.jupiter:junit-jupiter-api:5.14.1=testCompileClasspath,testRuntimeClasspath
85+
org.junit.jupiter:junit-jupiter-engine:5.14.1=testRuntimeClasspath
86+
org.junit.jupiter:junit-jupiter-params:5.14.1=testCompileClasspath,testRuntimeClasspath
87+
org.junit.jupiter:junit-jupiter:5.14.1=testCompileClasspath,testRuntimeClasspath
88+
org.junit.platform:junit-platform-commons:1.14.1=testCompileClasspath,testRuntimeClasspath
89+
org.junit.platform:junit-platform-engine:1.14.1=testCompileClasspath,testRuntimeClasspath
90+
org.junit.platform:junit-platform-launcher:1.14.1=testRuntimeClasspath
91+
org.junit.platform:junit-platform-runner:1.14.1=testRuntimeClasspath
92+
org.junit.platform:junit-platform-suite-api:1.14.1=testRuntimeClasspath
93+
org.junit.platform:junit-platform-suite-commons:1.14.1=testRuntimeClasspath
94+
org.junit:junit-bom:5.14.0=spotbugs
95+
org.junit:junit-bom:5.14.1=testCompileClasspath,testRuntimeClasspath
96+
org.mockito:mockito-core:4.4.0=testRuntimeClasspath
97+
org.objenesis:objenesis:3.3=testCompileClasspath,testRuntimeClasspath
98+
org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testRuntimeClasspath
99+
org.ow2.asm:asm-analysis:9.7.1=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
100+
org.ow2.asm:asm-analysis:9.9=spotbugs
101+
org.ow2.asm:asm-commons:9.7.1=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath
102+
org.ow2.asm:asm-commons:9.9=spotbugs
103+
org.ow2.asm:asm-commons:9.9.1=testRuntimeClasspath
104+
org.ow2.asm:asm-tree:9.7.1=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath
105+
org.ow2.asm:asm-tree:9.9=spotbugs
106+
org.ow2.asm:asm-tree:9.9.1=testRuntimeClasspath
107+
org.ow2.asm:asm-util:9.7.1=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
108+
org.ow2.asm:asm-util:9.9=spotbugs
109+
org.ow2.asm:asm:9.7.1=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath
110+
org.ow2.asm:asm:9.9=spotbugs
111+
org.ow2.asm:asm:9.9.1=testRuntimeClasspath
112+
org.slf4j:jcl-over-slf4j:1.7.30=testCompileClasspath,testRuntimeClasspath
113+
org.slf4j:jul-to-slf4j:1.7.30=testCompileClasspath,testRuntimeClasspath
114+
org.slf4j:log4j-over-slf4j:1.7.30=testCompileClasspath,testRuntimeClasspath
115+
org.slf4j:slf4j-api:1.7.30=buildTimeInstrumentationPlugin,compileClasspath,muzzleBootstrap,muzzleTooling,runtimeClasspath,testRuntimeClasspath
116+
org.slf4j:slf4j-api:1.7.32=testCompileClasspath
117+
org.slf4j:slf4j-api:2.0.17=spotbugs,spotbugsSlf4j
118+
org.slf4j:slf4j-simple:1.7.30=testRuntimeClasspath
119+
org.slf4j:slf4j-simple:1.7.30=testRuntimeClasspath
120+
org.slf4j:slf4j-simple:2.0.17=spotbugsSlf4j
121+
org.snakeyaml:snakeyaml-engine:2.9=buildTimeInstrumentationPlugin,muzzleTooling,runtimeClasspath,testRuntimeClasspath
122+
org.spockframework:spock-bom:2.4-groovy-3.0=testCompileClasspath,testRuntimeClasspath
123+
org.spockframework:spock-core:2.4-groovy-3.0=testCompileClasspath,testRuntimeClasspath
124+
org.xmlresolver:xmlresolver:5.3.3=spotbugs
125+
empty=spotbugsPlugins
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package datadog.trace.instrumentation.java.lang.jdk22;
2+
3+
import com.google.auto.service.AutoService;
4+
import datadog.trace.agent.tooling.Instrumenter;
5+
import datadog.trace.agent.tooling.InstrumenterModule;
6+
import datadog.trace.api.InstrumenterConfig;
7+
import java.util.List;
8+
import java.util.Map;
9+
import java.util.Set;
10+
11+
@AutoService(InstrumenterModule.class)
12+
public class FFMApiModule extends InstrumenterModule.Tracing {
13+
private final Map<String, Set<String>> tracedNativeMethods;
14+
public FFMApiModule() {
15+
super("java-lang-22");
16+
tracedNativeMethods = InstrumenterConfig.get().getTraceNativeMethods();
17+
}
18+
19+
@Override
20+
public Map<String, String> contextStore() {
21+
return super.contextStore();
22+
}
23+
24+
@Override
25+
public boolean isEnabled() {
26+
return super.isEnabled() && !tracedNativeMethods.isEmpty();
27+
}
28+
29+
@Override
30+
public List<Instrumenter> typeInstrumentations() {
31+
return super.typeInstrumentations();
32+
}
33+
34+
@Override
35+
public String[] helperClassNames() {
36+
return super.helperClassNames();
37+
}
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package testdog.trace.instrumentation.java.lang.jdk21;
2+
3+
import datadog.trace.api.Trace;
4+
import java.util.concurrent.Callable;
5+
import java.util.concurrent.atomic.AtomicBoolean;
6+
7+
public class JavaAsyncChild implements Runnable, Callable<Void> {
8+
private final AtomicBoolean blockThread;
9+
private final boolean doTraceableWork;
10+
11+
public JavaAsyncChild() {
12+
this(true, false);
13+
}
14+
15+
public JavaAsyncChild(final boolean doTraceableWork, final boolean blockThread) {
16+
this.doTraceableWork = doTraceableWork;
17+
this.blockThread = new AtomicBoolean(blockThread);
18+
}
19+
20+
public void unblock() {
21+
blockThread.set(false);
22+
}
23+
24+
@Override
25+
public void run() {
26+
runImpl();
27+
}
28+
29+
@Override
30+
public Void call() {
31+
runImpl();
32+
return null;
33+
}
34+
35+
private void runImpl() {
36+
while (blockThread.get()) {
37+
// busy-wait to block thread
38+
}
39+
if (doTraceableWork) {
40+
asyncChild();
41+
}
42+
}
43+
44+
@Trace(operationName = "asyncChild")
45+
private void asyncChild() {}
46+
}

0 commit comments

Comments
 (0)