-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for statement interceptors #23
Comments
Hi! Sorry for the delayed answer. Currently there's no support for interceptors at the statement level. If you implement your own I'll consider adding this in a future version, but I'd like to know more about your specific use case. Perhaps there's an even better way to support what you need to do? |
The idea behind this is to measure the execution time of SQL basically for tracing purposes. |
OK, then you might be happy to find out that Dalesbred already logs all queries. You just have to bump up the log level of |
Tracing db call means to instrument dalesbred for Spring Cloud Sleuth (distributed tracing system) or any Distributed tracing system like htrace, pinpoint, xtrace. |
Right, I suspected something like this. This is not prettiest solution, but you should be able to write your own java.util.logging.Handler to get callbacks whenever Dalesbred logs the queries. You could then parse the time and SQL from the message and forward them to your tracing framework. Of course a real callback would be nicer in the future, but this would be something you can do today. As a related note, it would be nice to have a JDBC-driver that would adapt other JDBC-drivers and add features like tracing or simulated extra latency etc. Then you could use that with any persistence framework to diagnose and test your system. But I don't believe such a thing exists. :( |
java.util.logging.Handler will not solve the purpose. Yes, Driver/DataSource level support is something which is more elegant as well as complex to maintain and test. Appreciate for your help. |
I am curious to know if this API can provide interceptor support. I want to execute some piece of code before and after every jdbc query. The support I am thinking of is the one provided by MySQL (StatementInterceptor).
Can I expect something similar to it in future?
The text was updated successfully, but these errors were encountered: