当前位置:网站首页>Construction and integration of Zipkin and sleuth for call chain monitoring

Construction and integration of Zipkin and sleuth for call chain monitoring

2022-07-06 06:15:00 Snow peak expensive


Preface

sleuth yes spring-clude Distributed tracking solution for

Calls between microservices are divided into 4 Step

  1. cs client-send
  2. sr server-receive
  3. ss server-send
  4. cr client-receive
    Therefore, the monitoring of the call chain is divided into four records , Who sent it is recorded , Who receives it , And time , Time consuming, etc , A piece of data is recorded as a span( span ), A group of four is recorded as trace( track )

One 、Zipkin、sleuth Build and integrate

1. Plus dependence

spring-cloud-starter-zipkin Contains spring-cloud-starter-sleuth

<dependency>
   <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>

2. download zipkin

https://search.maven.org/remote_content?g=io.zipkin.java&a=zipkin-server&v=LATEST&c=exec

zipkin yes spring-boot project ,java -jar Start it up port 9411
Access address http://localhost:9411

3. Add configuration

spring:
	zipkin:
	    base-url: http://localhost:9411
	sleuth:
	    sampler:
	      probability: 1.0 # Sampling rate    Default 0.1

4. test

Access to microservices :http://localhost:8084/users/{id}
 Insert picture description here
 Insert picture description here
 Insert picture description here
Click to display 4 Data is one trace

原网站

版权声明
本文为[Snow peak expensive]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207060607583958.html