Callers can follow one request from the HTTP envelope into the log collector without coupling the two modules. Co-authored-by: Cursor <cursoragent@cursor.com>
978 B
978 B
错误码、日志与 trace_id
错误码仓库与日志仓库互不导入。对齐方式、调用顺序和查询命令见同级仓库 Logging-System 的 docs/integration.md。两个仓库需要放在同级目录时,可运行示例是 Logging-System/examples/trace。
本地副本要点:
- HTTP 层回显
X-Trace-Id(httpx.Trace)。 - 用
errcode.Wrap带上规范码;未知码回落sys.unknown_code。 httpx.WriteError的信封带code和trace_id。- 同一 context 上的日志会带同一个
trace_id。若错误实现了ErrorCode()/ErrorFields(),日志条目同时带上码和字段。 - 用
trace_id到采集器查这一次调用,用code查同一类失败。
副作用为 possible 或 unknown 的码禁止无条件重放。agent-native 与 agent-squad 的现有字符串如何落到规范码,见 agent-native-mapping.md 与 agent-squad-mapping.md。