监控
<!--引入的zipkinServer依赖--> <dependency> <groupId>io.zipkin.java</groupId> <artifactId>zipkin-server</artifactId> <version>2.9.4</version> </dependency> <dependency> <groupId>io.zipkin.java</groupId> <artifactId>zipkin-autoconfigure-ui</artifactId> <version>2.9.4</version> </dependency>
配置内容:解决zipkin服务后台报错
management.metrics.web.server.auto-time-requests=false
启动类上加入@EnableZipkinServer注解启用zipkin服务
使用http://localhost:9411登录到页面上
在需要监控链路的服务里面加入下面依赖
加入依赖
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-zipkin</artifactId> </dependency>
spring:
zipkin:
base-url: http://localhost:7777 # zipkin服务地址
sleuth:
sampler:
probability: 1 # 抽样百分比
sender:
type: web # 链路类型(kafka,rabbitmq)
实例代码:
https://gitee.com/lm970585581/cloud-config/tree/master/Spring%20Cloud%20Sleuth%E6%9C%8D%E5%8A%A1%E8%B7%9F%E8%B8%AA
/zipkin-server 是监控服务
service-aaa /service-bbb /service-ccc
这三个应用进行链接调用时,可以在zipkin的页面中监控到调用情况