当前位置:网站首页>Sleuth + Zipkin
Sleuth + Zipkin
2022-06-23 15:25:00 【weixin_43766298】
Sleuth + Zipkin
1. sleuth 是什么?
- Spring Cloud Sleuth 为微服务提供了分布式跟踪的解决方案。
- Sleuth 对于分布式链路跟踪仅仅是生成跟踪数据,这些数据不便于阅读,所以一般把这种跟踪数据上传给Zipkin Server,由Zipkin 通过UI界面统一进行数据展示。
2. sleuth由什么组成?
span(跨度):基本工作单元。用一个64位的id唯一标识。除id外,span还包含其他数据,例如描述、时间戳事件、键值对的注解(标签),spanId、parentId等。
trace(跟踪):trace是一组span组成的树状结构,用一个64位的id唯一标识,trace中的所有span都共享该trace的id。
traceId :为一个请求分配的ID号,用来标识一条请求链路。
spanId : 一个基本的工作单元,一个请求可以包含多个步骤,每个步骤都拥有自己的spanId。一个请求包含一个TraceId,多个SpanId。
3. Zipkin是什么?
- Zipkin是分布式实时数据跟踪系统。它的主要功能是收集系统的时序数据,从而达到追踪微服务架构的系统延时,监控跟踪链路调用,Zipkin还提供了一个非常友好的UI界面,来帮住分析追踪数据。
- Zipkin提供了可拔插的数据存储方式:In-Memory、MySql、Cassandra以及Elasticsearch。
4. zipkin由什么组成?

Collector:收集器组件,它主要用于处理从外部系统发送过来的跟踪信息,将这些信息转换为Zipkin内部处理的Span格式,以支持后续的存储、分析、展示等功能。
Storage:存储组件,它主要对处理收集器接收到的跟踪信息,默认会将这些信息存储在内存中,我们也可以修改此存储策略,通过使用其他存储组件将跟踪信息存储到数据库中。
RESTful API:API 组件,它主要用来提供外部访问接口。比如给客户端展示跟踪信息或是外接系统访问以实现监控等。
Web UI:UI 组件,基于 API 组件实现的上层应用,通过 UI 组件用户可以方便而有直观地查询和分析跟踪信息。
5. Sleuth + Zipkin实现分布式链路追踪过程?
Zipkin分为两端,一个是Zipkin服务端,一个是Zipkin客户端,客户端也就是微服务的应用。客户端会配置服务端的URL地址,一旦发生服务间的调用的时候,会被配置在微服务里面的Sleuth的监听器监听,并生成相应的Trace和Span信息发送给服务端(发送的方式主要有两种,一种是HTTP报文的方式,还有一种是消息总线的方式如:RabbitMQ),最终ZipKin通过UI界面把数据展示出来。
总结:Sleuth和Zipkin的关系就好比Spring Boot Actuator和Spring Boot Admin之间的关系,一个用于产生数据,一个用于展示数据。
6. Sleuth + Zipkin实现分布式链路追踪细节?
- 在zuul网关实现一个OncePerRequestFilter过滤器,注入Zipkin的Tracer将traceId和spanId添加到响应头,方便查看接口调用链路
String traceId = tracer.currentSpan().context().traceIdString();
String spanId = tracer.currentSpan().context().spanIdString();
httpServletResponse.setHeader("traceId",traceId+","+spanId);
边栏推荐
- 为什么高通滤波器也能变成微分器?
- labelme的JSON文件转成COCO数据集格式
- F5 application strategy status report in 2022: edge deployment and load security become the focus of attention in the Asia Pacific Region
- [pyside2] pyside2 window is on the top of Maya (note)
- 30. concatenate substrings of all words
- MIPI C-PHY协议你了解吗?手机高速接口之一
- 英特尔Arc A380显卡消息汇总:跑分亮眼驱动拉胯 入门性价产品亟待优化
- Solution to the problem that MySQL cannot be started in xampp
- Important knowledge of golang: sync Once explanation
- The work and development steps that must be done in the early stage of the development of the source code of the live broadcasting room
猜你喜欢

Stone from another mountain - Intelligent Question and answer technology in wechat search

golang 重要知识:atomic 原子操作

Arrays in JS

The "shoulder" of sales and service in the heavy truck industry, Linyi Guangshun deep ploughing product life cycle service

英特尔Arc A380显卡消息汇总:跑分亮眼驱动拉胯 入门性价产品亟待优化

Matlab| sparse auxiliary signal denoising and pattern recognition in time series data

Top 10 purchase, sales and inventory software rankings!

The work and development steps that must be done in the early stage of the development of the source code of the live broadcasting room
![[普通物理] 半波损失 等厚与等倾干涉](/img/66/e0acce623092ecd38e59e38867521d.png)
[普通物理] 半波损失 等厚与等倾干涉

嵌入式软件架构设计-程序分层
随机推荐
Thymeleaf——学习笔记
FPGA 常用缩写及单词在工程领域内的意义
嵌入式软件架构设计-程序分层
TCP协议三次握手和四次挥手抓包分析
The meaning of FPGA abbreviations and words in engineering field
Leetcode 450.删除二叉搜索树中的结点
List query sorting parameter processing
[pyside2] pyside2 window is on the top of Maya (note)
电子学会图形化一级编程题解析:猫捉老鼠
Origin of sectigo (Comodo) Certificate
Important knowledge of golang: timer timer
医学影像分割的网站
变压器只能转换交流电,那直流电怎么转换呢?
The work and development steps that must be done in the early stage of the development of the source code of the live broadcasting room
MySQL日志管理怎么配置
How strong is Jingdong's takeout after entering meituan and starving the hinterland?
golang 重要知识:RWMutex 读写锁分析
Print memory station information
快速排序的簡單理解
他山之石 | 微信搜一搜中的智能问答技术