def second_data_to_push_item(self, data, stat, timestamp, overall, case):
        """
        @data: SecondAggregateDataItem
        """
        api_data = {
            'overall': overall,
            'case': case,
            'net_codes': [],
            'http_codes': [],
            'time_intervals': [],
            'trail': {
                'time': str(timestamp),
                'reqps': stat["metrics"]["reqps"],
                'resps': data["interval_real"]["len"],
                'expect': data["interval_real"]["total"] / 1000.0 / data["interval_real"]["len"],
                'disper': 0,
                'self_load':
                    0,  # TODO abs(round(100 - float(data.selfload), 2)),
                'input': data["size_in"]["total"],
                'output': data["size_out"]["total"],
                'connect_time': data["connect_time"]["total"] / 1000.0 / data["connect_time"]["len"],
                'send_time':
                    data["send_time"]["total"] / 1000.0 / data["send_time"]["len"],
                'latency':
                    data["latency"]["total"] / 1000.0 / data["latency"]["len"],
                'receive_time': data["receive_time"]["total"] / 1000.0 / data["receive_time"]["len"],
                'threads': stat["metrics"]["instances"],  # TODO
            }
        }

        for q, value in zip(data["interval_real"]["q"]["q"],
                            data["interval_real"]["q"]["value"]):
            api_data['trail']['q' + str(q)] = value / 1000.0

        for code, cnt in data["net_code"]["count"].items():
            api_data['net_codes'].append({'code': int(code),
                                          'count': int(cnt)})

        for code, cnt in data["proto_code"]["count"].items():
            api_data['http_codes'].append({'code': int(code),
                                           'count': int(cnt)})

        api_data['time_intervals'] = self.convert_hist(data["interval_real"][
            "hist"])
        return api_data
def second_data_to_push_item ( self , data , stat , timestamp , overall , case ) : api_data = { 'overall' : overall , 'case' : case , 'net_codes' : [ ] , 'http_codes' : [ ] , 'time_intervals' : [ ] , 'trail' : { 'time' : str ( timestamp ) , 'reqps' : stat [ "metrics" ] [ "reqps" ] , 'resps' : data [ "interval_real" ] [ "len" ] , 'expect' : data [ "interval_real" ] [ "total" ] / 1000.0 / data [ "interval_real" ] [ "len" ] , 'disper' : 0 , 'self_load' : 0 , 'input' : data [ "size_in" ] [ "total" ] , 'output' : data [ "size_out" ] [ "total" ] , 'connect_time' : data [ "connect_time" ] [ "total" ] / 1000.0 / data [ "connect_time" ] [ "len" ] , 'send_time' : data [ "send_time" ] [ "total" ] / 1000.0 / data [ "send_time" ] [ "len" ] , 'latency' : data [ "latency" ] [ "total" ] / 1000.0 / data [ "latency" ] [ "len" ] , 'receive_time' : data [ "receive_time" ] [ "total" ] / 1000.0 / data [ "receive_time" ] [ "len" ] , 'threads' : stat [ "metrics" ] [ "instances" ] , } } for q , value in zip ( data [ "interval_real" ] [ "q" ] [ "q" ] , data [ "interval_real" ] [ "q" ] [ "value" ] ) : api_data [ 'trail' ] [ 'q' + str ( q ) ] = value / 1000.0 for code , cnt in data [ "net_code" ] [ "count" ] . items ( ) : api_data [ 'net_codes' ] . append ( { 'code' : int ( code ) , 'count' : int ( cnt ) } ) for code , cnt in data [ "proto_code" ] [ "count" ] . items ( ) : api_data [ 'http_codes' ] . append ( { 'code' : int ( code ) , 'count' : int ( cnt ) } ) api_data [ 'time_intervals' ] = self . convert_hist ( data [ "interval_real" ] [ "hist" ] ) return api_data
@data: SecondAggregateDataItem