/images/avatar.svg

谷中仁的博客

所有文章观点仅代表本站观点,与他人无关。

Some Good Practices of Logging

Introduction

Logging is structured or unstructured text information generated by the system during operation. Usually, it can be regarded as a record of an event by the application. Logging can often help us discover unexpected behaviors in systems, especially in some microservice architecture systems. As an important part of Observability, Logging plays an irreplaceable role in our system development and maintenance.

Pillars of Observability

The importance of logging

To understand why logging plays an important role in products or systems, we must understand its value. Currently, the most widely used logging forms are alerting, troubleshooting, and business data visualization.

定制你的DrawIO样式

Why

有时候我们用 DrawIO 在线版或者 VSCode 插件画图的时候,需要使用自己公司的配色和字体要求来做图;如果一个一个图形的选择,然后输入对应的样式值,这样很浪费时间;作为高效能人士,肯定需要将其形成模板存起来,使用的时候自动读取即可。所谓“一劳永逸”。

日志记录的最佳实践

简介

日志(Log)是由系统在运行过程中产生的结构化或者非结构化的文字信息。通常情况,可以将其视为应用程序对某个事件(Event)的记录。日志通常可以帮助我们发现一些微服务架构系统的非预期或突发的行为。 Logging作为 Observability的重要组成部分,在我们的系统开发、维护中起到无法替代的作用。

代码质量和Dora Metrics, 哪个更重要?

勿以恶小而为之,勿以善小而不为 –《三国志·蜀志传》

起因

最近在项目上搞代码质量方面的工作,发现项目代码运行测试后不能生成测试报告,导致 SonarQube 上没有关于测试覆盖率的Metric, 而且Pipeline 还可以正确运行,并没有因为不满足 SonarQube 的 Quality Gate 而 break Pipeline 的运行。

真的需要在测试中打log么?

引言

“调试程序是程序员最大的耻辱” – CTO

写了 log 并且出错的程序

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
describe('multiple', () => {
  it('should be send when invoke the method sendMessage', () => {
    Object.defineProperty(window, 'top', {
      value: window,
      writable: true,
      enumerable: true,
      configurable: true,
    })
    Object.defineProperty(window, 'postMessage', {
      writable: true,
      value: jest.fn(),
    })

    console.log(window.top?.postMessage)
    sendMessage('message')
    console.log(window.top?.postMessage)

    expect(window.parent.postMessage).toBeCalledTimes(2)
  })
})

运行输出

Continuously Optimize Your Website With Lighthouse CI

Performance has directly impacted the company’s bottom line. – Pinterest

Intro

Since the development of the Internet, web page performance has always been an important issue. All major Internet companies are sparing no effort to optimize their web pages, in order to allow users to see the content that users want to see faster.

During the development of the Internet in recent decades, various indicators and terms for measuring web performance have stabilized, and the measurement methods of various products have tended to be consistent.

浮躁的时代更需要沉淀自己

这个社会怎么了

最近的热点都被俄罗斯攻打乌克兰占领了,没有一点悬念的是社交网站上出现了完全不同立场的人的极端言论。

国家已经在各个发布会上表明了 ZF 的立场,个人还在自己的朋友圈、公众号、社交平台上发布各种言论;远远的只能是说一句 真是辛苦那些社交媒体了,以后的社交媒体恐怕又要加几条规则了;暴力机器在这,一个小小的零部件又怎能翻起大浪呢。