Skip to content

Commit 3c10824

Browse files
committed
pr review
1 parent 6a1e1b2 commit 3c10824

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/instrumentation/runtimemetrics/Java8RuntimeMetricsProvider.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class Java8RuntimeMetricsProvider implements RuntimeMetricsProvider {
2424

2525
@Override
2626
public int minJavaVersion() {
27-
return 8;
27+
return 1;
2828
}
2929

3030
@Override

instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/instrumentation/runtimemetrics/RuntimeMetricsAutoConfiguration.java

+1-10
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void handleApplicationReadyEvent(ApplicationReadyEvent event) {
4848
ConfigPropertiesBridge config =
4949
new ConfigPropertiesBridge(applicationContext.getBean(ConfigProperties.class));
5050

51-
double version = javaVersion();
51+
double version = Double.parseDouble(System.getProperty("java.specification.version"));
5252
Optional<RuntimeMetricsProvider> metricsProvider =
5353
applicationContext.getBeanProvider(RuntimeMetricsProvider.class).stream()
5454
.sorted(Comparator.comparing(RuntimeMetricsProvider::minJavaVersion).reversed())
@@ -61,13 +61,4 @@ public void handleApplicationReadyEvent(ApplicationReadyEvent event) {
6161
logger.debug("No runtime metrics instrumentation available for Java {}", version);
6262
}
6363
}
64-
65-
private static int javaVersion() {
66-
try {
67-
return Integer.parseInt(System.getProperty("java.specification.version"));
68-
} catch (NumberFormatException nfe) {
69-
// The value of the java.specification.version property is 1.8 with a Java 8 runtime.
70-
return 8;
71-
}
72-
}
7364
}

0 commit comments

Comments
 (0)