当前位置:网站首页>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);
边栏推荐
- 30. 串联所有单词的子串
- The idea and method of MySQL master-slave only synchronizing some libraries or tables
- stylegan1: a style-based henerator architecture for gemerative adversarial networks
- Pop() element in JS
- Arrays in JS
- [MAE]Masked Autoencoders掩膜自编码器
- spdlog记录日志示例 - 使用sink创建logger
- Different implementation of CAS operation under arm and x86
- OpenResty 基础
- C. Add One--Divide by Zero 2021 and Codeforces Round #714 (Div. 2)
猜你喜欢

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

A transformer can only convert alternating current. How can I convert direct current?

How strong is Jingdong's takeout after entering meituan and starving the hinterland?

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

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

get_edges

Sfod: passive domain adaptation and upgrade optimization, making the detection model easier to adapt to new data (attached with paper Download)

mysql 系列:存储引擎

golang 重要知识:mutex

电子学会图形化一级编程题解析:猫捉老鼠
随机推荐
js中的push函数介绍
图片保存:torchvision.utils.save_image(img, imgPath)
【无标题】激光焊接在医疗中的应用
12 BeautifulSoup类的初始化
Sfod: passive domain adaptation and upgrade optimization, making the detection model easier to adapt to new data (attached with paper Download)
JS里的数组
golang 重要知识:waitgroup 解析
Important knowledge of golang: waitgroup parsing
自监督学习(SSL)Self-Supervised Learning
医学影像分割的网站
PHP指定字段大于100正序排,小于100随机排
Solution to the problem that MySQL cannot be started in xampp
Nfnet: extension of NF RESNET without BN's 4096 super batch size training | 21 year paper
Gartner最新报告:低代码应用开发平台在国内的发展
List query sorting parameter processing
Explore the "store" on the cloud. The cloud store is newly upgraded!
看,这就是调制解调原理分析!附仿真文件
readImg: 读取图片到Variable变量
电荷泵原理讲义,电压是怎么“泵”上去的?
php 二维数组插入