This project is a simple tool to measuring query counts in a JDBC API(Spring Data JPA(Hibernate), MyBatis, ...) environment.
You can seamlessly measure query counts also in a Multi-DataSource environment.
Hibernate:
select
id,
name
from
example
Hibernate:
select
count(id)
from
example
WARN [QueryCountLogger] - QueryCountPerRequest(apiUrl=GET /examples, totalQueryCount=2, totalQueryMilliSeconds=1)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.Hyeon9mak:multi-datasource-query-counter:1.0.1'
}
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
dependencies {
implementation("com.github.Hyeon9mak:multi-datasource-query-counter:1.0.1")
}
The priority order is as follows: error
> warn
> info
.
The default value for enable
is false
, and the default value for count
is 1
.
query-counter.logging.level:
error:
enable: true
count: 5
warn:
enable: true
count: 2
info:
enable: false
Start the application and check the log.
ERROR [QueryCountLogger] - QueryCountPerRequest(apiUrl=GET /examples, totalQueryCount=23, totalQueryMilliSeconds=1)
Enjoy it! 🎉
It's based on the JDBC API and Spring AOP, CGLib proxy.
That's it!
(WIP)