关于springboot:10SpringBoot-工程的健康监控实现

1次阅读

共计 670 个字符,预计需要花费 2 分钟才能阅读完成。

衰弱监控简述

Spring Boot 中 actuator 模块提供了健康检查,审计、指标收集,HTTP 跟踪等性能,能够帮忙咱们更好的治理和跟踪 springboot 我的项目。

衰弱监控配置实现

在须要应用衰弱监控的我的项目或 module 中,增加如下依赖:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

增加完依赖当前,reload 我的项目或 module。

衰弱监控启动剖析

启动我的项目, 在浏览器中输出如下地址:(SpringBoot 默认关上的监控选项无限)

http://localhost/actuator

其拜访后果, 如图所示:

还能够在 actuator 列出的选中中进行点击, 例如拜访 health

http://localhost/actuator/health

其出现后果, 如图所示 (其中 up 状态示意失常):

如果心愿查看更多 actuator 选项,能够在 spring boot 中配置文件

application.properties 中增加如下语句:

management.endpoints.web.exposure.include=***

而后, 重启服务器, 基于拜访 http://localhost/actuator 地址 …)

总结 (Summary)

本大节次要是对 springboot 工程中的衰弱监控性能做了一个繁难剖析和实现, 本人能够基于业务的须要, 进行监控的配置和剖析.

正文完
 0