Skip to content

Instantly share code, notes, and snippets.

@beltran
Created March 20, 2017 14:55
Show Gist options
  • Save beltran/a7dc23c2482670753c31d39ff21a1f4c to your computer and use it in GitHub Desktop.
Save beltran/a7dc23c2482670753c31d39ff21a1f4c to your computer and use it in GitHub Desktop.
from cassandra.cluster import Cluster
import logging
log = logging.getLogger()
log.setLevel('INFO')
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(name)s: %(message)s"))
log.addHandler(handler)
def check_trace(trace):
assert trace is not None
assert trace.request_type is not None
assert trace.started_at is not None
assert trace.coordinator is not None
assert trace.events is not None
cluster = Cluster(protocol_version=4)
session = cluster.connect()
count = 0
while 1:
result = session.execute("SELECT * FROM system.local", trace=True)
check_trace(result.get_query_trace())
count += 1
if not count % 1000:
print(count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment