Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class Java8RuntimeMetricsInstaller implements AgentListener {

@Override
public void afterAgent(AutoConfiguredOpenTelemetrySdk autoConfiguredSdk) {
if (Double.parseDouble(System.getProperty("java.specification.version")) >= 17) {
if (getJavaVersion() >= 17) {
return;
}

Expand All @@ -32,4 +32,12 @@ public void afterAgent(AutoConfiguredOpenTelemetrySdk autoConfiguredSdk) {
new Thread(runtimeMetrics::close, "OpenTelemetry RuntimeMetricsShutdownHook"));
}
}

private static int getJavaVersion() {
String javaSpecVersion = System.getProperty("java.specification.version");
if ("1.8".equals(javaSpecVersion)) {
return 8;
}
return Integer.parseInt(javaSpecVersion);
}
}
Loading