wu-sheng commented on a change in pull request #5109:
URL: https://github.com/apache/skywalking/pull/5109#discussion_r456181153



##########
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.
          * @see JDBCDriverInterceptor#afterMethod(EnhancedInstance, Method, 
Object[], Class[], Object)
          */
-        if (connectInfo != null) {
-
+        if (cacheObject != null && cacheObject.getConnectionInfo() != null) {

Review comment:
       According to the codes here, if `cacheObject.getConnectionInfo() == 
null)`, no span will be generated. My previous question is about this, why?
   
   Also, on the existing codes, the check condition is different, 
https://github.com/apache/skywalking/blob/e7e72d937b769f40e50ec644a210bc497f2204f9/apm-sniffer/apm-sdk-plugin/mysql-common/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/PreparedStatementExecuteMethodsInterceptor.java#L75.
   
   I want to make sure what is the issue of that. Because all changes in the 
expectedData.yml seems not related to some parts of the change. 




----------------------------------------------------------------
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