Advertisement

Java架构师学习如何使用Spring Boot 2.0 Actuator进行实时监控和优化应用性能。

阅读量:

启动监控功能

org.springframework.boot

spring-boot-starter-actuator

< /dependency>

默认启用的端点

在Spring Boot 2.0版本中,Actuator模块仅默认启用了health与info两个端点,所提供的监控数据难以满足实际使用场景的需求。而在1.x版本中,系统提供了大量可供监控的节点,官方给出的解释是出于安全考虑。

激活全部端点

为了实现对所有端点的访问权限,在application.yml配置文件中添加如下设置内容

*表示加载所有可用端点

management:

endpoints:

web:

exposure:

include:

- "*"

Health端点

该端点用于展示系统的当前运行状态

{"status":"UP"}

shutdown端点

此功能可用于远程关闭应用实例。若需启用该功能,需进行如下配置

management:

endpoint:

shutdown:

enabled: true

通过发送Post请求至对应端点即可触发关闭操作

{

"message": "Shut

全部评论 (0)

还没有任何评论哟~