微服务 教程
1085个小节阅读:195.7k
目录
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
Spring Boot Actuator可以帮助程序员监控和管理SpringBoot应用,比如健康检查、内存使用情况统计、线程使用情况统计等。我们在SpringBoot项目中添加Actuator功能,即可使用Actuator监控项目,用法如下:
在被监控的项目中添加Actuator起步依赖
xxxxxxxxxx
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
编写配置文件
xxxxxxxxxx
#开启所有监控端点
management.endpoints.web.exposure.include=*
通过URL可以调用actuator的功能:
URL | 查看的数据 |
---|---|
/env | 环境属性 |
/health | 健康检查 |
/mappings | 显示所有的@RequestMapping路径 |
/loggers | 日志 |
/info | 定制信息 |
/metrics | 查看内存、CPU核心等系统参数 |
/trace | 用户请求信息 |
例如查询健康数据,访问http://localhost:8080/actuator/health
1. 在SpringBoot使用Actuator监控项目,查看系统参数的URL为
A /env
B /health
C /mappings
D /metrics
2. 在SpringBoot使用Actuator监控项目,查看所有的@RequestMapping
路径的URL为
A /env
B /health
C /mappings
D /metrics
1=>D 2=>C