gavlyukovskiy / spring-boot-data-source-decorator

Spring Boot integration with p6spy, datasource-proxy, flexy-pool and spring-cloud-sleuth
Apache License 2.0
840 stars 82 forks source link

Add metrics for SQL queries #17

Open gavlyukovskiy opened 6 years ago

uqix commented 3 years ago

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

gavlyukovskiy commented 3 years ago

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.