opentracing-contrib / java-jdbc

OpenTracing Instrumentation for JDBC
Apache License 2.0
82 stars 56 forks source link

Created an interface for TracingConnection, to allow checking whether a connection is wrapped. #67

Closed RutgerLubbers closed 4 years ago

RutgerLubbers commented 4 years ago

Created an interface for TracingConnection, renamed old class (with same name) into TracingConnectionWrapper.

This allows checking whether a connection has already been wrapped. And prevents an exception with (at least) the Oracle JDBC driver, where the isWrapperFor method only accepts interfaces.

After this opentracing-contrib/java-spring-cloud should be adepted to use this code.

coveralls commented 4 years ago

Pull Request Test Coverage Report for Build 239


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/main/java/io/opentracing/contrib/jdbc/TracingDataSource.java 1 2 50.0%
src/main/java/io/opentracing/contrib/jdbc/TracingConnectionWrapper.java 25 97 25.77%
<!-- Total: 27 100 27.0% -->
Totals Coverage Status
Change from base Build 238: 0.0%
Covered Lines: 449
Relevant Lines: 967

💛 - Coveralls
malafeev commented 4 years ago

@RutgerLubbers if TracingConnection is created as proxy:

Connection tracingConnection = WrapperProxy
        .wrap(connection, new TracingConnection(connection, connectionInfo, withActiveSpanOnly,
            ignoreStatements, tracer))

Does it have the same issue? Creating proxy connection is more correct way than direct constructor to avoid issues with casting to real connection class. cc @safris

malafeev commented 4 years ago

not needed