springcloud Sleuth(链路监控)

在微服务系统中,随着业务的发展,系统会变得越来越大,那么各个服务之间的调用关系也就变得越来越复杂。一个 HTTP 请求会调用多个不同的微服务来处理返回最后的结果,在这个调用过程中,可能会因为某个服务出现网络延迟过高或发送错误导致请求失败,这个时候,对请求调用的监控就显得尤为重要了。

1.添加依赖

在需要监控的项目里面添加

<!-- actuator监控信息完善 -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>

2.yml添加配置 在相关项目里面添加

spring:
  zipkin:
    base-url: http://192.168.0.114:9411/

3.在provider项目里面添加注解

@RefreshScope //在引用了远程配置文件属性的类上 ,加上注解@RefreshScope

// 4.远程配置文件变啦 手动更改配置

cmd里面curl -X POST  http://localhost:9999/actuator/refresh

posman里面  http://localhost:9999/actuator/refresh

5.vm虚拟机里面 启动服务 docker run -d -p 9411:9411 openzipkin/zipkin

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值