class StatsHandler(RequestHandler):
    def initialize(self, pika_client):
        self.pika_client = pika_client
        self.memory_stats = MemoryStats()

    def get(self, type_stats='default'):
        self.clear()
        self.set_header("Content-Type", "text/plain")
        self.set_status(200)
        if type_stats == 'debug':
            self.finish("uptime_seconds: " + str(self.pika_client.get_uptime()) +
                        "\n memory_use_byte: " + str(int(self.memory_stats.memory())) +
                        "\n memory_resident_use_byte: " + str(int(self.memory_stats.resident())) +
                        "\n memory_stack_size_byte: " + str(int(self.memory_stats.stacksize())) +
                        "\n last_rabbitmq_reconnect: " + str(self.pika_client.get_last_reconnect()) +
                        "\n connect_rabbitmq_time_seconds: " + str((now() - self.pika_client.get_last_reconnect()).seconds) +
                        "\n connects: " + str(self.pika_client.get_event_listeners_count()) +
                        "\n channel_count: " + str(len(self.pika_client.get_subscribe_channels())) +
                        "\n channels: " + str(self.pika_client.get_subscribe_channels()))
        else:
            self.finish("uptime_seconds: " + str(self.pika_client.get_uptime()) +
                        "\n memory_use_byte: " + str(int(self.memory_stats.memory())) +
                        "\n memory_resident_use_byte: " + str(int(self.memory_stats.resident())) +
                        "\n memory_stack_size_byte: " + str(int(self.memory_stats.stacksize())) +
                        "\n last_rabbitmq_reconnect: " + str(self.pika_client.get_last_reconnect()) +
                        "\n connect_rabbitmq_time_seconds: " + str((now() - self.pika_client.get_last_reconnect()).seconds) +
                        "\n connects: " + str(self.pika_client.get_event_listeners_count()) +
                        "\n channel_count: " + str(len(self.pika_client.get_subscribe_channels())))
class StatsHandler(RequestHandler):

    def initialize(self, sockjs_server):
        self.sockjs_server = sockjs_server
        self.memory_stats = MemoryStats()
        self.redis = redis_client

    def get(self, type_stats='default'):
        self.clear()
        self.set_header("Content-Type", "text/plain")
        self.set_status(200)
        if type_stats == 'debug':
            self.finish("uptime_seconds: " + str(self.sockjs_server.get_uptime()) +
                        "\n memory_use_byte: " + str(int(self.memory_stats.memory())) +
                        "\n memory_resident_use_byte: " + str(int(self.memory_stats.resident())) +
                        "\n memory_stack_size_byte: " + str(int(self.memory_stats.stacksize())) +
                        "\n last_rabbitmq_reconnect: " + str(self.sockjs_server.get_last_reconnect()) +
                        "\n connect_rabbitmq_time_seconds: " + str((now() - self.sockjs_server.get_last_reconnect()).seconds) +
                        "\n event_listeners_count: " + str(self.sockjs_server.get_event_listeners_count()) +
                        "\n connects: " + str(self.sockjs_server.get_subscribe_connections()) +
                        "\n redis_connect_tries: %s" % (self.redis.connect_tries) +
                        "\n redis_uptime_seconds %s" % (self.redis.get_uptime()))
        else:
            self.finish("uptime_seconds: " + str(self.sockjs_server.get_uptime()) +
                        "\n memory_use_byte: " + str(int(self.memory_stats.memory())) +
                        "\n memory_resident_use_byte: " + str(int(self.memory_stats.resident())) +
                        "\n memory_stack_size_byte: " + str(int(self.memory_stats.stacksize())) +
                        "\n last_rabbitmq_reconnect: " + str(self.sockjs_server.get_last_reconnect()) +
                        "\n connect_rabbitmq_time_seconds: " + str((now() - self.sockjs_server.get_last_reconnect()).seconds) +
                        "\n event_listeners_count: " + str(self.sockjs_server.get_event_listeners_count()) +
                        "\n connects: " + str(len(self.sockjs_server.get_subscribe_connections())) +
                        "\n redis_connect_tries: %s" % (self.redis.connect_tries) +
                        "\n redis_uptime_seconds %s" % (self.redis.get_uptime()))
Пример #3
0
class StatsHandler(RequestHandler):

    def initialize(self, sockjs_server):
        self.sockjs_server = sockjs_server
        self.memory_stats = MemoryStats()
        self.redis = redis_client

    def get(self, type_stats='default'):
        self.clear()
        self.set_header("Content-Type", "text/plain")
        self.set_status(200)
        if type_stats == 'debug':
            self.finish("uptime_seconds: " + str(self.sockjs_server.get_uptime()) +
                        "\n memory_use_byte: " + str(int(self.memory_stats.memory())) +
                        "\n memory_resident_use_byte: " + str(int(self.memory_stats.resident())) +
                        "\n memory_stack_size_byte: " + str(int(self.memory_stats.stacksize())) +
                        "\n last_rabbitmq_reconnect: " + str(self.sockjs_server.get_last_reconnect()) +
                        "\n connect_rabbitmq_time_seconds: " + str((now() - self.sockjs_server.get_last_reconnect()).seconds) +
                        "\n event_listeners_count: " + str(self.sockjs_server.get_event_listeners_count()) +
                        "\n connects: " + str(self.sockjs_server.get_subscribe_connections()) +
                        "\n redis_connect_tries: %s" % (self.redis.connect_tries) +
                        "\n redis_uptime_seconds %s" % (self.redis.get_uptime()))
        else:
            self.finish("uptime_seconds: " + str(self.sockjs_server.get_uptime()) +
                        "\n memory_use_byte: " + str(int(self.memory_stats.memory())) +
                        "\n memory_resident_use_byte: " + str(int(self.memory_stats.resident())) +
                        "\n memory_stack_size_byte: " + str(int(self.memory_stats.stacksize())) +
                        "\n last_rabbitmq_reconnect: " + str(self.sockjs_server.get_last_reconnect()) +
                        "\n connect_rabbitmq_time_seconds: " + str((now() - self.sockjs_server.get_last_reconnect()).seconds) +
                        "\n event_listeners_count: " + str(self.sockjs_server.get_event_listeners_count()) +
                        "\n connects: " + str(len(self.sockjs_server.get_subscribe_connections())) +
                        "\n redis_connect_tries: %s" % (self.redis.connect_tries) +
                        "\n redis_uptime_seconds %s" % (self.redis.get_uptime()))
 def initialize(self, pika_client):
     self.pika_client = pika_client
     self.memory_stats = MemoryStats()
 def initialize(self, sockjs_server):
     self.sockjs_server = sockjs_server
     self.memory_stats = MemoryStats()
     self.redis = redis_client
Пример #6
0
 def initialize(self, pika_client):
     self.pika_client = pika_client
     self.redis = redis_client
     self.memory_stats = MemoryStats()
Пример #7
0
 def initialize(self, sockjs_server):
     self.sockjs_server = sockjs_server
     self.memory_stats = MemoryStats()
     self.redis = redis_client