maedhroz commented on a change in pull request #1329:
URL: https://github.com/apache/cassandra/pull/1329#discussion_r752400159



##########
File path: src/java/org/apache/cassandra/service/StorageProxy.java
##########
@@ -2455,6 +2466,17 @@ protected void runMayThrow() throws Exception
         abstract protected void runMayThrow() throws Exception;
     }
 
+    public static void logRequestException(Exception exception, Collection<? 
extends ReadCommand> commands)
+    {
+        NoSpamLogger.log(logger, NoSpamLogger.Level.INFO, 
FAILURE_LOGGING_INTERVAL_SECONDS, TimeUnit.SECONDS,
+                         REQUEST_FAIL_MESSAGE,
+                         () -> new Object[]
+                               {
+                                   exception.getMessage(),
+                                   
commands.stream().map(ReadCommand::toCQLString).collect(Collectors.joining("; 
"))

Review comment:
       The typical output looks something like this:
   
   ```
   INFO  [node1_isolatedExecutor:1] node1 2021-11-18 10:05:26,416 
NoSpamLogger.java:105 - "Cannot achieve consistency level ALL" while executing 
SELECT * FROM distributed_test_keyspace.tbl ALLOW FILTERING
   ```
   
   With multiple commands...
   
   ```
   INFO  [node1_isolatedExecutor:1] node1 2021-11-18 10:05:26,416 
NoSpamLogger.java:105 - "Cannot achieve consistency level ALL" while executing 
SELECT * FROM distributed_test_keyspace.tbl WHERE id = 55 ALLOW FILTERING; 
SELECT * FROM distributed_test_keyspace.tbl WHERE id = 56 ALLOW FILTERING; 
SELECT * FROM distributed_test_keyspace.tbl WHERE id = 57 ALLOW FILTERING
   ```
   
   I really have no preference in terms of how we separate them, given it 
shouldn't be that common to have a group anyway. I'll change it if you and 
@yifan-c are in agreement.

##########
File path: src/java/org/apache/cassandra/service/StorageProxy.java
##########
@@ -162,6 +164,9 @@
     private static final Logger logger = 
LoggerFactory.getLogger(StorageProxy.class);
 
     public static final String UNREACHABLE = "UNREACHABLE";
+    
+    public static final String REQUEST_FAIL_MESSAGE = "\"{}\" while executing 
{}";
+    private static final int FAILURE_LOGGING_INTERVAL_SECONDS = 
Integer.getInteger("cassandra.request_failure_log_interval_seconds", 60);

Review comment:
       Done.




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

To unsubscribe, e-mail: [email protected]

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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to