Closed quaff closed 4 years ago
I suggest not try to deregister and register again because some drivers are one-off, leave it to the application to make sure TracingDriver is registered first since they must call setInterceptorMode(true) somewhere, for example before a servlet context initialized.
@Override public void contextInitialized(ServletContextEvent event) { io.opentracing.contrib.jdbc.TracingDriver.setInterceptorMode(true); } we could add an instruction in https://github.com/opentracing-contrib/java-jdbc#interceptor.
@quaff could you update README?
@malafeev README updated.
@malafeev all tests passed in local but failed with CI.
Tests run: 50, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.014 s
[INFO] Finished at: 2020-06-17T16:40:25+08:00
[INFO] ------------------------------------------------------------------------
I can't find a way to ensure TracingDriver
load before h2 driver in junit tests.
I'm thinking about adding second boolean parameter to TracingDriver.setInterceptorMode(...)
which should allow/disallow deregistering drivers.
hm, now I'm not sure that it will work.
I think we need a method in TracingDriver to allow user change registered drivers order so TracingDriver will be the first one and add javadoc that it will not work for some drivers like oracle.
I think we need a method in TracingDriver to allow user change registered drivers order so TracingDriver will be the first one and add javadoc that it will not work for some drivers like oracle.
It's a good idea, I will try.
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
src/main/java/io/opentracing/contrib/jdbc/TracingDriver.java | 9 | 12 | 75.0% | ||
<!-- | Total: | 9 | 12 | 75.0% | --> |
Files with Coverage Reduction | New Missed Lines | % | ||
---|---|---|---|---|
src/main/java/io/opentracing/contrib/jdbc/TracingDriver.java | 2 | 80.43% | ||
<!-- | Total: | 2 | --> |
Totals | |
---|---|
Change from base Build 260: | -0.2% |
Covered Lines: | 468 |
Relevant Lines: | 981 |
@malafeev Tests passed finally, please hold on, I will move that method from JdbcTest
to TracingDriver
.
@quaff great, please also update README
@malafeev please review code, especially english words and grammar.
My 2c: I'd avoid boolean parameters in public APIs and rather go with two distinct methods with speaking names. Internally, it's fine though.
I think we need a method in TracingDriver to allow user change registered drivers order so TracingDriver will be the first one and add javadoc that it will not work for some drivers like oracle.
Hello @malafeev Does that mean that the issue with Oracle driver will remain?
I think we need a method in TracingDriver to allow user change registered drivers order so TracingDriver will be the first one and add javadoc that it will not work for some drivers like oracle.
Hello @malafeev Does that mean that the issue with Oracle driver will remain?
If TracingDriver
is registered before oracle driver, everything is OK.
I think we need a method in TracingDriver to allow user change registered drivers order so TracingDriver will be the first one and add javadoc that it will not work for some drivers like oracle.
Hello @malafeev Does that mean that the issue with Oracle driver will remain?
If
TracingDriver
is registered before oracle driver, everything is OK.
Nice, @quaff . For the
I think we need a method in TracingDriver to allow user change registered drivers order so TracingDriver will be the first one and add javadoc that it will not work for some drivers like oracle.
Hello @malafeev Does that mean that the issue with Oracle driver will remain?
If
TracingDriver
is registered before oracle driver, everything is OK.
Thanks @quaff ,
So according to your PR:
https://github.com/opentracing-contrib/java-jdbc/commit/d84907e0b45339eccb7fd6e9e1436962937bd614,
by setting TracingDriver.ensureRegisteredAsTheFirstDriver()
along with TracingDriver.setInterceptorMode(true)
will provide the fix for drivers such as Oracle, right?
I asked because on your PR, the sentence on readme file: "Please note driver like Oracle JDBC may fail since it's destroyed forever after deregistration." gives the impression that this may not work with Oracle Driver.
I think we need a method in TracingDriver to allow user change registered drivers order so TracingDriver will be the first one and add javadoc that it will not work for some drivers like oracle.
Hello @malafeev Does that mean that the issue with Oracle driver will remain?
If
TracingDriver
is registered before oracle driver, everything is OK.Nice, @quaff . For the
I think we need a method in TracingDriver to allow user change registered drivers order so TracingDriver will be the first one and add javadoc that it will not work for some drivers like oracle.
Hello @malafeev Does that mean that the issue with Oracle driver will remain?
If
TracingDriver
is registered before oracle driver, everything is OK.Thanks @quaff , So according to your PR: d84907e, by setting
TracingDriver.ensureRegisteredAsTheFirstDriver()
along withTracingDriver.setInterceptorMode(true)
will provide the fix for drivers such as Oracle, right?I asked because on your PR, the sentence on readme file: "Please note driver like Oracle JDBC may fail since it's destroyed forever after deregistration." gives the impression that this may not work with Oracle Driver.
If TracingDriver
is registered after Oracle JDBC driver, then the interceptor mode
will not works but the driver works fine, if you call TracingDriver.ensureRegisteredAsTheFirstDriver()
then the driver will throw exception.
I think we need a method in TracingDriver to allow user change registered drivers order so TracingDriver will be the first one and add javadoc that it will not work for some drivers like oracle.
Hello @malafeev Does that mean that the issue with Oracle driver will remain?
If
TracingDriver
is registered before oracle driver, everything is OK.Nice, @quaff . For the
I think we need a method in TracingDriver to allow user change registered drivers order so TracingDriver will be the first one and add javadoc that it will not work for some drivers like oracle.
Hello @malafeev Does that mean that the issue with Oracle driver will remain?
If
TracingDriver
is registered before oracle driver, everything is OK.Thanks @quaff , So according to your PR: d84907e, by setting
TracingDriver.ensureRegisteredAsTheFirstDriver()
along withTracingDriver.setInterceptorMode(true)
will provide the fix for drivers such as Oracle, right? I asked because on your PR, the sentence on readme file: "Please note driver like Oracle JDBC may fail since it's destroyed forever after deregistration." gives the impression that this may not work with Oracle Driver.If
TracingDriver
is registered after Oracle JDBC driver, then theinterceptor mode
will not works but the driver works fine, if you callTracingDriver.ensureRegisteredAsTheFirstDriver()
then the driver will throw exception.
But if the interceptor mode
won't work with TracingDriver being registered after Oracle Driver, then it won't be possible to enable jdbc tracing with Oracle Driver, right?
it there is no way to load TracingDriver before Oracle then solution is don't use interceptor mode but use non-iterceptor. Non-interceptor mode should work fine.
it there is no way to load TracingDriver before Oracle then solution is don't use interceptor mode but use non-iterceptor. Non-interceptor mode should work fine.
As non-interceptor you mean, having TracingDriver.setInterceptorMode(false)
which is set by default?
I mean don't call TracingDriver.setInterceptorMode(...)
, instead use https://github.com/opentracing-contrib/java-jdbc#non-interceptor
I mean don't call
TracingDriver.setInterceptorMode(...)
, instead use https://github.com/opentracing-contrib/java-jdbc#non-interceptor
Thanks for the info, @malafeev . I'll wait for the release.
I've just tested and it seems to be working just fine. Thanks! 👍
some driver like oracle ojdbc will be destroyed forever after deregister. see https://github.com/opentracing-contrib/java-jdbc/issues/73