spring-boot-data-source-decorator icon indicating copy to clipboard operation
spring-boot-data-source-decorator copied to clipboard

Add metrics for SQL queries

Open gavlyukovskiy opened this issue 6 years ago • 2 comments

gavlyukovskiy avatar May 26 '18 22:05 gavlyukovskiy

Any plan? I thought decorator.datasource.datasource-proxy.count-query=true would expose those metrics to actuator/prometheus.

uqix avatar Feb 27 '21 07:02 uqix

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.

gavlyukovskiy avatar Mar 04 '21 10:03 gavlyukovskiy