下载安装Zipkin
官网地址
https://github.com/openzipkin/zipkin/
点击跳转GitHub下载
运行启动
在下载的jar包目录打开cmd执行命令启动
java -jar .\zipkin-server-3.0.0-rc0-exec.jar
浏览器访问
微服务客户端
引入依赖
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
</dependencies>
yml配置
spring:
application:
name: cloud-sleuth
sleuth:
sampler:
# 采样率,0~1,1表示全部采集
probability: 1
zipkin:
base-url: http://localhost:9411/
service:
name: ${spring.application.name}
运行测试
分别启动各微服务,测试接口调用,在Zipkin界面可看到调用链路