当前位置:网站首页>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 .
边栏推荐
- From boosting to lamdamart
- 【uniapp】多种支付方式封装
- Abnormal (2)
- 【每日一题】919. 完全二叉树插入器
- Dynamic performance view overview
- Fang Wenshan, Jay Chou's best partner, will officially announce "Hualiu yuancosmos" on July 25
- Machine learning related competition website
- Como automatic test system: build process record
- Crawler - > tpimgspider
- Jmeter性能测试之使用存储响应内容到文件监听器
猜你喜欢

Anaconda 中安装 百度飞浆Paddle 深度学习框架 教程

Comparison and difference between dependence and Association

机器学习相关比赛网站

Meta universe infrastructure: analysis of the advantages of Web 3.0 chain33

博途PLC一阶滞后系统传递函数阶跃响应输出仿真(SCL)

爬虫->TpImgspider

在线问题反馈模块实战(十四):实现在线答疑功能

Enterprise private network construction and operation and maintenance

以太网交换安全

How to ensure the double write consistency between cache and database?
随机推荐
Wrong Addition
Common database commands (special for review)
元宇宙基础设施:WEB 3.0 chain33 优势分析
在线问题反馈模块实战(十四):实现在线答疑功能
总结软件测试岗的那些常见高频面试题
【每日一题】919. 完全二叉树插入器
Tensorflow learning diary tflearn
Taishan office lecture: word error about inconsistent values of page margins
ShardingSphere数据分片
2021-11-09
Crawler data analysis
July training (day 18) - tree
Command line execution and test report generation of JMeter performance test
Sort: merge sort and quick sort
【Keras入门日志(3)】Keras中的序贯(Sequential)模型与函数式(Functional)模型
API (common class 2)
[200 opencv routines] 231. Gray level co-occurrence matrix (GLCM) for feature description
什么是消息订阅和发布?
PXE efficient batch network installation
以太网交换安全