Skip to content

Commit 6fde643

Browse files
authored
Upgrade jmxfetch dependency to 0.52.0 (#11127)
* Upgrade jmxfetch dependency to 0.52.0 * Adjustments to keep native-image builder happy * Clean up list of tracer classes that must be registered at build_time * jmxfetch upgrade adds 20k which is just enough to push us over 32m
1 parent 8b1580f commit 6fde643

4 files changed

Lines changed: 26 additions & 5 deletions

File tree

dd-java-agent/agent-jmxfetch/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ plugins {
1313
apply from: "$rootDir/gradle/java.gradle"
1414

1515
dependencies {
16-
api('com.datadoghq:jmxfetch:0.49.8') {
16+
api('com.datadoghq:jmxfetch:0.52.0') {
1717
exclude group: 'org.slf4j', module: 'slf4j-api'
1818
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
1919
exclude group: 'com.beust', module: 'jcommander'
2020
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-core'
2121
exclude group: 'com.fasterxml.jackson.jr', module: 'jackson-jr-objects'
22+
// we use snakeyaml-engine instead of legacy library
23+
exclude group: 'org.yaml', module: 'snakeyaml'
2224
}
2325
api libs.slf4j
2426
api project(':internal-api')
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package datadog.trace.agent.jmxfetch;
2+
3+
import java.io.InputStream;
4+
5+
/**
6+
* We map the legacy {@code org.yaml.snakeyaml.Yaml} class to this substitute class at build time to
7+
* keep the GraalVM native-image builder happy. JmxFetch has a solitary reference to the class, but
8+
* it's never called because JMXFetch discovers the embedded snakeyaml-engine library and uses that.
9+
*/
10+
public class LegacyYaml {
11+
public <T> T load(InputStream in) {
12+
throw new UnsupportedOperationException();
13+
}
14+
15+
public String dump(Object data) {
16+
throw new UnsupportedOperationException();
17+
}
18+
}

dd-java-agent/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ def generalShadowJarConfig(ShadowJar shadowJarTask) {
156156
// Prevents conflict with other instances, but doesn't relocate instrumentation
157157
if (!projectName.equals('instrumentation')) {
158158
relocate 'org.snakeyaml.engine', 'datadog.snakeyaml.engine'
159+
relocate 'org.yaml.snakeyaml.Yaml', 'datadog.trace.agent.jmxfetch.LegacyYaml'
159160
relocate 'okhttp3', 'datadog.okhttp3'
160161
relocate 'okio', 'datadog.okio'
161162

@@ -467,7 +468,7 @@ tasks.register('checkAgentJarSize') {
467468
doLast {
468469
// Arbitrary limit to prevent unintentional increases to the agent jar size
469470
// Raise or lower as required
470-
assert tasks.named("shadowJar", ShadowJar).get().archiveFile.get().getAsFile().length() <= 32 * 1024 * 1024
471+
assert tasks.named("shadowJar", ShadowJar).get().archiveFile.get().getAsFile().length() <= 33 * 1024 * 1024
471472
}
472473

473474
dependsOn "shadowJar"

dd-java-agent/instrumentation/graal/graal-native-image-20.0/src/main/java/datadog/trace/instrumentation/graal/nativeimage/NativeImageGeneratorRunnerInstrumentation.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ public static void onEnter(@Advice.Argument(value = 0, readOnly = false) String[
6565
+ "com.datadog.profiling.controller.openjdk.events.QueueTimeEvent:build_time,"
6666
+ "com.datadog.profiling.controller.openjdk.events.TimelineEvent:build_time,"
6767
+ "com.datadog.profiling.controller.openjdk.events.SmapEntryEvent:build_time,"
68-
+ "com.datadog.profiling.controller.openjdk.events.SmapEntryFactory$SmapParseErrorEvent:build_time,"
69-
+ "com.datadog.profiling.ddprof.JavaProfilerLoader:run_time,"
7068
+ "com.datadoghq.profiler.ThreadContext:run_time,"
7169
+ "com.datadoghq.profiler.BufferWriter:run_time,"
7270
+ "com.datadoghq.profiler.BufferWriter8:run_time,"
@@ -133,11 +131,13 @@ public static void onEnter(@Advice.Argument(value = 0, readOnly = false) String[
133131
+ "datadog.trace.bootstrap.benchmark.StaticEventLogger:build_time,"
134132
+ "datadog.trace.bootstrap.blocking.BlockingExceptionHandler:build_time,"
135133
+ "datadog.trace.bootstrap.InstrumentationErrors:build_time,"
134+
+ "datadog.trace.bootstrap.instrumentation.java.concurrent.AsyncResultExtensions$CompletableAsyncResultExtension:build_time,"
135+
+ "datadog.trace.bootstrap.instrumentation.java.concurrent.AsyncResultExtensions$1:build_time,"
136136
+ "datadog.trace.bootstrap.instrumentation.java.concurrent.AsyncResultExtensions:build_time,"
137137
+ "datadog.trace.bootstrap.instrumentation.java.concurrent.ConcurrentState:build_time,"
138138
+ "datadog.trace.bootstrap.instrumentation.java.concurrent.ExcludeFilter:build_time,"
139139
+ "datadog.trace.bootstrap.instrumentation.java.concurrent.ExcludeFilter$ExcludeType:build_time,"
140-
+ "datadog.trace.bootstrap.instrumentation.java.concurrent.QueueTimeHelper:build_time,"
140+
+ "datadog.trace.bootstrap.instrumentation.java.concurrent.QueueTimerHelper:build_time,"
141141
+ "datadog.trace.bootstrap.instrumentation.java.concurrent.QueueTimerHelper$RateLimiterHolder:run_time,"
142142
+ "datadog.trace.bootstrap.instrumentation.java.concurrent.TPEHelper:build_time,"
143143
+ "datadog.trace.bootstrap.instrumentation.jfr.exceptions.ExceptionCountEvent:build_time,"

0 commit comments

Comments
 (0)