Skip to content

Commit 03e3c12

Browse files
committed
Adjust GraalVM Native substitutions for JMXFetch
1 parent 5d06a2f commit 03e3c12

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,11 @@
77
public final class Target_org_datadog_jmxfetch_App {
88
@Substitute
99
private boolean getJsonConfigs() {
10-
// Replace org.datadog.jmxfetch.App.getJsonConfigs to fix the GraalVM native build error.
11-
//
12-
// This method has references to the excluded transitive dependencies:
13-
// - jackson-core (catch JsonProcessingException)
14-
// - jackson-jr-objects (referenced in org.datadog.jmxfetch.JsonParser).
10+
// This method has a reference to the excluded transitive dependency jackson-jr-objects.
1511
// GraalVM Native detects it during the reachability analysis and results in
1612
// "Discovered unresolved method during parsing:
1713
// org.datadog.jmxfetch.App.<init>(org.datadog.jmxfetch.AppConfig)."
1814
// because of the missing classes that belong to the excluded dependencies.
19-
return false;
15+
throw new IllegalStateException("Unreachable");
2016
}
2117
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
public final class Target_org_datadog_jmxfetch_Status {
99
@Substitute
1010
private String generateJson() throws IOException {
11-
// Replace org.datadog.jmxfetch.Status.generateJson to fix the GraalVM native build error.
12-
//
1311
// This method has a reference to the excluded transitive dependency jackson-jr-objects.
1412
// GraalVM Native detects it during the reachability analysis and results in
1513
// "Discovered unresolved type during parsing: com.fasterxml.jackson.jr.ob.JSON."
1614
// because of the missing classes that belong to the excluded dependencies.
17-
return "";
15+
throw new IllegalStateException("Unreachable");
1816
}
1917
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ public final class Target_org_datadog_jmxfetch_reporter_JsonReporter {
88
@Substitute
99
public void doSendServiceCheck(
1010
String serviceCheckName, String status, String message, String[] tags) {
11-
// Replace org.datadog.jmxfetch.reporter.JsonReporter.doSendServiceCheck to fix the GraalVM
12-
// native build error.
13-
//
1411
// This method has a reference to the excluded transitive dependency jackson-jr-objects.
1512
// GraalVM Native detects it during the reachability analysis and results in
1613
// "Discovered unresolved type during parsing: com.fasterxml.jackson.jr.ob.JSON."
1714
// because of the missing classes that belong to the excluded dependencies.
15+
throw new IllegalStateException("Unreachable");
1816
}
1917
}

0 commit comments

Comments
 (0)