You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2021/11/18 16:12:43 UTC

[GitHub] [cassandra] maedhroz commented on a change in pull request #1329: CASSANDRA-17159 Log queries that fail on timeout or unavailable errors up to once per minute by default

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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org