spring-boot-data-source-decorator
spring-boot-data-source-decorator copied to clipboard
Add metrics for SQL queries
Any plan? I thought decorator.datasource.datasource-proxy.count-query=true
would expose those metrics to actuator/prometheus.
That was the case before Spring Boot 2.0, after that they replaced in-house counters with Micrometer, now it only registers counter so you can have access to QueryCount
at runtime - QueryCountHolder.getGrandTotal()
or QueryCountHolder.get(dataSourceName)
. These counts can be used in tests, but I don't think they are particularly useful for applications running in production.
Initial goal of this ticket was to measure things like query timings, but the problem is that it's quite hard (from JDBC perspective) to correlate particular SQL query with the code and at the same time most databases provide much more better insights.