1.3 KiB
1.3 KiB
监控模块
概述
监控系统用于追踪系统运行状态、收集性能指标、检测异常并发送告警。
监控范围
系统监控
- CPU、内存、磁盘使用率
- 网络流量
- 进程状态
应用监控
- API响应时间
- 请求成功率
- 错误率
- 并发连接数
业务监控
- Agent运行状态
- 任务队列深度
- 知识库检索延迟
监控指标
位置:backend/app/monitoring/
| 指标 | 类型 | 说明 |
|---|---|---|
| http_requests_total | Counter | HTTP请求总数 |
| http_request_duration_seconds | Histogram | 请求延迟分布 |
| agent_tasks_total | Counter | Agent任务总数 |
| agent_task_duration_seconds | Histogram | 任务执行时间 |
| queue_depth | Gauge | 队列深度 |
健康检查
端点
| 路径 | 说明 |
|---|---|
| GET /health | 服务健康检查 |
| GET /health/ready | 就绪检查 |
| GET /health/live | 存活检查 |
检查项
- 数据库连接
- Redis连接
- 磁盘空间
- 内存使用率
告警规则
| 规则 | 条件 | 级别 |
|---|---|---|
| API响应超时 | p99 > 5s | Warning |
| API错误率高 | error_rate > 5% | Error |
| 队列积压 | queue_depth > 1000 | Warning |
| Agent离线 | heartbeat_timeout | Critical |