1、引入依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
<version>2.2.7.RELEASE</version>
</dependency>
<!--
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
-->
引入zipkin之后会自动引入sleuth
2、在application.yml中添加配置
spring:
zipkin:
base-url: http://192.168.3.91:9411/ #zipkin的服务器地址
discovery-client-enabled: false #关闭服务发现,否则spring cloud会把zipkin的url当做服务名称
sender:
type: web #使用http方式传输数据
sleuth:
sampler:
probability: 1 #设置抽样采集率为100%,默认0.1,即10%
logging:
level:
org.springframework.cloud.openfeign: debug
org.springframework.cloud.sleuth: debug