知识卡片
日志区分事件与诊断
日志可分为关键交易或事件的流水记录,以及处理失败和异常的诊断记录。前者强调少量、可追溯的业务节点,后者服务排障。结构化日志中标明类型,可让值班人员先定位请求是否到达及结果,再展开故障细节。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- · 查看原书依据
It is useful to think of logs in two different types: journal and diagnostics. A journal allows the capturing of important transactions/events within the system and is used sparingly. An example of a journal event is the receipt of a new message to process and the outcome of that event. Diagnostics are more concerned with failures in the processing and any unexpected errors outside of a journal-based event.
参考来源
- 位置:《Mastering API Architecture》第5章《Deploying and Releasing APIs》之《Logging to Assist Debugging》(源文件:_epub-src/OEBPS/ch05.xhtml)
- 结论依据:原文区分 journal 与 diagnostics,建议在结构化日志中添加类型字段,以便分别查询关键事件和完整诊断。
- 原始内容:It is useful to think of logs in two different types: journal and diagnostics. A journal allows the capturing of important transactions/events within the system and is used sparingly. An example of a journal event is the receipt of a new message to process and the outcome of that event. Diagnostics are more concerned with failures in the processing and any unexpected errors outside of a journal-based event.