From 1c8afed7aade80441afd7f44b95478b64589747a Mon Sep 17 00:00:00 2001 From: Thomas Maddox Date: Fri, 13 Sep 2013 11:08:34 -0500 Subject: [PATCH] fixed request_id and added to pretty.py as well --- reports/error_details.py | 4 +--- reports/pretty.py | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/reports/error_details.py b/reports/error_details.py index 0842471..590f4b8 100644 --- a/reports/error_details.py +++ b/reports/error_details.py @@ -178,9 +178,7 @@ if __name__ == '__main__': uuid = uuid_dict['instance'] req_list = [] - for req_dict in inst_recs.get(uuid, []): - req = req_dict['request_id'] - + for req in inst_recs.get(uuid, []): raws = list(models.RawData.objects.filter(request_id=req) .exclude(event='compute.instance.exists') .values("id", "when", "routing_key", "old_state", diff --git a/reports/pretty.py b/reports/pretty.py index 654fc40..1303f5f 100644 --- a/reports/pretty.py +++ b/reports/pretty.py @@ -52,6 +52,21 @@ def make_report(yesterday=None, start_hour=0, hours=24, percentile=97, expiry = 60 * 60 # 1 hour cmds = ['create', 'rebuild', 'rescue', 'resize', 'snapshot'] + requests = models.RawData.objects.filter(when__gt=dstart, when__lte=dend)\ + .exclude(instance=None, + event='compute.instance.exists')\ + .values('request_id', 'instance')\ + .distinct() + inst_recs = {} + for request in requests: + uuid = request['instance'] + request_id = request['request_id'] + if uuid in inst_recs: + inst_recs[uuid].append(request_id) + else: + inst_recs[uuid] = [request_id] + + failures = {} # { key : {failure_type: count} } durations = {} attempts = {} @@ -59,14 +74,7 @@ def make_report(yesterday=None, start_hour=0, hours=24, percentile=97, for uuid_dict in updates: uuid = uuid_dict['instance'] - # All the unique Request ID's for this instance during that timespan. - reqs = models.RawData.objects.filter(instance=uuid, - when__gt=dstart, when__lte=dend) \ - .values('request_id').distinct() - - - for req_dict in reqs: - req = req_dict['request_id'] + for req in inst_recs.get(uuid, []): raws = models.RawData.objects.filter(request_id=req)\ .exclude(event='compute.instance.exists')\ .order_by('when')