Spring Cloud Sleuth服務跟蹤
阿新 • • 發佈:2018-11-06
監控
<!--引入的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服務
程式碼:https://gitee.com/lm970585581/cloud-config/tree/master/zipkin-server
使用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/service-aaa /service-bbb /service-ccc
這三個應用進行連結呼叫時,可以在zipkin的頁面中監控到呼叫情況