diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/jdbc/DataSourcePoolMetricsAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/jdbc/DataSourcePoolMetricsAutoConfigurationTests.java index c2a224ac03..e5f4b81784 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/jdbc/DataSourcePoolMetricsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/jdbc/DataSourcePoolMetricsAutoConfigurationTests.java @@ -57,7 +57,7 @@ public class DataSourcePoolMetricsAutoConfigurationTests { .run((context) -> { context.getBean(DataSource.class).getConnection().getMetaData(); MeterRegistry registry = context.getBean(MeterRegistry.class); - registry.get("jdbc.max.connections").tags("name", "dataSource") + registry.get("jdbc.connections.max").tags("name", "dataSource") .meter(); }); } @@ -72,7 +72,7 @@ public class DataSourcePoolMetricsAutoConfigurationTests { .run((context) -> { context.getBean(DataSource.class).getConnection().getMetaData(); MeterRegistry registry = context.getBean(MeterRegistry.class); - assertThat(registry.find("jdbc.max.connections") + assertThat(registry.find("jdbc.connections.max") .tags("name", "dataSource").meter()).isNull(); }); } @@ -88,8 +88,8 @@ public class DataSourcePoolMetricsAutoConfigurationTests { context.getBean("secondOne", DataSource.class).getConnection() .getMetaData(); MeterRegistry registry = context.getBean(MeterRegistry.class); - registry.get("jdbc.max.connections").tags("name", "first").meter(); - registry.get("jdbc.max.connections").tags("name", "secondOne") + registry.get("jdbc.connections.max").tags("name", "first").meter(); + registry.get("jdbc.connections.max").tags("name", "secondOne") .meter(); }); } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetrics.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetrics.java index 886a12e7aa..7952e8d931 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetrics.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetrics.java @@ -84,7 +84,7 @@ public class DataSourcePoolMetrics implements MeterBinder { private void bindDataSource(MeterRegistry registry, String metricName, Function function) { if (function.apply(this.dataSource) != null) { - registry.gauge("jdbc." + metricName + ".connections", this.tags, + registry.gauge("jdbc.connections." + metricName, this.tags, this.dataSource, (m) -> function.apply(m).doubleValue()); } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetricsTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetricsTests.java index 6872119787..dedaf9de1c 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetricsTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/jdbc/DataSourcePoolMetricsTests.java @@ -50,7 +50,7 @@ public class DataSourcePoolMetricsTests { "metrics.use-global-registry=false") .run((context) -> { context.getBean(DataSource.class).getConnection().getMetaData(); - context.getBean(MeterRegistry.class).get("jdbc.max.connections") + context.getBean(MeterRegistry.class).get("jdbc.connections.max") .meter(); }); }