Fix OpenJ9 test failure (#13311)
This commit is contained in:
parent
cb16d45973
commit
9e7edab6e4
|
@ -26,8 +26,7 @@ class OtelSpringStarterSmokeTest extends AbstractOtelSpringStarterSmokeTest {
|
|||
|
||||
@Override
|
||||
protected void assertAdditionalMetrics() {
|
||||
if (System.getProperty("org.graalvm.nativeimage.imagecode") != null) {
|
||||
// GraalVM native image does not support JFR
|
||||
if (!isFlightRecorderAvailable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -50,4 +49,13 @@ class OtelSpringStarterSmokeTest extends AbstractOtelSpringStarterSmokeTest {
|
|||
"io.opentelemetry.runtime-telemetry-java17", metric, AbstractIterableAssert::isNotEmpty);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isFlightRecorderAvailable() {
|
||||
try {
|
||||
return (boolean)
|
||||
Class.forName("jdk.jfr.FlightRecorder").getMethod("isAvailable").invoke(null);
|
||||
} catch (ReflectiveOperationException exception) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue