I'm using Spring Boot with a pooled datasorce
datasource:
type: org.apache.tomcat.jdbc.pool.DataSource
driverClassName: com.mysql.jdbc.Driver
url: ...
username: ...
password: ...
tomcat:
max-active: 50
max-idle: 50
testOnBorrow: true
validationQuery: select 1;
validationInterval: 30000
This configuration is properly taken as the logfile contains 10x the following line:
16:27:52.191 [] [ restartedMain] DEBUG g.apache.tomcat.jdbc.pool.PooledConnection - Instantiating driver using class: com.mysql.jdbc.Driver [url=...]
After that, I start using the application and made some database requests. The DAO implementation is using JPAContext und EntityManager, autowired by Spring and works perfectly returning the expected results from the database.
@Autowired
private JpaContext jpaContext;
@Autowired
private EntityManager em;
EntityManager em = jpaContext.getEntityManagerByManagedType(DownloadHistoryItemCustomEntity.class);
Query q = em.createNativeQuery(query, DownloadHistoryItemCustomEntity.class);
However, the Spring Boot metrics doesn't show any usage for that single datasource
http://localhost:8080/metrics
"datasource.primary.active": 0,
"datasource.primary.usage": 0.0
Why there aren't values > 0 ?
I would expect values greater then zero !
Isn't 'primary' the right datasource ?
Dominik