Add log sizes tool

This commit is contained in:
Joseph Schorr 2014-09-16 00:18:28 -04:00
parent bdbfb0c6d3
commit 820d5c0476

20
tools/logsize.py Normal file
View file

@ -0,0 +1,20 @@
import logging
import json
import numpy
from app import app, storage as store
storage = store._storages['s3_us_east_1']
storage._initialize_cloud_conn()
sizes = []
for key in storage._cloud_bucket.list('logarchive'):
sizes.append(key.size)
array = numpy.array(sizes)
print 'Max: %s' % max(sizes)
print 'Min: %s' % min(sizes)
print 'Avg: %s' % (float(sum(sizes))/len(sizes))
print 'Median: %s' % numpy.median(array)
print 'Std: %s' % numpy.std(array)
print 'Percent <= 64k: %s' % (float(len([entry for entry in sizes if entry <= 64000]))/len(sizes))