Add logging in jdbc instrumentation when we cannot unwrap connection
MODIFY
dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/ExceptionLogger.java
dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/ExceptionLogger.java
package datadog.trace.bootstrap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Class used for exception handler logging.
*
* <p>See datadog.trace.agent.tooling.ExceptionHandlers
*/
-public class ExceptionLogger {}
+public class ExceptionLogger {
+ public static final Logger LOGGER = LoggerFactory.getLogger(ExceptionLogger.class);
+}

MODIFY
dd-java-agent/instrumentation/jdbc/src/main/java/datadog/trace/instrumentation/jdbc/PreparedStatementInstrumentation.java
dd-java-agent/instrumentation/jdbc/src/main/java/datadog/trace/instrumentation/jdbc/PreparedStatementInstrumentation.java
@@ -14,6 +14,7 @@ import datadog.trace.agent.tooling.Instrumenter;
import datadog.trace.api.DDSpanTypes;
import datadog.trace.api.DDTags;
import datadog.trace.bootstrap.CallDepthThreadLocalMap;
+import datadog.trace.bootstrap.ExceptionLogger;
import datadog.trace.bootstrap.JDBCMaps;
import io.opentracing.Scope;
import io.opentracing.Span;
@@ -76,6 +77,7 @@ public final class PreparedStatementInstrumentation extends Instrumenter.Default
}
} catch (final Throwable e) {
// Had some problem getting the connection.
+ ExceptionLogger.LOGGER.debug("Could not get connection for PreparedStatementAdvice", e);
return NoopScope.INSTANCE;
}

MODIFY
dd-java-agent/instrumentation/jdbc/src/main/java/datadog/trace/instrumentation/jdbc/StatementInstrumentation.java
dd-java-agent/instrumentation/jdbc/src/main/java/datadog/trace/instrumentation/jdbc/StatementInstrumentation.java
@@ -14,6 +14,7 @@ import datadog.trace.agent.tooling.Instrumenter;
import datadog.trace.api.DDSpanTypes;
import datadog.trace.api.DDTags;
import datadog.trace.bootstrap.CallDepthThreadLocalMap;
+import datadog.trace.bootstrap.ExceptionLogger;
import datadog.trace.bootstrap.JDBCMaps;
import io.opentracing.Scope;
import io.opentracing.Span;
@@ -77,6 +78,7 @@ public final class StatementInstrumentation extends Instrumenter.Default {
}
} catch (final Throwable e) {
// Had some problem getting the connection.
+ ExceptionLogger.LOGGER.debug("Could not get connection for StatementAdvice", e);
return NoopScope.INSTANCE;
}

Add logging in jdbc instrumentation when we cannot unwrap connection