Lazyboy 0.7.5 (which I just released) has a pretty great new feature, debug tracing. This is a great way to see what your application is doing and how long it takes. Using the debug trace facility is simple:
import lazyboy as lzb lzb.add_pool('Keyspace', servers=['127.0.0.1:9160'], debug=True, slow_thresh=100) conn = lzb.get_pool('Keyspace')
What this does is return a connection object with tracing enabled. Every call made to Cassandra will be logged at the DEBUG level, and any call which takes longer than slow_thresh milliseconds will be logged at the WARNING level. When you use Lazyboy, you’ll see logs in this form:
lzb.slice_iterator(lzb.Key("Keyspace", "ColumnFamily", "RowKey"), count=1) # -> DEBUG:DebugTraceClient:72ms: 127.0.0.1:9160 -> get_slice(('Keyspace', 'RowKey', {'column_family': 'ColumnFamily', 'keyspace': 'Keyspace', 'super_column': None, 'key': 'RowKey'}, SlicePredicate(column_names=None, slice_range=SliceRange(count=1, start='', reversed=False, finish='')), 1), {}) lzb.slice_iterator(lzb.Key("Keyspace", "ColumnFamily", "RowKey")) # -> WARNING:DebugTraceClient:861ms: 127.0.0.1:9160 -> get_slice(('Keyspace', 'RowKey', {'column_family': 'ColumnFamily', 'keyspace': 'Keyspace', 'super_column': None, 'key': 'RowKey'}, SlicePredicate(column_names=None, slice_range=SliceRange(count=10000, start='', reversed=False, finish='')), 1), {})
This should be pretty self-explanatory. You can see what calls were made to the Thrift client, the exact arguments, and how long it took. If you’d like to use a custom logger, you can pass a logging instance in the log keyword:
import logging lzb.add_pool('Keyspace', servers=['127.0.0.1:9160'], debug=True, slow_thresh=100, log=logging.getLogger('Lazyboy')) conn = lzb.get_pool('Keyspace')
You might want to do this to enable debugging, since the default logger configuration is set higher than DEBUG.