余尚辉 2 months ago
parent
commit
a50a38c3f0
2 changed files with 3 additions and 2 deletions
  1. 2 1
      ai-slibra-assistant/api/AiBot.py
  2. 1 1
      ai-slibra-assistant/util/registry.py

+ 2 - 1
ai-slibra-assistant/api/AiBot.py

@@ -88,8 +88,9 @@ def botservice(reqbot:reqRobot):
         #del_cache(uid, bid, 'status', session_id)
         return ChatResponse(code=Error.error.value, message="internal error").to_json_string()
     finally:
+        print('ceshi')
         latency = (time.time() - start_time)
-        AI_BOT_REQUEST_LATENCY.labels(bid).observe(latency)
+        AI_BOT_REQUEST_LATENCY.labels(bid=bid).observe(latency)
 
 Instrumentator().instrument(app).expose(app)
 if __name__ == '__main__':

+ 1 - 1
ai-slibra-assistant/util/registry.py

@@ -1,2 +1,2 @@
 from prometheus_client import Counter,Histogram
-AI_BOT_REQUEST_LATENCY = Histogram('ai_bot_request_latency',  '文本机器人接口耗时',['bucket'])
+AI_BOT_REQUEST_LATENCY = Histogram('ai_bot_request_latency',  '文本机器人接口耗时',['bid'])