Refactored TraceListenerStrategy to better track current scope in case multiple connections are used (#2053)

* Refactored TraceListenerStrategy to better track current scope in case multiple connections are used

Refactored remoteServiceName resolution logic to be easier to follow
Fixed TraceQueryExecutionListener#getConnection that leaks connection by acquiring (and not closing) additional connection from a DataSource

* Fixed checkstyle issues
This commit is contained in:
Arthur Gavlyukovskiy
2021-11-04 01:02:25 -07:00
committed by GitHub
parent 8562948697
commit f70cee7341
13 changed files with 218 additions and 257 deletions

View File

@@ -25,6 +25,7 @@ import org.apache.commons.logging.LogFactory;
* Container object for {@link Span} and its corresponding {@link Tracer.SpanInScope}.
*
* @author Marcin Grzejszczak
* @author Arthur Gavlyukovskiy
* @since 3.1.0
*/
public class SpanAndScope implements Closeable {
@@ -58,7 +59,9 @@ public class SpanAndScope implements Closeable {
if (log.isTraceEnabled()) {
log.trace("Closing span [" + this.span + "]");
}
this.scope.close();
if (this.scope != null) {
this.scope.close();
}
this.span.end();
}