Slow Query Logger

Description

It would be great if there was a way to log if a Cassandra query takes longer then a configured length of time.

E.g.

if (timeTakenMs >= slowQueryThresholdMs) { LOGGER.warn("Query took longer than configured threshold. Query: {}, time taken ms: {}, threshold ms: {}", query, timeTakenMs, slowQueryThresholdMs); } else { LOGGER.debug("Query executed. Query: {}, time taken ms: {}", query, timeTakenMs); }

The problem with doing this outside of the driver is that it may include any retries or connections.

Environment

None

Pull Requests

None

Activity

Show:

Andy Tolbert 
March 31, 2015 at 8:28 PM

The unit and integration test cases for this were very comprehensive. I added a few more and did some manual validation with a load test. Looks good to merge!

Olivier Michallat 
March 9, 2015 at 9:41 AM

The logger should emphasize queries that timed out. Clients needs to pay special attention to them as they mark the node down. See RequestHandler#onTimeout.

Olivier Michallat 
March 9, 2015 at 9:21 AM

Yes, this would be a very useful feature.
We have a couple of tickets in 2.0.10 that will help log statements better, so I'm tentatively adding this one as well.

Fixed

Details

Assignee

Reporter

Labels

Fix versions

Priority

Created February 2, 2015 at 11:34 AM
Updated May 4, 2015 at 5:50 PM
Resolved March 31, 2015 at 9:52 PM