-
Notifications
You must be signed in to change notification settings - Fork 41.2k
DataSourceUnwrapper calls Wrapper.isWrapperFor with a interface rather than an class causing HikariDataSourceMetricsRegistry failure #24697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
yes, in 2.3.7Version, there is no hikaricp metrics in actuator/prometheus endpoint。 |
@ankeway Can you provide some more details about your setup, or even better a sample application that replicates the issue. I'd like to know the |
The most simple example that use HikariDataSource and Request actuator/prometheus endpoint |
@ankeway unfortunately, that doesn't help. We're asking for a sample because we have several tests that exercise this scenario and they pass. As Phil has requested, can you please share a sample that showcases the problem? You can do so by attaching a zip to this issue or share a link to a GitHub repository. |
https://github.com/ankeway/DsDemo.git if add such as javamelody-spring-boot-starter , dataSource will become net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler thanks |
@ankeway thanks for the sample although it does not reproduce the problem for me. The reference to |
We discussed this one today with two options:
If the first option works we'd have to report an issue against the HikariCP project to suggest an interface to be offered by the project for datasource unwrap needs like this one. |
This commit updates DataSourceUnwrapper to take a separate interface type argument if the target datasource has to be unwrapped, given that the target type is usually not an interface. Closes spring-projectsgh-24697
But with the new implementation, call to As workaround I can call DataSourceUnwrapper.unwrap(myds, DataSource.class, AtomikosDataSourceBean.class), but I think it's a bug. |
Unfortunately, the contract for Using |
you can use instead of org.springframework.boot.jdbc.DataSourceUnwrapper#unwrap(javax.sql.DataSource, java.lang.Class, java.lang.Class),it works! |
for example: HikariDataSource hikariDataSource = DataSourceUnwrapper.unwrap(dataSource, HikariConfigMXBean.class, HikariDataSource.class); |
Uh oh!
There was an error while loading. Please reload this page.
This problem causing hikariDataSource return null
because
target.isInterface()
The text was updated successfully, but these errors were encountered: