Skip to Content
可观测性工程
book

可观测性工程

by Charity Majors, Liz Fong-Jones, George Miranda
July 2023
Beginner to intermediate
270 pages
4h 48m
Chinese
China Machine Press
Content preview from 可观测性工程
66
|
6
如果要更换方案,那么便需要在代码中再次埋点。下一章将介绍开源
OpenTelemetry
目,以及
OpenTelemetry
如何仅需埋点一次而且适用多种解决方案。
现在已经对探针和创建有用的链路视图有了完整的了解,那么根据这些结合之前章节所
得,应该能理解为什么链路追踪是可观测系统中非常关键的元素。
6.5 将事件拼接到链路中
5
章讲解了结构化事件作可观测系统的构建块的使用,将事件定义为特定请求与服务
交互时发生的所有信息的记录。在该请求的全生命周期内,所有发生的有意思的细节都
应该追加到事件上。
代码示例中的函数方法非常简单。实际应用中每个服务的调用贯穿单个请求的整个过
程,其中包含了很多特定的细节:变量、传递的参数、返回的结果、相关上下文等。每
个事件都应该通过链路追踪数据捕获这些细节,方便对分布式系统中服务和组件之间的
关系进行查看和调试。
本书的例子和分布式链路追踪系统中的例子一样,使用的探针都是在远程服务调用级别
添加的。但可观测系统中可以用相同的方式,将不同来源的有关联的任何数量的事件拼
在一起。例如,可以通过应用这些相同的链路追踪理念,将当前的单行日志方案迁移到
更具内聚性的视图,从而迈出可观测性第一步。
为此可以把非结构化的多行日志改成结构化日志(参照第
5
章),然后可以添加相同的链
路追踪数据的必要字段到结构化日志中。完成这些,就可以从日志数据中产生瀑布图的
可视化效果了。我们不建议把这作为长期的方法,但这样确实很有用,尤其是刚开始接
触可观测性时(参见第
10
章以获取更多建议)
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

可观察性工程

可观察性工程

Charity Majors, Liz Fong-Jones, George Miranda
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer

Publisher Resources

ISBN: 9787111729099