-
Notifications
You must be signed in to change notification settings - Fork 41.2k
DataSource Metrics are not created for DataSources behind @RefreshScope proxies #6596
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
There are no immediate plans to support this. It might be possible to extract the underlying target from the proxy and whilst this might work for |
I see, by the way at least in case of Hikari DataSource it's possible to use instanceof HikariConfigMXBean (instead of HikariDataSource) which is an interface and thus implemented by proxy as well as DataSource. This interface provides almost all methods required by DataSourcePoolMetadataProvider. I can submit a pull request in case you think this might be useful. |
@oxygensar I pull request would be most welcome if you have time. I took a quick look at |
Duplicate of #15227 |
It seems that DataSource metrics are not created for DataSources annotated with @RefreshScope.
will give us:
and
but if one uncomments @RefreshScope line health endpoint will continue working but metrics won't be created:
Tested on Spring Boot 1.3.5 and 1.4.0
Looks like RefreshScope always creates JDK Dynamic Proxies and classes like HikariPoolDataSourceMetadataProviderConfiguration check dataSource using instanceof operator which doesn't allow them to identify original DataSource behind the proxy.
Please advice are there any plans to add metrics support for RefreshScope beans.
The text was updated successfully, but these errors were encountered: