Files
dacli/docs/cmd-review/monitor.md
T
sswandClaude b9c9e318af feat(v0.11+): Phase 1 - 23 个 dacli 父命令审计完成
派 25 个 Explore 子代理 (5 批 × 5) 审计 23 个父命令.
产出 cmd-review/{cmd}.md (24 文件) + _summary.md.

关键发现:
- webapi 镜像使用率 < 30% (12+ 父命令 100% 绕 webapi)
- 30+ P0 必补新命令 (form update, log exception, di CRUD, role authorize 等)
- 3 处 P0 端点错误 (假 PASS):
  * integration emailTest/smsTest
  * msg templateCreate
- 用户关键修正: bigscreen → jnpf-web-datascreen-vue3 (独立子项目)
- 用户关键修正: report → jnpf-web-datareport (独立子项目)

下一步: Phase 2 按 P0 优先级执行 (修端点 + 新命令 + webapi 化)

Co-Authored-By: Claude <[email protected]>
2026-06-25 14:58:32 +08:00

78 lines
3.2 KiB
Markdown

# dacli `monitor` 命令审计报告 (2026-06-25)
## 1. 命令清单
| 子命令 | 格式 | 用途 |
|--------|------|------|
| `dacli monitor online` | `[--keyword] [--json]` | 在线用户列表 |
| `dacli monitor sql` | `[--keyword] [--json]` | SQL 监控 (实际是 DataInterfaceLog) |
| `dacli monitor flow` | `[--keyword] [--json]` | 流程监控 |
## 2. web 端对应
- 监控页: `web/apps/jnpf-web-apps-main/src/views/system/monitor/` 或 `online/`
- 监控 API:
- `web/.../api/permission/onlineUser.ts` — online + kick
- `web/.../api/workFlow/flowMonitor.ts` — flow + cancel + pause + reboot + assign
- `web/.../api/system/monitor.ts` — server status (CPU/内存/磁盘)
- JNPF 后端: `POST /api/permission/Users/online` (在线用户) `/api/system/SqlLog` (SQL 监控) `/api/workflow/Task` (流程监控)
## 3. 改/删/留 建议
### [KEEP] 保留
- **online** — 在线用户基础查询
- **sql** — 保留但语义混乱 (实际是 DataInterfaceLog)
- **flow** — 流程监控基础查询
### [REFACTOR-WEBAPI] **P0 必做**
新建 `src/webapi/monitor.ts` 镜像 web 端 3 个 API 文件:
- `permission/onlineUser.ts` (online + kick)
- `workFlow/flowMonitor.ts` (flow + cancel + pause + reboot + assign)
- `system/monitor.ts` (server status)
### [DEPRECATE] / [RENAME]
- **`monitor sql` 语义混乱**: 实际查 DataInterfaceLog 而非 SQL 慢查询
- 建议: 改名为 `monitor di-log` 或删除合并到 `monitor flow log`
### [NEW-CMD] **P0 必补**
- **`dacli monitor server`** — 镜像 web `getSysMonitor()`, 返回 CPU/内存/磁盘/系统信息
- 这是 AI 调试性能问题的**最高优先级命令**
- 当前 monitor 完全缺乏性能指标, 性能瓶颈只能盲猜
### [NEW-CMD] P1 — 流程管理操作
- **`dacli monitor flow cancel --id=<id>`** — 撤销流程
- **`dacli monitor flow pause --id=<id> --type=<reason>`** — 暂停
- **`dacli monitor flow reboot --id=<id>`** — 重启
- **`dacli monitor flow log --id=<id>`** — 流程事件日志 (关键缺失)
- **`dacli monitor flow assign --id=<id> --toUserId=<u>`** — 转办
### [NEW-CMD] P2
- **`dacli monitor kick <userId>`** — 踢出在线用户
- **`dacli monitor cache`** — 缓存监控
- **`dacli monitor schedule`** — 定时任务监控
## 4. AI 痛点评估
### 性能诊断无入口
- 当前 monitor 完全缺乏性能指标 (CPU/内存/磁盘)
- AI 收到 "系统卡" 反馈, 无法定位是 DB/Redis/JVM 哪个瓶颈
- **加 `monitor server` 是 P0**
### SQL 慢查询无接口
- `monitor sql` 实际是 DataInterfaceLog, 不能查慢 SQL
- 真实 SQL 监控在后端, 但 web/dacli 都未暴露
### 流程监控与 workflow 命令脱节
- `dacli workflow` 是流程模板管理
- `dacli monitor flow` 是流程实例监控
- 两命令无 --templateId 关联, AI 需要多次查询拼接
---
**核心结论**: dacli monitor 模块覆盖率仅 30% (web 5 大监控模块, dacli 仅覆盖 online/sql/flow), SQL 监控语义混乱, 流程监控缺少 cancel/pause/reboot 等管理操作.
**3 个最关键建议**:
1. **[REFACTOR-WEBAPI] 新增 webapi/monitor.ts** 镜像 3 个 web API 文件
2. **[NEW-CMD] 新增 `monitor server`** — AI 性能诊断最高优先级
3. **[REFACTOR-WEBAPI] 扩展 `monitor flow`** — 加 6 个管理操作 (cancel/pause/reboot/assign/log/...)