yml添加配置org.springframework.cloud spring-cloud-starter-zipkin
spring: zipkin: base-url: http://localhost:9411 sleuth: sampler: #采样率值介于 0 到 1 之间,1 则表示全部采集 probability: 1控制层添加代码
@GetMapping("/consumer/payment/zipkin") public String paymentZipkin() { String result = restTemplate.getForObject("http://localhost:8081"+"/payment/zipkin/", String.class); return result; }改造cloud-consumerzk-order8081 pom添加依赖
yml添加配置org.springframework.cloud spring-cloud-starter-zipkin
spring: zipkin: base-url: http://localhost:9411 sleuth: sampler: #采样率值介于 0 到 1 之间,1 则表示全部采集 probability: 1控制层添加代码
@GetMapping("/payment/zipkin") public String paymentZipkin() { return "hi ,i'am paymentzipkin server fall back,welcome to here, O(∩_∩)O哈哈~"; }运行
县启动本地的zipkin服务,在启动7001,在启动8080和8081
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)