Skip to content

Commit

Permalink
fix: add support for Hikari pool metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
netroms committed Nov 8, 2023
1 parent ae98a33 commit 4e3eed1
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private <N extends Number> void bindDataSource(
"jdbc.connections." + metricName,
this.tags,
this.dataSource,
(m) -> function.apply(m).doubleValue());
m -> function.apply(m).doubleValue());
}
}

Expand All @@ -106,17 +106,12 @@ private static class CachingDataSourcePoolMetadataProvider implements PoolMetada

<N extends Number> Function<DataSource, N> getValueFunction(
Function<PoolMetadata, N> function) {
return (dataSource) -> function.apply(getDataSourcePoolMetadata(dataSource));
return dS -> function.apply(getDataSourcePoolMetadata(dS));
}

@Override
public PoolMetadata getDataSourcePoolMetadata(DataSource dataSource) {
PoolMetadata metadata = cache.get(dataSource);
if (metadata == null) {
metadata = this.metadataProvider.getDataSourcePoolMetadata(dataSource);
cache.put(dataSource, metadata);
}
return metadata;
return cache.computeIfAbsent(dataSource, this.metadataProvider::getDataSourcePoolMetadata);
}
}
}

0 comments on commit 4e3eed1

Please sign in to comment.