Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Integration JDBC execution times statistics

I am using spring-integration in order to connect to an external JDBC database and I want to track execution times per db connection.

Apart from using Spring AOP and wrapping my service method to measure statistics, is there any way to measure times directly in the spring-integration? Meaning to get exactly how much the database connection was used per request?

Thanks

like image 852
FanFan Avatar asked Jul 11 '26 17:07

FanFan


1 Answers

The JDBC is used not only in Spring Integration, so it is not correct to request such a feature exactly from the Spring Integration perspective. Any other applications without any integration features should benefit from such a feature as well.

I think what you are looking for is covered by the DB metrics in Spring Boot: https://docs.spring.io/spring-boot/docs/2.1.5.RELEASE/reference/htmlsingle/#production-ready-metrics-jdbc

If you don't use Spring Boot, consider to apply the mentioned HikariCP: https://github.com/brettwooldridge/HikariCP/wiki/Dropwizard-Metrics

Otherwise you always can override execute(PreparedStatementCreator psc, PreparedStatementCallback<T> action) and wrap a super call into your own metric to measure a time for that execute() call.

like image 145
Artem Bilan Avatar answered Jul 13 '26 21:07

Artem Bilan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!