DavidLiu 3 meses atrás
pai
commit
ea521a8956
2 arquivos alterados com 3 adições e 0 exclusões
  1. 1 0
      src/core/callcenter/registry.py
  2. 2 0
      src/core/voip/bot.py

+ 1 - 0
src/core/callcenter/registry.py

@@ -21,3 +21,4 @@ ESL_EVENT_LATENCY = Histogram('esl_event_latency', 'Esl Event latency in seconds
 ESL_EVENT_CALLBACK_LATENCY = Histogram('esl_event_callback_latency', 'Esl Event callback latency in seconds', ['eventName','callType'])
 
 FLASK_ACTIVE_THREADS = Gauge('flask_active_threads', 'Number of active threads')
+BOT_AGENT_LIVES = Gauge('bot_agent_lives', 'Number of active agents')

+ 2 - 0
src/core/voip/bot.py

@@ -11,6 +11,7 @@ import sys
 import pjsua2 as pj
 from enum import Enum
 
+from src.core.callcenter import registry
 from src.core.callcenter.cache import Cache
 from src.core.datasource import SIP_SERVER, SERVE_HOST
 from src.core.voip.constant import *
@@ -567,6 +568,7 @@ class BotAgent:
             self.release(user_part)
 
     def register(self, **kwargs):
+        registry.BOT_AGENT_LIVES.set(self.user_part_pool.qsize())
         user_part = self.user_part_pool.get()
         acc = self.accounts.get(user_part)
         self.logger.info('register, user_part :%d, pool.size :%d', user_part, self.user_part_pool.qsize())