Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of integrating Zipkin by Spring Cloud Sleuth

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "Spring Cloud Sleuth's method of integrating Zipkin". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Sleuth is a distributed tracking solution for Spring Cloud. It consists of the following aspects

Span: the basic unit of work of Sleuth, which is uniquely identified by a 64-bit id. In addition to ID, span also contains other data, such as descriptions, timestamp events, comments (labels) for key-value pairs, span ID,span parent ID, and so on.

Trace (tracking): a tree structure composed of a group of span is called trace.

Annotation (Dimension)

The CS (sent by Client Sent client) client initiates a request, and the annotation describes the beginning of the span.

The SR (the Server Received server receives) the server gets the request and is ready to process it.

SS (sent by the Server Sent server) the annotation indicates that the request processing is completed when the response is sent back to the client.

Identification of the end of the CR (received by the Client Received client) span. The client successfully received the server to the corresponding.

Now let's take a look at what Sleuth does, and when we don't add Sleuth dependencies, suppose we want to access such an interface.

@ GetMapping (value = "/ users-anon/internal", params = "username") public LoginAppUser findByUsername (String username) {return appUserService.findByUsername (username);}

In the log, we can see that it looks like this.

2019-11-01 00 DEBUG 1715 05.402 DEBUG 805-[nio-8001-exec-1] c.c.u.d.U.findUserByUsername: = > Preparing: select u. * from app_user u inner join user_credentials c on c.userId = u.id where c.username =?

2019-11-01 00 c.c.u.d.U.findUserByUsername 1715 05.426 DEBUG-[nio-8001-exec-1] c.c.u.d.U.findUserByUsername: = > Parameters: admin (String)

2019-11-01 00 DEBUG 1715 05.503 DEBUG 805-[nio-8001-exec-1] c.c.u.d.U.findUserByUsername: Preparing: select r. * from sys_role_user ru inner join sys_role r on r.id = ru.roleId where ru.userId =?

2019-11-01 00 DEBUG 1715 05.529 805-[nio-8001-exec-1] c.c.u.dao.UserRoleDao.findRolesByUserId: = > Parameters: 1 (Long)

2019-11-01 00 DEBUG 1715 05.584 DEBUG-[nio-8001-exec-1] c.c.u.dao.UserRoleDao.findRolesByUserId: Preparing: select p.* from sys_permission p inner join sys_role_permission rp on p.id = rp.permissionId WHERE rp.roleId in (?)

2019-11-01 00 c.c.u.d.R.findPermissionsByRoleIds 1715 05.606 DEBUG-[nio-8001-exec-1] c.c.u.d.R.findPermissionsByRoleIds: = > Parameters: 1 (Long)

2019-11-01 00 DEBUG 1715 06.245 DEBUG 805-[nio-8001-exec-1] c.c.u.d.R.findPermissionsByRoleIds: Preparing: select u. * from app_user u inner join user_credentials c on c.userId = u.id where c.username =?

2019-11-01 00 DEBUG 2315 01.487 DEBUG [user-center,d406e2f823a1c2a3,d406e2f823a1c2a3,false] 816-[nio-8001-exec-1] c.c.u.d.U.findUserByUsername: = > Parameters: admin (String)

2019-11-01 00 DEBUG 231.649 DEBUG [user-center,d406e2f823a1c2a3,d406e2f823a1c2a3,false] 816-[nio-8001-exec-1] c.c.u.d.U.findUserByUsername: Preparing: select r.* from sys_role_user ru inner join sys_role r on r.id = ru.roleId where ru.userId =?

2019-11-01 00 Parameters 2315 01.679 DEBUG [user-center,d406e2f823a1c2a3,d406e2f823a1c2a3,false] 816-[nio-8001-exec-1] c.c.u.dao.UserRoleDao.findRolesByUserId: = > Parameters: 1 (Long)

2019-11-01 00 DEBUG 2315 01.834 DEBUG [user-center,d406e2f823a1c2a3,d406e2f823a1c2a3,false] 816-[nio-8001-exec-1] c.c.u.dao.UserRoleDao.findRolesByUserId: Preparing: select p.* from sys_permission p inner join sys_role_permission rp on p.id = rp.permissionId WHERE rp.roleId in (?)

2019-11-01 00 Parameters 2315 01.852 DEBUG [user-center,d406e2f823a1c2a3,d406e2f823a1c2a3,false] 816-[nio-8001-exec-1] c.c.u.d.R.findPermissionsByRoleIds: = > Parameters: 1 (Long)

2019-11-01 00 DEBUG 231.980 DEBUG [user-center,d406e2f823a1c2a3,d406e2f823a1c2a3,false] 816-[nio-8001-exec-1] c.c.u.d.R.findPermissionsByRoleIds: Preparing: select u. * from app_user u inner join user_credentials c on c.userId = u.id where c.username =?

2019-11-01 01 DEBUG 0415 03.203 DEBUG [user-center,d7fa432636d9df52,d7fa432636d9df52,true] 956-[nio-8001-exec-1] c.c.u.d.U.findUserByUsername: = > Parameters: admin (String)

2019-11-01 01 DEBUG 0414 DEBUG [user-center,d7fa432636d9df52,d7fa432636d9df52,true] 956-[nio-8001-exec-1] c.c.u.d.U.findUserByUsername: Preparing: select r.* from sys_role_user ru inner join sys_role r on r.id = ru.roleId where ru.userId =?

2019-11-01 01 nio-8001-exec-1 04 DEBUG [user-center,d7fa432636d9df52,d7fa432636d9df52,true] 956-[nio-8001-exec-1] c.c.u.dao.UserRoleDao.findRolesByUserId: = > Parameters: 1 (Long)

2019-11-01 01 DEBUG 0440 DEBUG [user-center,d7fa432636d9df52,d7fa432636d9df52,true] 956-[nio-8001-exec-1] c.c.u.dao.UserRoleDao.findRolesByUserId: Preparing: select P.P. * from sys_permission p inner join sys_role_permission rp on p.id = rp.permissionId WHERE rp.roleId in (?)

2019-11-01 01 nio-8001-exec-1 0415 0368 DEBUG [user-center,d7fa432636d9df52,d7fa432636d9df52,true] 956-[nio-8001-exec-1] c.c.u.d.R.findPermissionsByRoleIds: = > Parameters: 1 (Long)

2019-11-01 01 nio-8001-exec-1 0415 03.433 DEBUG [user-center,d7fa432636d9df52,d7fa432636d9df52,true] 956-[nio-8001-exec-1] c.c.u.d.R.findPermissionsByRoleIds:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report