Using spring boot 3.2.3
Have initialised a JDBC Datatsource like
datasource:
url: jdbc:mysql://x.x.x.x:xxxx/xxx
username: xxxx
password: xxxx
driver-class-name: com.mysql.cj.jdbc.Driver
name: xxxx
hikari:
pool-name: xxxx
in application.yml
The Datasource bean of type HikariDataSource gets created and I'm able to use it.
I also do get metrics such as jdbc_connections_max in actuator endpoint, however I want hikaricp metrics which are present in https://github.com/brettwooldridge/HikariCP/blob/dev/src/main/java/com/zaxxer/hikari/metrics/micrometer/MicrometerMetricsTrackerFactory.java
I'm using micrometer for other metrics as well.
Comment From: abhisheksurve45
I see property metrics-tracker-factory in hikari
example
datasource:
url: jdbc:mysql://x.x.x.x:xxxx/xxx
username: xxxx
password: xxxx
driver-class-name: com.mysql.cj.jdbc.Driver
name: xxxx
hikari:
pool-name: xxxx
metrics-tracker-factory: ?
But I'm not sure how to set it.
Ive initialised the Micrometer MeterRegistry via
@Bean
public MeterRegistry getMeterRegistry() {
return new CompositeMeterRegistry();
}
Comment From: wilkinsona
org.springframework.boot.actuate.autoconfigure.metrics.jdbc.DataSourcePoolMetricsAutoConfiguration.HikariDataSourceMetricsConfiguration should set this up automatically. It sounds like that may not be happening for you but I cannot tell why without some more information about your application.
If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
Comment From: abhisheksurve45
Sure @wilkinsona
I could see code going through com.zaxxer.hikari.metrics.micrometer.MicrometerMetricsTracker#MicrometerMetricsTracker constructor and metrics being registered, however they don't appear on actuator endpoint.
Will create a small POC.
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.