Skip to content

Commit 3c11163

Browse files
authored
Merge branch 'master' into jb/ddprof_1.23.0
2 parents fb3ebf8 + c0aff90 commit 3c11163

File tree

25 files changed

+736
-192
lines changed

25 files changed

+736
-192
lines changed

components/yaml/build.gradle.kts

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
plugins {
2+
id("me.champeau.jmh")
3+
}
4+
5+
apply(from = "$rootDir/gradle/java.gradle")
6+
7+
jmh {
8+
version = "1.28"
9+
}
10+
11+
// https://repo1.maven.org/maven2/org/yaml/snakeyaml/2.4/snakeyaml-2.4.pom
12+
dependencies {
13+
implementation("org.yaml", "snakeyaml", "2.4")
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package datadog.yaml;
2+
3+
import java.io.FileInputStream;
4+
import java.io.IOException;
5+
import org.yaml.snakeyaml.Yaml;
6+
7+
public class YamlParser {
8+
// Supports clazz == null for default yaml parsing
9+
public static <T> T parse(String filePath, Class<T> clazz) throws IOException {
10+
Yaml yaml = new Yaml();
11+
try (FileInputStream fis = new FileInputStream(filePath)) {
12+
if (clazz == null) {
13+
return yaml.load(fis);
14+
} else {
15+
return yaml.loadAs(fis, clazz);
16+
}
17+
}
18+
}
19+
}

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/Constants.java

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public final class Constants {
1616
public static final String[] BOOTSTRAP_PACKAGE_PREFIXES = {
1717
"datadog.slf4j",
1818
"datadog.json",
19+
"datadog.yaml",
1920
"datadog.context",
2021
"datadog.cli",
2122
"datadog.appsec.api",

dd-java-agent/agent-profiling/profiling-controller-jfr/src/main/resources/jfr/dd.jfp

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ jdk.ThreadCPULoad#enabled=true
186186
jdk.ThreadCPULoad#period=10 s
187187
jdk.CPUTimeStampCounter#enabled=true
188188
jdk.CPUTimeStampCounter#period=beginChunk
189-
jdk.SystemProcess#enabled=true
189+
jdk.SystemProcess#enabled=false
190190
jdk.SystemProcess#period=endChunk
191191
jdk.NetworkUtilization#enabled=true
192192
jdk.NetworkUtilization#period=5 s

dd-java-agent/build.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ ext.generalShadowJarConfig = {
5959

6060
final String projectName = "${project.name}"
6161

62-
// Prevents conflict with other OkHttp instances, but don't relocate instrumentation
62+
// Prevents conflict with other instances, but doesn't relocate instrumentation
6363
if (!projectName.equals('instrumentation')) {
64+
relocate 'org.yaml.snakeyaml', 'datadog.snakeyaml'
6465
relocate 'okhttp3', 'datadog.okhttp3'
6566
relocate 'okio', 'datadog.okio'
6667
}

dd-java-agent/instrumentation/build.gradle

+3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ subprojects { Project subProj ->
5959
def name = "java$version.majorVersion"
6060
jdkCompile = "main_${name}Implementation"
6161
}
62+
configurations.muzzleBootstrap {
63+
exclude group: 'org.yaml', module : 'snakeyaml' // we vendor this in the agent jar
64+
}
6265
dependencies {
6366
// Apply common dependencies for instrumentation.
6467
implementation project(':dd-trace-api')

dd-java-agent/instrumentation/lettuce-5/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ muzzle {
1111
apply from: "$rootDir/gradle/java.gradle"
1212

1313
addTestSuiteForDir('latestDepTest', 'test')
14+
addTestSuiteExtendingForDir('latestDepForkedTest', 'latestDepTest', 'test')
1415

1516
dependencies {
1617
compileOnly group: 'io.lettuce', name: 'lettuce-core', version: '5.0.0.RELEASE'

dd-java-agent/instrumentation/lettuce-5/src/test/groovy/Lettuce5ClientTestBase.groovy

+7
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ abstract class Lettuce5ClientTestBase extends VersionedNamingTestBase {
4242
RedisAsyncCommands<String, ?> asyncCommands
4343
RedisCommands<String, ?> syncCommands
4444

45+
@Override
46+
boolean useStrictTraceWrites() {
47+
// latest seems leaking continuations that terminates later hence the strict trace will discard our spans.
48+
!isLatestDepTest
49+
}
50+
51+
4552
def setup() {
4653
redisServer.start()
4754
println "Using redis: $redisServer.redisURI"

dd-java-agent/instrumentation/snakeyaml/build.gradle

+7-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ addTestSuiteForDir('latestDepTest', 'test')
1818

1919
dependencies {
2020
compileOnly group: 'org.yaml', name: 'snakeyaml', version: '1.33'
21-
testImplementation group: 'org.yaml', name: 'snakeyaml', version: '1.33'
21+
22+
testImplementation('org.yaml:snakeyaml') {
23+
version {
24+
strictly "[1.4, 2.0)"
25+
prefer '1.33'
26+
}
27+
}
2228

2329
latestDepTestImplementation group: 'org.yaml', name: 'snakeyaml', version: '1.+'
2430
}

dd-java-agent/testing/build.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ excludedClassesCoverage += [
3838
'datadog.trace.agent.test.TestProfilingContextIntegration.TestQueueTiming'
3939
]
4040

41+
configurations.api {
42+
exclude group: 'org.yaml', module: 'snakeyaml' // we vendor this in the agent jar
43+
}
44+
4145
dependencies {
4246
api libs.bytebuddy
4347
api libs.bytebuddyagent

dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/SpockRunner.java

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class SpockRunner extends JUnitPlatform {
3939
public static final String[] BOOTSTRAP_PACKAGE_PREFIXES_COPY = {
4040
"datadog.slf4j",
4141
"datadog.json",
42+
"datadog.yaml",
4243
"datadog.context",
4344
"datadog.cli",
4445
"datadog.appsec.api",

dd-smoke-tests/profiling-integration-tests/src/test/java/datadog/smoketest/JFRBasedProfilingIntegrationTest.java

+5
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,11 @@ private void assertRecordingEvents(
565565
final IItemCollection events,
566566
final boolean expectEndpointEvents,
567567
final boolean asyncProfilerEnabled) {
568+
// Process events should not be collected
569+
assertFalse(
570+
events.apply(ItemFilters.type("jdk.SystemProcess")).hasItems(),
571+
"jdk.SystemProcess events should not be collected");
572+
568573
assertTrue(
569574
events
570575
.apply(

gradle/dependencies.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ final class CachedData {
1818
exclude(project(':communication'))
1919
exclude(project(':components:context'))
2020
exclude(project(':components:json'))
21+
exclude(project(':components:yaml'))
2122
exclude(project(':components:cli'))
2223
exclude(project(':remote-config:remote-config-api'))
2324
exclude(project(':remote-config:remote-config-core'))
@@ -49,6 +50,9 @@ final class CachedData {
4950

5051
// cafe_crypto and its transitives
5152
exclude(dependency('cafe.cryptography::'))
53+
54+
// snakeyaml and its transitives
55+
exclude(dependency('org.yaml:snakeyaml'))
5256
}
5357
]
5458
}

internal-api/build.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -239,21 +239,22 @@ dependencies {
239239
api project(':dd-trace-api')
240240
api libs.slf4j
241241
api project(':components:context')
242+
api project(':components:yaml')
242243
api project(':components:cli')
243244
api project(":utils:time-utils")
244245

245246
// has to be loaded by system classloader:
246247
// it contains annotations that are also present in the instrumented application classes
247248
api "com.datadoghq:dd-javac-plugin-client:0.2.2"
248249

250+
testImplementation("org.yaml:snakeyaml:2.4")
249251
testImplementation project(":utils:test-utils")
250252
testImplementation("org.assertj:assertj-core:3.20.2")
251253
testImplementation libs.bundles.junit5
252254
testImplementation group: 'org.junit.vintage', name: 'junit-vintage-engine', version: libs.versions.junit5.get()
253255
testImplementation libs.commons.math
254256
testImplementation libs.bundles.mockito
255257
testImplementation libs.truth
256-
testImplementation 'org.yaml:snakeyaml:2.0'
257258
}
258259

259260
jmh {

0 commit comments

Comments
 (0)