fixes variable collision in stats system

This commit is contained in:
John Dickinson
2010-12-30 15:47:18 +00:00
committed by Tarmac
2 changed files with 7 additions and 4 deletions

View File

@@ -127,7 +127,8 @@ class AccessLogProcessor(object):
d['code'] = int(d['code']) d['code'] = int(d['code'])
return d return d
def process(self, obj_stream, account, container, object_name): def process(self, obj_stream, data_object_account, data_object_container,
data_object_name):
'''generate hourly groupings of data from one access log file''' '''generate hourly groupings of data from one access log file'''
hourly_aggr_info = {} hourly_aggr_info = {}
total_lines = 0 total_lines = 0
@@ -191,7 +192,8 @@ class AccessLogProcessor(object):
hourly_aggr_info[aggr_key] = d hourly_aggr_info[aggr_key] = d
if bad_lines > (total_lines * self.warn_percent): if bad_lines > (total_lines * self.warn_percent):
name = '/'.join([account, container, object_name]) name = '/'.join([data_object_account, data_object_container,
data_object_name])
self.logger.warning('I found a bunch of bad lines in %s '\ self.logger.warning('I found a bunch of bad lines in %s '\
'(%d bad, %d total)' % (name, bad_lines, total_lines)) '(%d bad, %d total)' % (name, bad_lines, total_lines))
return hourly_aggr_info return hourly_aggr_info

View File

@@ -22,10 +22,11 @@ class StatsLogProcessor(object):
def __init__(self, conf): def __init__(self, conf):
self.logger = get_logger(conf) self.logger = get_logger(conf)
def process(self, obj_stream, account, container, object_name): def process(self, obj_stream, data_object_account, data_object_container,
data_object_name):
'''generate hourly groupings of data from one stats log file''' '''generate hourly groupings of data from one stats log file'''
account_totals = {} account_totals = {}
year, month, day, hour, _ = object_name.split('/') year, month, day, hour, _ = data_object_name.split('/')
for line in obj_stream: for line in obj_stream:
if not line: if not line:
continue continue