sleuth负责整理, zipkin负责展现

 

1.安装zipkin

下载jar包:  https://search.maven.org/remote_content?g=io.zipkin.java&a=zipkin-server&v=LATEST&c=exec

运行jar

spring 链路监控

 

 访问主页成功: http://localhost:9411/zipkin/ 

spring 链路监控

 

 

 

2. 代码

在需要被监控的微服务下都引入以下pom和yml:

        <!--引入springCloud链路调用监控 包含sleuth和zipkin-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-zipkin</artifactId>
        </dependency>
spring:
  application:
    name: cloud-order-service
  zipkin:
    base-url: http://localhost:9411
  sleuth:
    sampler:
      probability: 1   #采样率值范围是0-1, 1则表示全部采集

 

3.测试:

访问:http://localhost/consumer/payment/get/31

再看zipkin就能查找到调用链路

spring 链路监控

 

 

github代码:

 https://github.com/lulu4pix/springcloud/commit/2dfca7b668c309e2258803b2b325c0e0f1c87c0f

相关文章:

  • 2021-06-10
  • 2021-12-02
  • 2021-07-09
  • 2021-09-27
  • 2022-01-21
  • 2021-12-13
  • 2021-06-29
  • 2022-12-23
猜你喜欢
  • 2021-07-06
  • 2021-11-07
  • 2021-04-13
  • 2022-12-23
  • 2021-05-10
  • 2022-12-23
  • 2022-02-13
相关资源
相似解决方案