build: add api server tracing bootstrap

This commit is contained in:
2026-04-21 01:17:17 +08:00
parent 6ece1f41ee
commit f3b36f15b5
8 changed files with 211 additions and 8 deletions

View File

@@ -22,14 +22,22 @@
4. `src/app.rs`
5. `src/state.rs`
6. `src/config.rs`
7. `src/logging.rs`
8. 基础 `TraceLayer` 挂载与 `tracing subscriber` 初始化
后续与本 package 直接相关的任务包括:
1. 接入统一日志与 tracing
2. 接入 `request_id`
3. 接入统一错误处理中间件
4. 接入 response envelope
5. 接入 `/healthz`
1. [x] 接入统一日志与 tracing
2. [ ] 接入 `request_id`
3. [ ] 接入统一错误处理中间件
4. [ ] 接入 response envelope
5. [ ] 接入 `/healthz`
当前 tracing 约定:
1. 进程启动时统一初始化 `tracing subscriber`
2. 默认日志过滤器来自 `GENARRATIVE_API_LOG`,未提供时回落到 `info,tower_http=info`
3. HTTP 访问日志统一通过 Axum 路由层的 `TraceLayer` 输出,后续 `request_id`、响应头与错误中间件继续在同一层扩展。
## 3. 边界约束