当前位置:网站首页>sleuth入门
sleuth入门
2022-07-17 05:02:00 【小新爱编程】
Sleuth介绍
SpringCloud Sleuth主要功能就是在分布式系统中提供追踪解决方案。它大量借用了Google Dapper的设计, 先来了解一下Sleuth中的术语和相关概念。
Trace
由一组Trace Id(贯穿整个链路)相同的Span串联形成一个树状结构。为了实现请求跟踪,当请求到达分布式系统的入口端点时,只需要服务跟踪框架为该请求创建一个唯一的标识(即TraceId),同时在分布式系统内部流转的时候,框架始终保持传递该唯一值,直到整个请求的返回。那么我们就可以使用该唯一标识将所有的请求串联起来,形成一条完整的请求链路。
Span
代表了一组基本的工作单元。为了统计各处理单元的延迟,当请求到达各个服务组件的时候,也通过一个唯一标识(SpanId)来标记它的开始、具体过程和结束。通过SpanId的开始和结束时间戳,就能统计该span的调用时间,除此之外,我们还可以获取如事件的名称。请求信息等元数据。
Annotation
用它记录一段时间内的事件,内部使用的重要注释:
cs(Client Send)客户端发出请求,开始一个请求的生命
sr(Server Received)服务端接受到请求开始进行处理, sr-cs = 网络延迟(服务调用的时间)
ss(Server Send)服务端处理完毕准备发送到客户端,ss - sr = 服务器上的请求处理时间
cr(Client Reveived)客户端接受到服务端的响应,请求结束。 cr - sr = 请求的总时间
1. 加入依赖

2. 查看每一个微服务控制层输出的日志。
Order:
Product:
shop-order-zsh,94c4ce76bc4b9513,3176ca05d3dd0aa7,false
服务的名, traceId,spanId, 是否把采集的日志展示到第三方平台。
通过上述日志,能分析出那里的处理时间超长。 但是这样好吗? 如果微服务的个数比较多,我们肉眼,计算出现各种不方便。 可以使用一个工具来展示我们上面哪些日志——Zipkin
边栏推荐
- PHP array_filter去空保留0,false
- Tidb performance optimization overview
- swagger的坑
- 知识图谱de构建与应用(六):知识图谱的存储、服务与质量
- Multiple connections will be maintained for each provider instance
- Fudan micro fmql (domestic zynq) [PS of IAR bare metal development] - non byte aligned access
- Hightec new aurix tc37x demo project
- shardingsphere的核心概念和快速实战
- Rearrange data according to date JS
- Expected to replace deepfake? Uncover this year's super popular nerf Technology
猜你喜欢

简洁UI好玩的文字转换emoji表情微信小程序支持句子词语转换_源码

HighTec 新建 AURIX TC37X demo 工程

【FPGA教程案例27】通过Verilog实现双口RAM乒乓结构

力扣刷题02(三数之和+最大子序和+二叉树最近公共祖先)

Constraints on MySQL tables (Basics)

赚钱大师小程序【最新版5.9.9】商城/佣金即时提现/分销推广/话费充值/美团饿了么外卖

Penetration test 10 - scan web directories (dirb, wfuzz, wpscan, Nikto)
![Money making master applet [latest version 5.9.9] mall / instant withdrawal of commission / distribution promotion / phone recharge / is meituan hungry for takeout](/img/8b/29027c2dee4ef764bb2e4b5b499a23.jpg)
Money making master applet [latest version 5.9.9] mall / instant withdrawal of commission / distribution promotion / phone recharge / is meituan hungry for takeout

项目组暑假总结02

Emqx pressure test tread pit for your reference
随机推荐
Warriors of the Visual Studio, Assemble! (Visual Studio的勇士们,汇编吧!) 原创 2009年07月12日 19:40:00 标签:汇编 /mic
项目组暑假总结01
Notes for Resume Writing
渗透测试 10 --- 扫描 web目录 (dirb、wfuzz、wpscan、nikto)
[TA frost wolf _may - "hundred people plan"] art 2.1 DCC tool chain and engine tool chain
Usage scenarios and usage of judgment and rounding down in MySQL
Project structure of wechat applet
Unity UMP打包黑屏問題總結
Static attributes and static methods of class in JS
Monitoring and alarm of kubernetes
[unity] interactive double click
根据日期重新排列数据js
[fuel cell] simulation of fuel cell system control strategy based on Simulink
Fudan micro fmql (domestic zynq) [PS of IAR bare metal development] - non byte aligned access
masm32写程序
Project team summer vacation summary 02
mysql主从架构和读写分离、以及高可用架构
项目组暑假总结02
【TA-霜狼_may-《百人计划》】图形2.5 Bump Mapping
Wechat applet source code of high imitation Netease cloud music UI