yannbriancon / spring-hibernate-query-utils

Library giving tools to detect N+1 queries and count the queries generated with Spring and Hibernate
MIT License
135 stars 15 forks source link

Add enabled property for N+1 detection #13

Closed ekennedy247 closed 4 years ago

ekennedy247 commented 4 years ago

Didn't see any contribution guidelines, so hopefully unsolicited PRs are ok!

Sometimes you might want to only enable the N+1 detection in some environments (one example would be in adding this to a legacy codebase where logging every N+1 would be a lot of log messages in prod). Adding a property is a simple way to do it. For property naming, I went with this flat version, but I could see hibernate.query.interceptor.n-plus-one-detection.enabled as more clear, but up to you how you want to break these up.

Happy to discuss this more or explore other approaches!

yannbriancon commented 4 years ago

Hello @ekennedy247

Thanks for your contribution! It is greatly appreciated of course!

We can merge your proposal, anyway I am going to rename the property to avoid confusion with hibernate owned properties.