feat(server): /metrics 可观测与日志上下文(F22)

- 新增 Prometheus 指标端点 /metrics(HTTP + DB + 作业统计)
- request.log 绑定 requestId/actorId,避免日志难追踪
- cron/pg-boss 作业增加 metrics 计数(runs/processed)
- 更新 env/runbook/README 与 v3 CSV 状态推进
这个提交包含在:
2026-02-09 20:30:41 +08:00
父节点 55924c8ff8
当前提交 6ecebf8ad6
共修改 17 个文件,包含 353 行新增和 25 行删除
+3
查看文件
@@ -33,6 +33,9 @@ PORT="3000"
# ===== Cookie 安全(HTTPS 反代时建议 true)=====
COOKIE_SECURE="false"
# ===== Metrics(Prometheus)=====
METRICS_ENABLED="true"
# ===== 安全基线(试运行建议打开)=====
RATE_LIMIT_ENABLED="true"
RATE_LIMIT_LOGIN_MAX="10"
+3
查看文件
@@ -30,6 +30,7 @@ services:
condition: service_healthy
environment:
NODE_ENV: production
METRICS_ENABLED: ${METRICS_ENABLED}
APP_ORIGIN: ${APP_ORIGIN}
JWT_SECRET: ${JWT_SECRET}
DATABASE_URL: ${DATABASE_URL}
@@ -77,6 +78,7 @@ services:
command: ["npm", "run", "worker"]
environment:
NODE_ENV: production
METRICS_ENABLED: ${METRICS_ENABLED}
APP_ORIGIN: ${APP_ORIGIN}
JWT_SECRET: ${JWT_SECRET}
DATABASE_URL: ${DATABASE_URL}
@@ -112,6 +114,7 @@ services:
condition: service_healthy
environment:
NODE_ENV: production
METRICS_ENABLED: ${METRICS_ENABLED}
APP_ORIGIN: ${APP_ORIGIN}
JWT_SECRET: ${JWT_SECRET}
DATABASE_URL: ${DATABASE_URL}
+1
查看文件
@@ -52,6 +52,7 @@ docker compose -f deploy/trialrun/docker-compose.yml --env-file deploy/trialrun/
```bash
curl -fsS http://127.0.0.1:3000/health
curl -fsS http://127.0.0.1:3000/ready
curl -fsS http://127.0.0.1:3000/metrics | head
```
浏览器访问: