Skip to content

Commit decf4d8

Browse files
authored
Merge branch 'master' into andrea.marziali/drools
2 parents 9d744b8 + d4d2069 commit decf4d8

32 files changed

Lines changed: 1504 additions & 11 deletions

.github/g2j-migrated-modules.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77

88
buildSrc/call-site-instrumentation-plugin
99
components/json
10+
dd-java-agent/instrumentation/sofarpc/sofarpc-5.0
1011
dd-trace-api

.gitlab-ci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,26 @@ include:
77
- project: 'DataDog/apm-reliability/apm-sdks-benchmarks'
88
file: '.gitlab/ci-java-spring-petclinic-parallel.yml'
99
ref: 'main'
10+
- project: 'DataDog/apm-reliability/apm-sdks-benchmarks'
11+
file: '.gitlab/ci-java-load-parallel.yml'
12+
ref: 'main'
13+
- project: 'DataDog/apm-reliability/apm-sdks-benchmarks'
14+
file: '.gitlab/ci-java-startup-parallel.yml'
15+
ref: 'main'
16+
- project: 'DataDog/apm-reliability/apm-sdks-benchmarks'
17+
file: '.gitlab/ci-java-dacapo-parallel.yml'
18+
ref: 'main'
19+
- local: ".gitlab/java-benchmark-configs.yml"
1020

1121
stages:
1222
- build
1323
- publish
1424
# These benchmarks are intended to replace the legacy benchmarks in the future
1525
- java-spring-petclinic-parallel
1626
- java-spring-petclinic-parallel-slo
27+
- java-startup-parallel
28+
- java-load-parallel
29+
- java-dacapo-parallel
1730
- shared-pipeline
1831
- benchmarks
1932
- macrobenchmarks

.gitlab/java-benchmark-configs.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Ensure the tracer artifact publish finishes before the benchmark jobs start.
2+
linux-java-spring-petclinic-parallel:
3+
needs: ["publish-artifacts-to-s3"]
4+
5+
linux-java-insecure-bank-load-parallel:
6+
needs: ["publish-artifacts-to-s3"]
7+
8+
linux-java-spring-petclinic-load-parallel:
9+
needs: ["publish-artifacts-to-s3"]
10+
11+
linux-java-insecure-bank-startup-parallel:
12+
needs: ["publish-artifacts-to-s3"]
13+
14+
linux-java-spring-petclinic-startup-parallel:
15+
needs: ["publish-artifacts-to-s3"]
16+
17+
linux-java-dacapo-parallel-1:
18+
needs: ["publish-artifacts-to-s3"]
19+
20+
linux-java-dacapo-parallel-2:
21+
needs: ["publish-artifacts-to-s3"]

dd-java-agent/instrumentation/java/java-io-1.8/src/main/java/datadog/trace/instrumentation/java/lang/FilesCallSite.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@ public static void beforeCopyFromStream(@CallSite.Argument(1) @Nullable final Pa
4343
}
4444
}
4545

46+
@CallSite.Before(
47+
"java.nio.file.Path java.nio.file.Files.copy(java.nio.file.Path, java.nio.file.Path, java.nio.file.CopyOption[])")
48+
public static void beforeCopyPathToPath(
49+
@CallSite.Argument(0) @Nullable final Path source,
50+
@CallSite.Argument(1) @Nullable final Path target) {
51+
if (source != null) {
52+
FileIORaspHelper.INSTANCE.beforeFileLoaded(source.toString());
53+
}
54+
if (target != null) {
55+
FileIORaspHelper.INSTANCE.beforeFileWritten(target.toString());
56+
}
57+
}
58+
4659
@CallSite.Before(
4760
"java.nio.file.Path java.nio.file.Files.move(java.nio.file.Path, java.nio.file.Path, java.nio.file.CopyOption[])")
4861
public static void beforeMove(@CallSite.Argument(1) @Nullable final Path target) {
@@ -51,6 +64,13 @@ public static void beforeMove(@CallSite.Argument(1) @Nullable final Path target)
5164
}
5265
}
5366

67+
@CallSite.Before("long java.nio.file.Files.copy(java.nio.file.Path, java.io.OutputStream)")
68+
public static void beforeCopyToStream(@CallSite.Argument(0) @Nullable final Path source) {
69+
if (source != null) {
70+
FileIORaspHelper.INSTANCE.beforeFileLoaded(source.toString());
71+
}
72+
}
73+
5474
// ===================== READ =====================
5575

5676
@CallSite.Before(

dd-java-agent/instrumentation/java/java-io-1.8/src/test/groovy/datadog/trace/instrumentation/java/io/FilesCallSiteTest.groovy

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,35 @@ class FilesCallSiteTest extends BaseIoRaspCallSiteTest {
102102
1 * helper.beforeFileWritten(path.toString())
103103
}
104104

105+
void 'test RASP Files.copy path to path fires beforeFileLoaded on source and beforeFileWritten on target'() {
106+
setup:
107+
final helper = Mock(FileIORaspHelper)
108+
FileIORaspHelper.INSTANCE = helper
109+
final source = newFile('test_rasp_copy_src.txt').toPath()
110+
final target = temporaryFolder.resolve('test_rasp_copy_path_dst.txt')
111+
112+
when:
113+
TestFilesSuite.copyPathToPath(source, target)
114+
115+
then:
116+
1 * helper.beforeFileLoaded(source.toString())
117+
1 * helper.beforeFileWritten(target.toString())
118+
}
119+
120+
void 'test RASP Files.copy path to OutputStream fires beforeFileLoaded on source'() {
121+
setup:
122+
final helper = Mock(FileIORaspHelper)
123+
FileIORaspHelper.INSTANCE = helper
124+
final source = newFile('test_rasp_copy_stream_src.txt').toPath()
125+
126+
when:
127+
TestFilesSuite.copyToStream(source, new ByteArrayOutputStream())
128+
129+
then:
130+
1 * helper.beforeFileLoaded(source.toString())
131+
0 * helper.beforeFileWritten(_)
132+
}
133+
105134
void 'test RASP Files.move'() {
106135
setup:
107136
final helper = Mock(FileIORaspHelper)

dd-java-agent/instrumentation/java/java-io-1.8/src/test/java/foo/bar/TestFilesSuite.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ public static BufferedWriter newBufferedWriterDefaultCharset(
5757
return Files.newBufferedWriter(path, options);
5858
}
5959

60+
public static Path copyPathToPath(
61+
final Path source, final Path target, final CopyOption... options) throws IOException {
62+
return Files.copy(source, target, options);
63+
}
64+
65+
public static long copyToStream(final Path source, final OutputStream out) throws IOException {
66+
return Files.copy(source, out);
67+
}
68+
6069
public static Path move(final Path source, final Path target, final CopyOption... options)
6170
throws IOException {
6271
return Files.move(source, target);
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
muzzle {
2+
pass {
3+
group = "com.alipay.sofa"
4+
module = "sofa-rpc-all"
5+
versions = "[5.0.0,)"
6+
assertInverse = true
7+
}
8+
}
9+
10+
apply from: "$rootDir/gradle/java.gradle"
11+
12+
addTestSuiteForDir('latestDepTest', 'test')
13+
14+
configurations.testRuntimeClasspath {
15+
resolutionStrategy.force "com.google.guava:guava:32.1.3-jre"
16+
}
17+
18+
dependencies {
19+
compileOnly group: "com.alipay.sofa", name: "sofa-rpc-all", version: "5.6.0"
20+
21+
testImplementation group: "com.alipay.sofa", name: "sofa-rpc-all", version: "5.14.2"
22+
// JAX-RS annotations required for the REST protocol test interface (@Path, @GET, etc.)
23+
testImplementation group: "javax.ws.rs", name: "javax.ws.rs-api", version: "2.1.1"
24+
// Required so that GrpcServerModule / GrpcClientModule are discovered via ServiceLoader
25+
// in SofaRpcTripleWithGrpcForkedTest.
26+
testImplementation project(':dd-java-agent:instrumentation:grpc-1.5')
27+
testImplementation group: "io.grpc", name: "grpc-netty", version: "1.53.0"
28+
testImplementation group: "io.grpc", name: "grpc-core", version: "1.53.0"
29+
testImplementation group: "io.grpc", name: "grpc-stub", version: "1.53.0"
30+
testImplementation group: "com.google.protobuf", name: "protobuf-java", version: "3.25.3"
31+
testImplementation group: "com.alibaba", name: "fastjson", version: "1.2.83"
32+
testImplementation group: "com.google.guava", name: "guava", version: "32.1.3-jre"
33+
34+
latestDepTestImplementation group: "com.alipay.sofa", name: "sofa-rpc-all", version: "+"
35+
}

0 commit comments

Comments
 (0)