Both tables on this page are generated from source at build time — ENV_SPEC in api/src/env.ts and the route registrations in api/src/index.ts. They cannot drift.
| Variable | Default | Purpose |
|---|---|---|
DATABASE_URL | postgres://localhost/relionaut | PostgreSQL 连接串 |
REDIS_URL | redis://localhost:6379 | Redis 连接串(限流) |
GLM_API_KEY | — | LLM key(诊断必需;不配则仅采集/查询/告警可用) |
GLM_BASE_URL | https://open.bigmodel.cn/api/anthropic | 任意 Anthropic 兼容端点 |
GLM_MODEL | glm-4.6 | 模型 id |
GLM_PRICE_IN_MTOK | — | 输入价格 USD/百万 token(与 OUT 同给才折算成本) |
GLM_PRICE_OUT_MTOK | — | 输出价格 USD/百万 token |
MAX_STEPS | 10 | 单次调查最大 ReAct 步数 |
RATE_LIMIT | 60/60 | API 限流 count/window 秒 |
ALERT_INTERVAL | 60 | 告警规则评估周期(秒) |
AUTO_DIAGNOSE | 1 | 告警触发后自动调查 |
TYPESAFE_API_KEY | — | TypeSafe 智能分诊 key(不配则跳过) |
Adding a variable means adding one ENV_SPEC entry in api/src/env.ts — a CI check fails any pull request that reads process.env directly anywhere else, and the site rebuilds from the same object the runtime uses.
| Method | Path | Purpose |
|---|---|---|
| POST | /api/alerts/evaluate | 手动触发一次规则评估 |
| GET | /api/alerts/history | 告警历史 |
| GET | /api/alerts/rules | 告警规则查看 |
| PATCH | /api/alerts/rules/:name | 单条告警规则编辑 |
| GET | /api/health | 健康检查(PG/Redis/LLM 配置状态) |
| GET | /api/incidents | 事件列表 |
| POST | /api/incidents | 创建事件 |
| GET | /api/incidents/:id | 事件详情(轨迹+时间线) |
| PATCH | /api/incidents/:id | 事件流转(open→investigating→mitigated→resolved) |
| POST | /api/incidents/:id/chat | Agent 诊断(SSE 流事件) |
| POST | /api/incidents/:id/distill | 把一次诊断蒸馏为可复用 lesson |
| GET | /api/logs | 日志查询(容器/级别/关键字/时间) |
| GET | /api/metrics | 指标序列查询 |
| GET | /api/metrics/names | 可用指标名清单 |
| GET | /api/stats | Dashboard 汇总(活跃事件/错误日志/P95/宿主负载) |
| GET | /api/traces | trace 列表 |
| GET | /api/traces/:traceId | 单 trace 瀑布 |
| POST | /api/triage | TypeSafe 智能分诊(未配 key 跳过) |
Route documentation lives in docs/web/docs/reference.api.tsv (one line per route); the build fails if a route is registered without a doc line, or documented without being registered.