feat: upgrade客服多店铺分流、批量报价与稳定性防护
This commit is contained in:
@@ -275,6 +275,32 @@ def health_check():
|
||||
})
|
||||
|
||||
|
||||
@app.route('/api/metrics', methods=['GET'])
|
||||
def metrics_dashboard():
|
||||
"""
|
||||
运行与业务看板
|
||||
Query:
|
||||
- hours: 统计窗口小时数,默认24
|
||||
"""
|
||||
try:
|
||||
hours = int(request.args.get('hours', 24))
|
||||
if hours <= 0:
|
||||
hours = 24
|
||||
from utils.metrics_tracker import get_dashboard
|
||||
data = get_dashboard(hours=hours)
|
||||
return jsonify({
|
||||
'code': 200,
|
||||
'message': 'OK',
|
||||
'data': data,
|
||||
})
|
||||
except Exception as e:
|
||||
logger.error(f"指标看板异常:{e}")
|
||||
return jsonify({
|
||||
'code': 500,
|
||||
'message': f'服务器错误:{str(e)}'
|
||||
}), 500
|
||||
|
||||
|
||||
def start_http_server(host='0.0.0.0', port=6060, debug=False):
|
||||
"""启动 HTTP 服务器"""
|
||||
global task_manager, task_scheduler
|
||||
|
||||
Reference in New Issue
Block a user