基于微服务的秒杀项目实战使用Spring Boot2.x Actuator监控应用

本次内容,小编我将从开启监控、默认端点、开启所有端点三大方面给大家叙述。

(1)开启监控

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-actuator</artifactId>

</dependency>

(2)默认端点

Spring Boot 2.0 的Actuator只暴露了health和info端点,提供的监控信息无法满足我们的需求

在1.x中有n多可供我们监控的节点,官方的回答是为了安全….

(3)开启所有端点

在application.yml中加入如下配置信息

*代表所有节点都加载

management:

endpoints:

web:

exposure:

include:

- "*"

1)Health

会显示系统状态

{"status":"UP"}

2)shutdown

用来关闭节点

开启远程关闭功能

management:

endpoint:

shutdown:

enabled: true

使用Post方式请求端点

{

"message": "Shutting down, bye..."

}

autoconfig

获取应用的自动化配置报告

3)beans

获取应用上下文中创建的所有Bean

基于微服务的秒杀项目实战使用Spring Boot2.x Actuator监控应用

 

4)configprops

获取应用中配置的属性信息报告

基于微服务的秒杀项目实战使用Spring Boot2.x Actuator监控应用

 

5)env

获取应用所有可用的环境属性报告

基于微服务的秒杀项目实战使用Spring Boot2.x Actuator监控应用

 

本次内容暂时写到这里了,有什么意见大家可以在评论区留言哦!

另外,小编也整理出一份完整学习资料,包括视频和课件,有需要的小伙伴可以私信我免费领取哦!给自己指明一个方向!!!