8000 Replace org.datadog.jmxfetch.Status.generateJson to fix the GraalVM n… · DataDog/dd-trace-java@fe07e3f · GitHub
[go: up one dir, main page]

Skip to content

Commit fe07e3f

Browse files
committed
Replace org.datadog.jmxfetch.Status.generateJson to fix the GraalVM native build error.
1 parent e3c1006 commit fe07e3f

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public String[] helperClassNames() {
3939
packageName + ".Target_datadog_jctools_counters_FixedSizeStripedLongCounterFields",
4040
packageName + ".Target_datadog_jctools_util_UnsafeRefArrayAccess",
4141
packageName + ".Target_org_datadog_jmxfetch_App",
42-
"com.fasterxml.jackson.core.JsonProcessingException" // referenced by jmxfetch.App
42+
"com.fasterxml.jackson.core.JsonProcessingException", // referenced by jmxfetch.App
43+
packageName + ".Target_org_datadog_jmxfetch_Status",
4344
};
4445
}
4546

@@ -52,7 +53,8 @@ public String[] muzzleIgnoredClassNames() {
5253
// ignore helper class names as usual
5354
packageName + ".Target_datadog_jctools_counters_FixedSizeStripedLongCounterFields",
5455
packageName + ".Target_datadog_jctools_util_UnsafeRefArrayAccess",
55-
packageName + ".Target_org_datadog_jmxfetch_App"
56+
packageName + ".Target_org_datadog_jmxfetch_App",
57+
packageName + ".Target_org_datadog_jmxfetch_Status",
5658
};
5759
}
5860

@@ -62,6 +64,7 @@ public static void onExit(@Advice.Return(readOnly = false) List<Class<?>> result
6264
result.add(Target_datadog_jctools_counters_FixedSizeStripedLongCounterFields.class);
6365
result.add(Target_datadog_jctools_util_UnsafeRefArrayAccess.class);
6466
result.add(Target_org_datadog_jmxfetch_App.class);
67+
result.add(Target_org_datadog_jmxfetch_Status.class);
6568
}
6669
}
6770
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package datadog.trace.instrumentation.graal.nativeimage;
2+
3+
import com.oracle.svm.core.annotate.Substitute;
4+
import com.oracle.svm.core.annotate.TargetClass;
5+
import java.io.IOException;
6+
7+
@TargetClass(className = "org.datadog.jmxfetch.Status")
8+
public final class Target_org_datadog_jmxfetch_Status {
9+
@Substitute
10+
private String generateJson() throws IOException {
11+
// Replace org.datadog.jmxfetch.Status.generateJson to fix the GraalVM native build error.
12+
//
13+
// This method has a reference to the excluded transitive dependency jackson-jr-objects.
14+
// GraalVM Native detects it during the reachability analysis and results in
15+
// "Discovered unresolved type during parsing: com.fasterxml.jackson.jr.ob.JSON."
16+
// because of the missing classes that belong to the excluded dependencies.
17+
return "";
18+
}
19+
}

0 commit comments

Comments
 (0)
0