完善页面
This commit is contained in:
@@ -68,6 +68,32 @@ def setup_routes(app, query_log_collector):
|
||||
return render_template('redis_test.html')
|
||||
|
||||
# 基础API
|
||||
@app.route('/api/health')
|
||||
def health_check():
|
||||
"""健康检查端点,用于Docker健康检查和服务监控"""
|
||||
try:
|
||||
# 检查应用基本状态
|
||||
current_time = datetime.now().isoformat()
|
||||
|
||||
# 简单的数据库连接检查(可选)
|
||||
from .database import ensure_database
|
||||
db_status = ensure_database()
|
||||
|
||||
return jsonify({
|
||||
'status': 'healthy',
|
||||
'timestamp': current_time,
|
||||
'service': 'BigDataTool',
|
||||
'version': '2.0',
|
||||
'database': 'ok' if db_status else 'warning'
|
||||
})
|
||||
except Exception as e:
|
||||
logger.error(f"健康检查失败: {str(e)}")
|
||||
return jsonify({
|
||||
'status': 'unhealthy',
|
||||
'error': str(e),
|
||||
'timestamp': datetime.now().isoformat()
|
||||
}), 503
|
||||
|
||||
@app.route('/api/default-config')
|
||||
def get_default_config():
|
||||
return jsonify(DEFAULT_CONFIG)
|
||||
|
Reference in New Issue
Block a user