Patrick0308 commented on a change in pull request #5109:
URL: https://github.com/apache/skywalking/pull/5109#discussion_r456179614



##########
File path: 
apm-sniffer/apm-sdk-plugin/mysql-common/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/PreparedStatementExecuteMethodsInterceptor.java
##########
@@ -40,15 +40,14 @@
     public final void beforeMethod(EnhancedInstance objInst, Method method, 
Object[] allArguments,
                                    Class<?>[] argumentsTypes, 
MethodInterceptResult result) {
         StatementEnhanceInfos cacheObject = (StatementEnhanceInfos) 
objInst.getSkyWalkingDynamicField();
-        ConnectionInfo connectInfo = cacheObject.getConnectionInfo();
         /**
          * For avoid NPE. In this particular case, Execute sql inside the 
{@link com.mysql.jdbc.ConnectionImpl} constructor,
          * before the interceptor sets the connectionInfo.
-         *
+         * Fixed https://github.com/apache/skywalking/issues/4965. When 
invoking prepareCall, cacheObject is null. Because it will determine 
procedures's parameter types by querying the table of proc in mysql.

Review comment:
       When invoking prepareCall, it will determine procedures's parameter 
types by execute sql.` StatementEnhanceInfos` is set after prepareCall, so 
`cacheObject is` null in 
`PreparedStatementExecuteMethodsInterceptor.beforeMethod`. 
   If we don't need to record the sql which determine procedures's parameter 
types when invoking prepareCall, we can skip it.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to