feat(ops): 增加运行时性能看板

This commit is contained in:
2026-07-08 17:47:36 +08:00
parent 58c98a3a3d
commit 15653b5b35
19 changed files with 933 additions and 2 deletions

View File

@@ -77,6 +77,26 @@ The medium fixture is the V2.6 acceptance target. Large fixture runs are for ind
See `docs/performance-hot-queries.md` for query budgets, partition-key contracts, and required indexes.
## Runtime Ops Dashboard
`/admin/ops` provides the V2.6 runtime view for checking whether the hot paths and background workers stay healthy after fixture/perf runs.
It reads `GET /api/v1/ops/runtime` and shows:
- recent slow API requests captured by `ApiTimingInterceptor`
- recent slow Prisma query previews captured by `PrismaService`
- `background_jobs` totals and per-type queued/running/succeeded/failed counts
- recent failed jobs with redacted `lastError`
- dirty `xiaobao_risk_summaries` count
Access is guarded in the frontend by `ops:view`. Backend RBAC is currently an explicit `OpsPermissionAdapter` placeholder until the V2.5 RBAC contract lands.
Secret handling:
- request query strings are stripped before display
- SQL is shown only as a bounded query preview, without Prisma parameters
- key-like text such as `sk-*`, token, secret, password, and authorization is redacted
## Notes
- `seed-large-dataset` uses deterministic IDs and dates so repeated runs are comparable.