当前位置:网站首页>Getting started with Zipkin
Getting started with Zipkin
2022-06-11 08:44:00 【jc_ hook】
Catalog
One 、 Introduce
Zipkin It's an open source Distributed real-time data tracking system (Distributed Tracking System), be based on Google Dapper From the design of the paper , from Twitter Company development contribution . Its main functions are Gather Real time monitoring data from various heterogeneous systems .
Two 、 framework
Zipkin In two parts :
- zipkin server
- zipkin client

zipkin server
Used as data acquisition and storage 、 Data analysis and display .
It mainly includes four modules :Collector、Storage、API、UI
- Collector: Collector as , It is mainly used to deal with An external system Sent by Tracking information , Put this information transformation by Zipkin Internally processed Span Format , To support subsequent storage , analysis , Display and other functions
- Storage: Store received or collected data ( Support Memory,MySQL,Cassandra,ElasticSearch…), Default stored in Memory in
- API: Provide external query interface
- UI: Provide external Web Interface , adopt UI Component users can easily and intuitively query and analyze tracking information
zipkin client
Completed the generation and reporting of tracking data
3、 ... and 、 Basic concepts
Annotation
Record events that occur at a certain point in time , There are four types of events :
- cs(Client Send): The client sends request
- sr(Server Recevied): Server receive Request to start processing
- ss(Server Send): Server side Finished processing , send out To client
- cr(Cilent Recevied): Client reception Response to the server , End of request
BinaryAnnotation
Provide some additional information ( such as :sessionID、userID、userIP、 Abnormal etc. ), The required data can be Key value pair In this field
Span
Trace the basic structure of service invocation , By a group Annotation and BinaryAnnotation form , The processing trace for each service is a Span.
When a request is received and processed , Just create a Span, If the current request is sent from the upstream , The new Span The parent node of is set to the one requested in the previous step Span.
Trace
By a group traceId identical Of Span Connect in series to form a Trees structure , Indicates a call link .
Requests arrive at the... Of the distributed system entrance At the end , Generate a unique identifier traceId, During the internal circulation of the distributed system , The framework always keeps passing that unique value
Four 、 Information structure passed between services
Trace The basic information of needs to be transferred between upstream and downstream services , The following information is required :
- Trace ID: start ( root ) Service generated TraceID
- Span ID: Generated when calling downstream services Span ID
- Parent Span ID: Father Span ID
- Is Sampled: Whether sampling is required
- Flags: Tell downstream Services , Whether it is debug Reqeust
5、 ... and 、 Service tracking process
- Application initiate request , after Trace Frame interception
- Of the current call chain Trace Information added to HTTP Header in
- Record the current timestamp
- take Trace dependent header Carry the information , Send a request
- End of call , Record the current time spent
- The information generated in the above steps is collected into one span, hold span Upload to zipkin Of Collector modular
┌─────────────┐ ┌───────────────────────┐ ┌─────────────┐ ┌──────────────────┐
│ User Code │ │ Trace Instrumentation │ │ Http Client │ │ Zipkin Collector │
└─────────────┘ └───────────────────────┘ └─────────────┘ └──────────────────┘
│ │ │ │
┌─────────┐
│ ──┤GET /foo ├─ │ ────┐ │ │
└─────────┘ │ record tags
│ │ ───┘ │ │
────┐
│ │ │ add trace headers │ │
───┘
│ │ ────┐ │ │
│ record timestamp
│ │ ───┘ │ │
┌─────────────────┐
│ │ ──┤GET /foo ├─ │ │
│X-B3-TraceId: aa │ ────┐
│ │ │X-B3-SpanId: 6b │ │ │ │
└─────────────────┘ │ invoke
│ │ │ │ request │
│
│ │ │ │ │
┌────────┐ ───┘
│ │ ─────┤200 OK ├─────── │ │
────┐ └────────┘
│ │ │ record duration │ │
┌────────┐ ───┘
│ ──┤200 OK ├── │ │ │
└────────┘ ┌────────────────────────────────┐
│ │ ──┤ asynchronously report span ├──── │
│ │
│{ │
│ "traceId": "aa", │
│ "id": "6b", │
│ "name": "get", │
│ "timestamp": 1483945573944000,│
│ "duration": 386000, │
│ "annotations": [ │
│--snip-- │
└────────────────────────────────┘
6、 ... and 、 install Zipkin Server side
Two way :
- Build yourself Zipkin Server side
- Use the official compiled jar package
The first method , I read a lot of articles on the Internet , Only written. Zipkin The dependency of does not provide a version number , As a result, dependencies always fail ; The version number is written because of and SpringBoot The service cannot be started due to incompatible versions ;
Finally, I know , stay Springboot 2.0 in the future , Officials no longer recommend building their own Zipkin modular , It is recommended to use the official compiled Jar package 
2.1 download jar package
2.2 Start the service
open cmd, In the corresponding jar Enter the command in the directory where it is stored :
java -jar The full name of the document

Access port 9441, The following interface is displayed, which means the installation is successful 
边栏推荐
- qiao-npms:获取npm包下载量
- Using flying items to manage by objectives, not being a "headless fly" in the workplace
- Interfaces and abstract classes
- MySQL upgrade
- Classical graph theory, depth first and breadth first, topology, prim and krukal, it's time to review
- ICML2022有意思的文章
- leetcode - 518. Change II
- 剑指 Offer 10- II. 青蛙跳台阶问题
- 二、渲染 Camera 的数据
- Pg/oracle database ASCII code to string custom function
猜你喜欢

Oracle learning (I)

Multiple limit of the same field of SQL

Web design and website planning assignment 12 online registration form

Web design and website planning assignment 13 making video playlists

Mongodb--- automatically delete expired data using TTL index

Matlab学习7-图像处理之线性平滑滤波

Supplement 2: circle returning to origin

B+超强树,带你知晓MySQL的底层是怎样的结构

MATLAB R2022a 安装教程

剑指 Offer 21. 调整数组顺序使奇数位于偶数前面
随机推荐
知识图谱入门之---yedda标注
Empty difference between postgrepsql and Oracle
剑指 Offer 40. 最小的k个数
torch. Var (), sample variance, parent variance
一些学习记录i=
Collation of open source modulation identification data set
Web design and website planning assignment 12 online registration form
Uniapp plug-in development
leetcode - 739. 每日温度
B+超强树,带你知晓MySQL的底层是怎样的结构
Design of optimization table
Web design and website planning assignment 11 game selection form
torch. roll
Sword finger offer 21 Adjust array order so that odd numbers precede even numbers
What is concurrent search set? Are you still worried about it? In fact, it is a problem of connected graph, which is not so difficult to understand
XXL task executor calls local project
ActiveMQ simple tutorial, suitable for beginners, learning notes yyds
The role of lambdalr in pytorch
(二)从架构设计角度分析AAC源码-我的LiveData
Classical graph theory, depth first and breadth first, topology, prim and krukal, it's time to review