当前位置:网站首页>Add traceid to the project log
Add traceid to the project log
2022-07-26 07:42:00 【New generation programmers】
Add... To the log traceid
traceid What is it? ?
- What I'm talking about here traceid It refers to adding the same to every log after the server receives the client request and returns the result to the client traceid To track the whole process from request to return .
Why add traceid?
- Recently, I am going to add traceid. This facilitates the server gateway to track the entire requested link after receiving the request and before returning to the client . It is convenient to check online bug And the performance bottleneck of statistical query requests .
- Add one traceid, It's not difficult for a new project , But for a project that has been mature and launched , There are still many things to pay attention to .
- At present, our online project adopts the idea of microservice : In the project, the relatively independent parts of the function are separated into processes . Facilitate rapid iteration of services , Rapid deployment and partial updates . In fact, such a splitting effect is quite obvious , The hot update can be achieved without stopping the service if the functions are required , Greatly reduced maintenance costs , Improved user experience .
How to design traceid?
- Here is the traceid Divide into 4 Parts of :
- User related uid
- Message related msgid
- Incremental or unique tid
- Time related timestamp timestamp
- User uid Needless to say , It is convenient to identify which user is related to this business .
- news msgid It is convenient to locate the business .
- tid In order to ensure traceid Uniqueness .
- Timestamp is convenient to count the time consumed from request to return , At the same time, the time consumed can be calculated after each further step .
traceid Whether it is possible to transmit the business through ?
- At present, for online business structure , Can't get through . Only through between nodes 、 Pass parameters between function calls traceid How to use traceid, This is the simplest and most cumbersome scheme . But it's quite practical , Be able to solve problems . At present, let each node support traceid Link tracking , It will be optimized later .
summary
- traceid The addition of is still in progress , At present, the link log printing of some nodes has been completed . The statistics of link time consumption will be added later . Here is the first record . I will use traceid Let's count each api Time consuming to call .
边栏推荐
- 音视频学习(十)——ps流
- What is message subscription and publishing?
- Polymorphism, final and interface
- 什么是消息订阅和发布?
- How to ensure the double write consistency between cache and database?
- Common database commands (special for review)
- 现在开发人员都开始做测试了,是不是以后就没有软件测试人员了?
- 元宇宙基础设施:WEB 3.0 chain33 优势分析
- Database foundation
- Network Trimming: A Data-Driven Neuron Pruning Approach towards Efficient Deep Architectures论文翻译/笔记
猜你喜欢

以太网交换安全

程序环境和预处理
![[uniapp] encapsulation of multiple payment methods](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[uniapp] encapsulation of multiple payment methods

Web page basic label

Regular expression rules and common regular expressions

MMOE多目标建模

2021全球机器学习大会演讲稿

Wrong Addition

Comparison and difference between dependence and Association

Taishan office lecture: word error about inconsistent values of page margins
随机推荐
一文掌握mysql数据库审计特点、实现方案及审计插件部署教程
动态性能视图概述
C # use log4net to record logs (basic chapter)
Oauth2.0 series blog tutorial summary
微服务feign调用时候,token丢失问题解决方案
【推荐系统经典论文(十)】阿里SDM模型
MySQL之执行计划
如何关闭高位端口
Network ()
Practice of online question feedback module (XIV): realize online question answering function
Machine learning related competition website
Jmeter性能测试之将每次接口请求的结果保存到文件中
TensorFlow学习日记之tflearn
Vscode cannot start the problem solving idea
[keras entry log (3)] sequential model and functional model in keras
Establishment and use of openstack cloud platform
Parameterization of JMeter performance test using CSV file
OVS underlying implementation principle
What is bloom filter in redis series?
Devaxpress.xtraeditors.datanavigator usage