Consistent prefix for datasource pool metrics
See gh-12127
This commit is contained in:
parent
8ffa146660
commit
16867f866c
|
|
@ -84,7 +84,7 @@ public class DataSourcePoolMetrics implements MeterBinder {
|
|||
private <N extends Number> void bindDataSource(MeterRegistry registry,
|
||||
String metricName, Function<DataSource, N> 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());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue