Springboot -actuator实现机制解析

1:springbootAdmin基于SpringbootActuator实现springWeb项目的指标监控

2:springbootAdmin-server使用Webflux(在类AbstractInstancesProxyController)将接口暴露出去,然后springbootAdmin--server-ui作为前端接收参数展示,其中InstancesController 提供一个POST方法,用于给客户端注册

3:spring-boot-admin-server

服务端心跳检测通过类:StatusUpdateTrigger(定时器调用状态更新器)  &&   StatusUpdater(状态更新器,使用WebClient更新状态,doUpdateStatus方法)

在spring-boot-admin-server-cloud中AdminServerDiscoveryAutoConfiguration注册服务发现客户端和一个DefaultServiceInstanceConverter(若有eureka配置则会使用eureka的客户端),其中DefaultServiceInstanceConverter实现将service(服务)转换成Registration(admin的注册对象)

 

 

4:spring-boot-admin-client

客户端心跳检测(检测服务端是否连接得上)通过  RegistrationApplicationListener

admin客户端(springboot-actuator):通过定时任务通过各种实现HealthIdicator接口完成具体逻辑(db,disk,es等的检测),HealthIdicator返回builder(内部是details(map结构)和status(业务状态))

客户端对于各种状态的收集,通过 DefaultHealthIndicatorRegistry的register方法注册到Map结构中,然后CompositeHealthIndicator的health方法进行组合成Health对象(通过函数式接口HealthAggregator将状态,空值等处理为定义的统一写法

 

 

关于服务端和客户端互相定时轮询结果:(参考)

https://blog.csdn.net/jrn1012/article/details/76906480

(Admin-server服务端使用consul/eureka读取客户端信息,客户端直接使用actuator可以不使用springbootAdmin-client,服务端直接请求的是actuator的endpoint接口)

 

5:Endpoint   是springboot-actuator暴露接口对外(springbootAdmin请求的就是这样的接口)的方式,这种方式只需要实现Endpoint这个接口,返回的id就就是请求路径(前面加actuator/id)

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值