Ejemplo n.º 1
0
def dump_summary(info, label):
    print "-- %s by operation by cell by platform --" % (label,)
    p = prettytable.PrettyTable(["Operation", "Cell", "Platform", "Count",
                                 "Min", "Max", "Avg"])
    for c in ["Count", "Min", "Max", "Avg"]:
        p.align[c] = 'r'

    total = 0
    op_totals = {}
    cell_totals = {}
    platform_totals = {}
    for key, count in info.iteritems():
        operation, platform, cell = key
        readable = image_type.readable(platform)
        text = "n/a"
        if readable:
            text = ", ".join(readable)

        _min, _max, _count, _total = durations[key]
        _avg = float(_total) / float(_count)
        _fmin = dt.sec_to_str(_min)
        _fmax = dt.sec_to_str(_max)
        _favg = dt.sec_to_str(_avg * 100.0)

        op_totals[operation] = op_totals.get(operation, 0) + count
        cell_totals[cell] = cell_totals.get(cell, 0) + count
        platform_totals[text] = platform_totals.get(text, 0) + count

        p.add_row([operation, cell, text, count, _fmin, _fmax, _favg])
        total += count
    p.sortby = 'Count'
    print p

    dump_breakdown(op_totals, "Total %s by Operation" % label)
    dump_breakdown(cell_totals, "Total %s by Cell" % label)
    dump_breakdown(platform_totals, "Total %s by Platform" % label)

    print

    return total
Ejemplo n.º 2
0
            if diff > 1800 and failure_type is None:
                failure_type = ">30"

            if failure_type:
                key = (operation, image_type_num, cell)
                failed_request = {}
                message = []  # For exception message masking
                req_list.append(req)
                instance_map[uuid] = req_list
                failed_request['req'] = req
                failed_request['uuid'] = uuid
                failed_request['tenant'] = tenant
                failed_request['duration'] = "%.2f minutes" % (diff/60)
                failed_request['operation'] = operation
                failed_request['platform'] = image_type.readable(image_type_num)
                tenant_issues[tenant] = tenant_issues.get(tenant, 0) + 1

                if err_id:
                    err = models.RawData.objects.get(id=err_id)
                    queue, body = json.loads(err.json)
                    payload = body['payload']

                    # Add error information to failed request report
                    failed_request['event_id'] = err.id
                    failed_request['tenant'] = err.tenant
                    failed_request['service'] = err.service
                    failed_request['host'] = err.host
                    failed_request['deployment'] = err.deployment.name
                    failed_request['event'] = err.event
                    failed_request['when'] = str(dt.dt_from_decimal(err.when))
Ejemplo n.º 3
0
            if diff > 1800 and failure_type is None:
                failure_type = ">30"

            if failure_type:
                key = (operation, image_type_num, cell)
                failed_request = {}
                message = []  # For exception message masking
                req_list.append(req)
                instance_map[uuid] = req_list
                failed_request['req'] = req
                failed_request['uuid'] = uuid
                failed_request['tenant'] = tenant
                failed_request['duration'] = "%.2f minutes" % (diff / 60)
                failed_request['operation'] = operation
                failed_request['platform'] = image_type.readable(
                    image_type_num)
                tenant_issues[tenant] = tenant_issues.get(tenant, 0) + 1

                if err_id:
                    err = models.RawData.objects.get(id=err_id)
                    queue, body = json.loads(err.json)
                    payload = body['payload']

                    # Add error information to failed request report
                    failed_request['event_id'] = err.id
                    failed_request['tenant'] = err.tenant
                    failed_request['service'] = err.service
                    failed_request['host'] = err.host
                    failed_request['deployment'] = err.deployment.name
                    failed_request['event'] = err.event
                    failed_request['when'] = str(dt.dt_from_decimal(err.when))
Ejemplo n.º 4
0
            if diff > 1800 and failure_type is None:
                failure_type = ">30"

            if failure_type:
                key = (operation, image_type_num, cell)
                failed_request = {}
                message = []  # For exception message masking
                req_list.append(req)
                instance_map[uuid] = req_list
                failed_request["req"] = req
                failed_request["uuid"] = uuid
                failed_request["tenant"] = tenant
                failed_request["duration"] = "%.2f minutes" % (diff / 60)
                failed_request["operation"] = operation
                failed_request["platform"] = image_type.readable(image_type_num)
                tenant_issues[tenant] = tenant_issues.get(tenant, 0) + 1

                if err_id:
                    err = models.RawData.objects.get(id=err_id)
                    queue, body = json.loads(err.json)
                    payload = body["payload"]

                    # Add error information to failed request report
                    failed_request["event_id"] = err.id
                    failed_request["tenant"] = err.tenant
                    failed_request["service"] = err.service
                    failed_request["host"] = err.host
                    failed_request["deployment"] = err.deployment.name
                    failed_request["event"] = err.event
                    failed_request["when"] = str(dt.dt_from_decimal(err.when))
Ejemplo n.º 5
0
        duration_total += diff
        durations[key] = (duration_min, duration_max, duration_count,
                          duration_total)

        if not failure_type:
            successes[key] = successes.get(key, 0) + 1
        else:
            req_list.append(req)
            instance_map[uuid] = req_list

            report.append('')
            report.append("------ %s ----------" % uuid)
            report.append("Req: %s" % req)
            report.append("Duration: %.2f minutes" % (diff / 60))
            report.append("Operation: %s" % operation)
            report.append("Platform: %s" % image_type.readable(image_type_num))
            failures[key] = failures.get(key, 0) + 1
            tenant_issues[tenant] = tenant_issues.get(tenant, 0) + 1

            if err_id:
                err = models.RawData.objects.get(id=err_id)
                queue, body = json.loads(err.json)
                payload = body['payload']
                
                report.append("Event ID: %s" % err.id)
                report.append("Tenant: %s" % err.tenant)
                report.append("Service: %s" % err.service)
                report.append("Host: %s" % err.host)
                report.append("Deployment: %s" % err.deployment.name)
                report.append("Event: %s" % err.event)
                report.append("When: %s" % dt.dt_from_decimal(err.when))
Ejemplo n.º 6
0
    def _test_readable_without_os_distro(self, value, image, os_type,
                                         os_distro):
        result = image_type.readable(value)

        self.assertEqual(result, [image, os_type])
Ejemplo n.º 7
0
            durations.get(key, (9999999, 0, 0, 0))
        duration_min = min(duration_min, diff)
        duration_max = max(duration_max, diff)
        duration_count += 1
        duration_total += diff
        durations[key] = (duration_min, duration_max, duration_count,
                          duration_total)

        if not report:
            successes[key] = successes.get(key, 0) + 1
        else:
            print "------", uuid, "----------"
            print "    Req:", req
            print "    Duration: %.2f minutes" % (diff / 60)
            print "    Operation:", operation
            print "    Platform:", image_type.readable(platform)
            cause = "> %d min" % (expiry / 60)
            failures[key] = failures.get(key, 0) + 1
            tenant_issues[tenant] = tenant_issues.get(tenant, 0) + 1

            if err:
                queue, body = json.loads(err.json)
                payload = body['payload']
                print "Error. EventID: %s, Tenant %s, Service %s, Host %s, "\
                      "Deployment %s, Event %s, When %s"\
                    % (err.id, err.tenant, err.service, err.host, 
                       err.deployment.name, 
                       err.event, dt.dt_from_decimal(err.when))
                exc = payload.get('exception')
                if exc:
                    # group the messages ...
Ejemplo n.º 8
0
    def _test_readable_without_os_distro(self, value, image, os_type, os_distro):
        result = image_type.readable(value)

        self.assertEqual(result, [image, os_type])