-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Metrics for DataSource #1013
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 two ways we can implement this. Either we update the DatasourceHealthIndicator to provide this information (alongside the version and the status of the connection) or we add it to the metrics endpoint. If we want to add it to the metrics endpoint, then we need to rework a bit how What do you guys think? |
This commit adds an abstraction that provides a standard manner to retrieve various information that are shared by most data sources. DataSourceInfo is implemented by the three data source implementations that boot supports out-of-the-box: Tomcat, Hikari and Commons dbcp. This abstraction is used to provide two additional metrics per data source defined in the application: the number of allocated connection(s) and the current usage of the connection pool. Additional DataSourceInfo implementations for other data source types can be added very easily, check DataourceInfoProvidersConfiguration for more details. Fixes spring-projectsgh-1013
This commit adds an abstraction that provides a standard manner to retrieve various information that are shared by most data sources. DataSourceInfo is implemented by the three data source implementations that boot supports out-of-the-box: Tomcat, Hikari and Commons dbcp. This abstraction is used to provide two additional metrics per data source defined in the application: the number of allocated connection(s) and the current usage of the connection pool. Additional DataSourceInfo implementations for other data source types can be added very easily, check DataourceInfoProvidersConfiguration for more details. Fixes spring-projectsgh-1013
This commit adds an abstraction that provides a standard manner to retrieve various information that are shared by most data sources. DataSourceInfo is implemented by the three data source implementations that boot supports out-of-the-box: Tomcat, Hikari and Commons dbcp. This abstraction is used to provide two additional metrics per data source defined in the application: the number of allocated connection(s) (.active) and the current usage of the connection pool (.usage). All such metrics share the 'datasource.' prefix. The prefix is futher qualifier for each data source: * If the data source is the primary data source (that is either the only available data source or the one flagged @primary amongst the existing ones), the prefix is "datasource.primary" * If the data source ends with "dataSource", the prefix is the name of the bean without it (i.e. batchDataSource becomes batch) * In all other cases, the name of the bean is used It is possible to override part of all of those defaults by registering a bean with a customized version of DataSourcePublicMetrics. Additional DataSourceInfo implementations for other data source types can be added very easily, check DataourceInfoProvidersConfiguration for more details. Fixes spring-projectsgh-1013
This issue is ready for review. What bothers me the most is the package location. I think we can be smarter about where to put things and avoid a cyclical dependency. Besides, #1282 may be yet another use of |
I forgot to fix the package location issue. |
Currently the metrics provided are repository based or for the web request. It would be nice if we could also get some metrics about the datasources, like in DropWizard. It would be nice if we could get an overview of the min/max connecties, current open connecties and pool usage/saturation. Those metrics can help to tune the datasource configuration for live systems (and could be a trigger if the open connections or pool usage go upto 100%).
The text was updated successfully, but these errors were encountered: