Monday, June 29, 2015

Missing `datasource.xxx.active` and `datasource.xxx.usage` in `metrics` endpoint in Spring Boot Actuator

In Spring Boot Actuator's `metrics` endpoint,

if you can't see `datasource.xxx.active` and `datasource.xxx.usage`,

you might have the following configuration:

@SpringBootApplication(exclude = {
    DataSourceAutoConfiguration.class,
    DataSourceTransactionManagerAutoConfiguration.class
})

Showing the metrics needs `DataSourcePoolMetadataProvidersConfiguration`

which is included in `DataSourceAutoConfiguration`.

So you have to use the following if you don't use `DataSourceAutoConfiguration`:

@Import(DataSourcePoolMetadataProvidersConfiguration.class)

It would be nice to separate them because `DataSourceAutoConfiguration` doesn't work

when having multiple `DataSource`s.

No comments:

Post a Comment