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

What is the principle of zipkin?

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

Share

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

This article mainly introduces "what is the principle of zipkin". In daily operation, I believe many people have doubts about the principle of zipkin. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubts about "what is the principle of zipkin?" Next, please follow the editor to study!

Through the table structure of zipkin, understand that dapper;trace concatenates multiple span.

Form a dependent link.

structure

Zipkin mainly includes: collector, storage, search, webui

Zipkin collector validates, stores, and indexes an incoming trace data (span).

Storage includes: memory, mysql, es, cassandra.

Data structure

Annotation: used to locate the beginning and end of a request. The cs/sr/ss/cr contains additional information, such as a point in time. When the annotation is recorded, the RPC is considered complete.

Cs:Client Start, indicates that the client initiates the request; the beginning of a span; cr:Client Received, indicates that the client obtains the return information from the server; the end sr:Server Receive of a span indicates that the server receives the request ss:Server Send, indicates that the server completes the processing, and sends the result to the client sr-cs: network delay ss-sr: logical processing time cr-cs: the whole process time

Span: a request (containing a set of Annotation and BinaryAnnotation); it is the basic unit of work that creates a span in a link call (which can be RPC,DB, etc., without specific restrictions) and identifies it through a 64-bit ID. Span also has other data, such as description information, timestamp, (Annotation) tag information of key-value pair, parent-id, etc., in which parent-id can represent the source of span call link, and span is a request for information.

Trace: a collection of Span similar to a tree structure, representing a calling link with a unique identity

Traces are built by collecting all Spans that share a traceId . Through traceId, spanId, and parentId, the collected span is aggregated into a tree, providing an overall process of request.

Flow chart

Image.png

Table design

1.span table

CREATE TABLE IF NOT EXISTS zipkin_spans (`trace_ id` BIGINT NOT NULL, `id` BIGINT NOT NULL, `name` VARCHAR) NOT NULL, `parent_ id` BIGINT, `debug` BIT (1), `start_ Ts` BIGINT COMMENT 'Span.timestamp (): epoch micros used for endTs query and to implement TTL', `duration` BIGINT COMMENT' Span.duration (): micros used for minDuration and maxDuration query') ENGINE=InnoDB ROW_FORMAT=COMPRESSED

Some constraints

ALTER TABLE zipkin_spans ADD UNIQUE KEY (`trace_ id`, `id`) COMMENT 'ignore insert on duplicate';ALTER TABLE zipkin_spans ADD INDEX (`trace_ id`, `id`) COMMENT' for joining with zipkin_annotations';ALTER TABLE zipkin_spans ADD INDEX (`trace_ id`) COMMENT 'for getTracesByIds';ALTER TABLE zipkin_spans ADD INDEX (`name`) COMMENT' for getTraces and getSpanNames';ALTER TABLE zipkin_spans ADD INDEX (`start_ ts`) COMMENT 'for getTraces ordering and range' CREATE TABLE IF NOT EXISTS zipkin_annotations (`trace_ id`BIGINT NOT NULL COMMENT 'coincides with zipkin_spans.trace_id', `span_ id`BIGINT NOT NULL COMMENT' coincides with zipkin_spans.id', `a_ key` VARCHAR) NOT NULL COMMENT 'BinaryAnnotation.key or Annotation.value if type = =-1Qing, `avalue`BLOB COMMENT' BinaryAnnotation.value (), which must be smaller than 64KBamboo, `atype`INT NOT NULL COMMENT 'BinaryAnnotation.type () or-1 if Annotation' `a _ timestamp` BIGINT COMMENT 'Used to implement TTL Annotation.timestamp or zipkin_spans.timestamp', `endpoint_ ipv4` INT COMMENT 'Null when Binary/Annotation.endpoint is null', `endpoint_ ipv6` BINARY (16) COMMENT' Null when Binary/Annotation.endpoint is null, or no IPv6 address', `endpoint_ port`SMALLINT COMMENT 'Null when Binary/Annotation.endpoint is null', `endpoint_service_ name` VARCHAR (255) COMMENT' Null when Binary/Annotation.endpoint is null') ENGINE=InnoDB ROW_FORMAT=COMPRESSED ALTER TABLE zipkin_annotations ADD UNIQUE KEY (`for joining with zipkin_spans';ALTER TABLE zipkin_annotations ADD INDEX id`, `span_ id`, `a_ key`, `a_ timestamp`) COMMENT 'Ignore insert on duplicate';ALTER TABLE zipkin_annotations ADD INDEX (`trace_ id`, `span_ id`) COMMENT' for joining with zipkin_spans';ALTER TABLE zipkin_annotations ADD INDEX (`trace_ id`) COMMENT 'for getTraces/ByIds';ALTER TABLE zipkin_annotations ADD INDEX (`endpoint_service_ name`) COMMENT' for getTraces and getServiceNames';ALTER TABLE zipkin_annotations ADD INDEX (`a_ type`) COMMENT 'for getTraces' ALTER TABLE zipkin_annotations ADD INDEX (`a _ key`) COMMENT 'for getTraces'

3. Dependency relationship

CREATE TABLE IF NOT EXISTS zipkin_dependencies (`day` DATE NOT NULL, `parent` VARCHAR (255) NOT NULL, `child` VARCHAR (255) NOT NULL, `childent` BIGINT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;ALTER TABLE zipkin_dependencies ADD UNIQUE KEY (`day`, `parent`, `child`). At this point, the study of "what is the principle of zipkin" is over. I hope to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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