Skip to Content
数据可观测性的基础知识
book

数据可观测性的基础知识

by Andy Petrella
May 2025
Beginner to intermediate
266 pages
3h 10m
Chinese
O'Reilly Media, Inc.
Content preview from 数据可观测性的基础知识

第 4 章 生成数据观测 生成数据观测

本作品已使用人工智能进行翻译。欢迎您提供反馈和意见:translation-feedback@oreilly.com

第 3 章所述,数据可观测性将技术与人员相结合,从数据角度收集系统状态信息以及对该状态的预期。 然后利用这些信息使系统更具适应性或弹性。

本章介绍如何应用数据可观察性实践。我将从 "源头上的数据可观察性 "开始,这是一种在日常数据工作中引入收集策略的方法,我将向你展示如何将其对效率的影响降至最低。然后,本章将详细阐述如何实现订阅软件交付生命周期的期望,如持续集成和持续部署(CI/CD)。

与任何新兴实践和技术一样,要提高数据可观察性的采用率,就必须降低准入门槛;这样,人们就没有理由反对变革。然而,人们也是解决方案的一部分,因为他们的参与对于确定他们的期望和编纂规则至关重要。为此,您将学习几种方法,以减少产生观察结果所需的工作量,并了解如何在开发生命周期的正确时刻引入观察结果。

在源头

第 2 章介绍了有助于观察者的信息来源和类型。但如何从这些来源生成和收集信息呢?

它始于源头的数据可观测性。源 "是指负责读取、转换和写入数据的应用程序。如第 3 章所述,这些应用程序可能是问题的根源,也可能是解决问题的手段。此外,与数据本身不同,应用程序在我们工程师和组织的控制范围之内。

因此,源数据可观测方法取决于应用程序按照第 2 章所述模式生成数据观测结果的能力;换句话说,应用程序是数据可观测的。

纯粹的数据和分析观察--如数据源、模式、线程和度量--与阅读、转换和编写活动相关联。本节介绍的策略通过解释运行这些活动时应考虑的事项来解决这些活动。

从源头生成数据观测

从源头开始生成数据观察结果,首先要生成额外的信息,捕捉数据特定活动的行为:读取、转换和写入。例如,开发人员可以添加日志行,其中包含生成有关其应用程序所做工作的可见性所需的信息。本说明使用第 2 章中介绍的渠道,即日志、度量和跟踪或线程,来传达可集中在日志系统中的观察结果。

在下一节中,你将学习如何创建 JSON 格式的数据观察结果,并将其收集(发布)到本地文件、本地服务、远程(网络)服务或类似目的地。例如,按照第 2 章中的数据可观察性核心模型,Postgres 表的数据源和模式实体将如例 4-1 所示。

例 4-1. 以 JSON 编码的数据观测示例
{
  "id": "f1813697-339f-5576-a7ce-6eff6eb63249",
  "name": "gold.crm.customer",
  "location": "main-pg:5432/gold/crm/table",
  "format": "postgres"
}
{
  "id": "f1813697-339f-5576-a7ce-6eff6eb63249",
  "data_source_ref": {"by_id": "e21ce0a8-a01e-5225-8a30-5dd809c0952e"},
  "fields": [
  { "name": "lastname", "type": "string", "nullable": true }, 
  { "name": "id", "type": "int", "nullable": false }
  ]
}

这种在集中式平台上以同一模型收集数据观测结果的能力,是大规模产生数据可观测性价值的关键,例如跨应用、跨团队和跨部门。这就是为什么使用数据可观察性核心模型对于轻松聚合数据观察结果非常重要,尤其是沿线

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

用数据进行沟通

用数据进行沟通

Carl Allchin
深度学习实战手册(R语言版)

深度学习实战手册(R语言版)

Posts & Telecom Press, PKS Prakash, Achyutuni Sri Krishna Rao
混沌工程

混沌工程

Casey Rosenthal, Nora Jones

Publisher Resources

ISBN: 9798341658349