wu-sheng commented on issue #4700:
URL: https://github.com/apache/skywalking/issues/4700#issuecomment-618880000


   This is the slow sql check codes, you could check whether your span matches 
it.
   
   ```java
              for (KeyStringValuePair tag : span.getTagsList()) {
                   if (SpanTags.DB_STATEMENT.equals(tag.getKey())) {
                       String sqlStatement = tag.getValue();
                       if (StringUtil.isEmpty(sqlStatement)) {
                           statement.setStatement("[No statement]/" + 
sourceBuilder.getDestEndpointName());
                       } else if (sqlStatement.length() > 
config.getMaxSlowSQLLength()) {
                           statement.setStatement(sqlStatement.substring(0, 
config.getMaxSlowSQLLength()));
                       } else {
                           statement.setStatement(sqlStatement);
                       }
                   } else if (SpanTags.DB_TYPE.equals(tag.getKey())) {
                       String dbType = tag.getValue();
                       DBLatencyThresholdsAndWatcher thresholds = 
config.getDbLatencyThresholdsAndWatcher();
                       int threshold = thresholds.getThreshold(dbType);
                       if (sourceBuilder.getLatency() > threshold) {
                           isSlowDBAccess = true;
                       }
                   }
               }
   
               if (isSlowDBAccess) {
                   slowDatabaseAccesses.add(statement);
               }
   ```


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