|
@@ -25,10 +25,8 @@ from entity import Error
|
|
|
import traceback
|
|
|
from util import insert_log, timetic
|
|
|
|
|
|
-from prometheus_fastapi_instrumentator import Instrumentator
|
|
|
import time
|
|
|
|
|
|
-from util.registry import AI_BOT_REQUEST_LATENCY
|
|
|
|
|
|
logger=get_logger("log")
|
|
|
|
|
@@ -37,6 +35,7 @@ app = FastAPI()
|
|
|
|
|
|
# 服务监控,qps,latent, cpu利用率
|
|
|
|
|
|
+from util.registry import AI_BOT_REQUEST_LATENCY
|
|
|
|
|
|
|
|
|
@app.post("/botservice")
|
|
@@ -92,6 +91,6 @@ def botservice(reqbot:reqRobot):
|
|
|
latency = (time.time() - start_time)
|
|
|
AI_BOT_REQUEST_LATENCY.labels(bid=bid).observe(latency)
|
|
|
|
|
|
-Instrumentator().instrument(app).expose(app)
|
|
|
+
|
|
|
if __name__ == '__main__':
|
|
|
uvicorn.run("AiBot:app", host='0.0.0.0', port=40072,workers=4)
|