# Health Base URL `https://api.sniphunter.com` 服务健康与依赖就绪。 # Health ## GET / Root ```json { "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } } } ``` ## GET /api/v1/health/ 基础健康检查 返回应用的基本健康状态信息,用于快速检测应用是否正常运行。 ```json { "responses": { "200": { "description": "应用健康", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HealthResponse" }, "example": { "status": "healthy", "version": "1.0.0", "timestamp": "2024-01-01T00:00:00Z" } } } } } } ``` ## GET /api/v1/health/detailed 详细健康检查 返回更详细的系统状态信息。 ```json { "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HealthResponse" } } } } } } ``` ## GET /api/v1/health/ready 就绪检查 检查所有依赖服务的连接状态,用于 Kubernetes 就绪探针。 返回各服务的状态: - **database**: PostgreSQL 数据库连接状态 - **redis**: Redis 缓存服务连接状态 ```json { "responses": { "200": { "description": "所有服务就绪", "content": { "application/json": { "schema": {}, "example": { "status": "ready", "checks": { "database": { "status": "healthy", "latency_ms": 5.23 }, "redis": { "status": "healthy", "latency_ms": 1.05 } }, "version": "1.0.0", "environment": "production", "timestamp": "2024-01-01T00:00:00Z" } } } }, "503": { "description": "服务未就绪", "content": { "application/json": { "example": { "status": "not_ready", "checks": { "database": { "status": "unhealthy", "error": "Connection refused" }, "redis": { "status": "healthy", "latency_ms": 1.05 } }, "version": "1.0.0", "environment": "production", "timestamp": "2024-01-01T00:00:00Z" } } } } } } ``` # Components ```json { "schemas": { "HealthResponse": { "properties": { "success": { "type": "boolean", "title": "Success", "description": "操作是否成功", "default": true }, "status": { "type": "string", "title": "Status", "description": "服务状态", "default": "healthy" }, "version": { "type": "string", "title": "Version", "description": "服务版本", "default": "1.0.0" }, "timestamp": { "type": "string", "title": "Timestamp", "description": "检查时间戳" } }, "type": "object", "required": [ "timestamp" ], "title": "HealthResponse", "description": "健康检查响应" } }, "securitySchemes": { "HTTPBearer": { "type": "http", "scheme": "bearer" } } } ```