def sandesh_msg_stats_handle_request(self, sandesh_req):
     sandesh_msg_stats = self._sandesh.msg_stats()
     msg_type_stats = sandesh_msg_stats.message_type_stats()
     msg_stats_list = []
     for msg_type, stats in msg_type_stats.iteritems():
         mtype_stat = SandeshMessageTypeStats(msg_type, stats)
         msg_stats_list.append(mtype_stat)
     gen_stats = SandeshGeneratorStats()
     gen_stats.type_stats = msg_stats_list
     gen_stats.aggregate_stats = sandesh_msg_stats.aggregate_stats()
     client = self._sandesh.client()
     session_close_interval_msec = client.session_close_interval_msec()
     session_close_timestamp = client.session_close_time_usec()
     connection = client.connection()
     sending_level = None
     send_queue_stats = None
     if connection and connection.session():
         session = connection.session()
         squeue = session.send_queue()
         send_queue_stats = SandeshQueueStats()
         send_queue_stats.enqueues = \
             squeue.num_enqueues()
         send_queue_stats.count = \
             squeue.num_enqueues() - squeue.num_dequeues()
         send_queue_stats.max_count = squeue.max_qlen()
         sending_level = SandeshLevel._VALUES_TO_NAMES[\
                 session.send_level()]
     stats_resp = SandeshMessageStatsResp(stats=gen_stats,
         sending_level=sending_level,
         send_queue_stats=send_queue_stats,
         session_close_interval_msec=session_close_interval_msec,
         session_close_timestamp=session_close_timestamp)
     stats_resp.response(sandesh_req.context(), sandesh=self._sandesh)
Beispiel #2
0
    def sandesh_stats_handle_request(self, sandesh_req):
        sandesh_stats = self._sandesh.stats()
        stats_map = sandesh_stats.stats_map()
        stats_list = []
        for sandesh_name, stats in stats_map.iteritems():
            msg_stat = SandeshMessageStats(stats.tx_count, stats.tx_bytes,
                                           stats.rx_count, stats.rx_bytes)
            mtype_stat = SandeshMessageTypeStats(sandesh_name, msg_stat)
            stats_list.append(mtype_stat)

        gen_stats = SandeshGeneratorStats()
        gen_stats.type_stats = stats_list
        gen_stats.aggregate_stats = SandeshMessageStats()
        gen_stats.aggregate_stats.messages_sent = sandesh_stats._sandesh_sent
        gen_stats.aggregate_stats.bytes_sent = sandesh_stats._bytes_sent
        gen_stats.aggregate_stats.messages_received = \
            sandesh_stats._sandesh_received
        gen_stats.aggregate_stats.bytes_received = \
            sandesh_stats._bytes_received
        connection = self._sandesh.client().connection()
        if connection and connection.session():
            session = connection.session()
            squeue = session.send_queue()
            send_queue_stats = SandeshQueueStats()
            send_queue_stats.enqueues = \
                squeue.num_enqueues()
            send_queue_stats.count = \
                squeue.num_enqueues() - squeue.num_dequeues()
            gen_stats.send_queue_stats = send_queue_stats
        stats_resp = SandeshMessageStatsResp(gen_stats)
        stats_resp.response(sandesh_req.context())
    def sandesh_stats_handle_request(self, sandesh_req):
        sandesh_stats = self._sandesh.stats()
        stats_map = sandesh_stats.stats_map()
        stats_list = []
        for sandesh_name, stats in stats_map.iteritems():
            msg_stat = SandeshMessageStats(stats.tx_count,
                                           stats.tx_bytes,
                                           stats.rx_count,
                                           stats.rx_bytes)
            mtype_stat = SandeshMessageTypeStats(sandesh_name,
                                                 msg_stat)
            stats_list.append(mtype_stat)

        gen_stats = SandeshGeneratorStats()
        gen_stats.type_stats = stats_list
        gen_stats.aggregate_stats = SandeshMessageStats()
        gen_stats.aggregate_stats.messages_sent = sandesh_stats._sandesh_sent
        gen_stats.aggregate_stats.bytes_sent = sandesh_stats._bytes_sent
        gen_stats.aggregate_stats.messages_received = \
            sandesh_stats._sandesh_received
        gen_stats.aggregate_stats.bytes_received = \
            sandesh_stats._bytes_received
        connection = self._sandesh.client().connection()
        if connection and connection.session():
            session = connection.session()
            squeue = session.send_queue()
            send_queue_stats = SandeshQueueStats()
            send_queue_stats.enqueues = \
                squeue.num_enqueues()
            send_queue_stats.count = \
                squeue.num_enqueues() - squeue.num_dequeues()
            gen_stats.send_queue_stats = send_queue_stats
        stats_resp = SandeshMessageStatsResp(gen_stats)
        stats_resp.response(sandesh_req.context())
Beispiel #4
0
 def sandesh_msg_stats_handle_request(self, sandesh_req):
     sandesh_msg_stats = self._sandesh.msg_stats()
     msg_type_stats = sandesh_msg_stats.message_type_stats()
     msg_stats_list = []
     for msg_type, stats in msg_type_stats.items():
         mtype_stat = SandeshMessageTypeStats(msg_type, stats)
         msg_stats_list.append(mtype_stat)
     gen_stats = SandeshGeneratorStats()
     gen_stats.type_stats = msg_stats_list
     gen_stats.aggregate_stats = sandesh_msg_stats.aggregate_stats()
     client = self._sandesh.client()
     session_close_interval_msec = client.session_close_interval_msec()
     session_close_timestamp = client.session_close_time_usec()
     connection = client.connection()
     sending_level = None
     send_queue_stats = None
     if connection and connection.session():
         session = connection.session()
         squeue = session.send_queue()
         send_queue_stats = SandeshQueueStats()
         send_queue_stats.enqueues = \
             squeue.num_enqueues()
         send_queue_stats.count = \
             squeue.num_enqueues() - squeue.num_dequeues()
         send_queue_stats.max_count = squeue.max_qlen()
         sending_level = SandeshLevel._VALUES_TO_NAMES[\
                 session.send_level()]
     stats_resp = SandeshMessageStatsResp(stats=gen_stats,
         sending_level=sending_level,
         send_queue_stats=send_queue_stats,
         session_close_interval_msec=session_close_interval_msec,
         session_close_timestamp=session_close_timestamp)
     stats_resp.response(sandesh_req.context(), sandesh=self._sandesh)
 def sandesh_msg_stats_handle_request(self, sandesh_req):
     sandesh_msg_stats = self._sandesh.msg_stats()
     msg_type_stats = sandesh_msg_stats.message_type_stats()
     msg_stats_list = []
     for msg_type, stats in msg_type_stats.iteritems():
         mtype_stat = SandeshMessageTypeStats(msg_type, stats)
         msg_stats_list.append(mtype_stat)
     gen_stats = SandeshGeneratorStats()
     gen_stats.type_stats = msg_stats_list
     gen_stats.aggregate_stats = sandesh_msg_stats.aggregate_stats()
     connection = self._sandesh.client().connection()
     if connection and connection.session():
         session = connection.session()
         squeue = session.send_queue()
         send_queue_stats = SandeshQueueStats()
         send_queue_stats.enqueues = \
             squeue.num_enqueues()
         send_queue_stats.count = \
             squeue.num_enqueues() - squeue.num_dequeues()
         gen_stats.send_queue_stats = send_queue_stats
     stats_resp = SandeshMessageStatsResp(gen_stats)
     stats_resp.response(sandesh_req.context(), sandesh=self._sandesh)
 def sandesh_msg_stats_handle_request(self, sandesh_req):
     sandesh_msg_stats = self._sandesh.msg_stats()
     msg_type_stats = sandesh_msg_stats.message_type_stats()
     msg_stats_list = []
     for msg_type, stats in msg_type_stats.iteritems():
         mtype_stat = SandeshMessageTypeStats(msg_type, stats)
         msg_stats_list.append(mtype_stat)
     gen_stats = SandeshGeneratorStats()
     gen_stats.type_stats = msg_stats_list
     gen_stats.aggregate_stats = sandesh_msg_stats.aggregate_stats()
     connection = self._sandesh.client().connection()
     if connection and connection.session():
         session = connection.session()
         squeue = session.send_queue()
         send_queue_stats = SandeshQueueStats()
         send_queue_stats.enqueues = \
             squeue.num_enqueues()
         send_queue_stats.count = \
             squeue.num_enqueues() - squeue.num_dequeues()
         gen_stats.send_queue_stats = send_queue_stats
     stats_resp = SandeshMessageStatsResp(gen_stats)
     stats_resp.response(sandesh_req.context())