社区微信群开通啦,扫一扫抢先加入社区官方微信群
社区微信群
官方文档:https://docs.spring.io/spring-boot/docs/2.1.0.BUILD-SNAPSHOT/reference/htmlsingle/#production-ready
Spring Boot包含许多附加功能,可帮助您在将应用程序投入生产时监视和管理应用程序。 可以选择使用HTTP端点或JMX来管理和监控您的应用程序,自动应用于审计,健康和指标收集;
一句话:springboot提供用于监控和管理生产环境的模块
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
http://localhost:8080/actuator/health
http://localhost:8080/actuator/info
http://localhost:8080/actuator
官网说明:https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-security-actuator
出于安全考虑,除/ health和/ info之外的所有执行器默认都是禁用的。 management.endpoints.web.exposure.include属性可用于启用执行器
需要在配置文件中加入下列配置
management.endpoints.web.exposure.include=*
在设置management.endpoints.web.exposure.include之前,请确保暴露的执行器不包含敏感信息和/
或通过将其放置在防火墙进行控制,不对外进行使用
禁用的端点将从应用程序上下文中完全删除。如果您只想更改端点所暴露的技术,请改用 include和exclude属性 。
开启全部:management.endpoints.web.exposure.include=*
开启某个:management.endpoints.web.exposure.include=metrics
关闭某个:management.endpoints.web.exposure.exclude=metrics
/actuator/health 查看应用健康指标
/actuator/metrics 查看应用基本指标列表
/actuator/metrics/{name} 通过上述列表,查看具体 查看具体指标
/actuator/env 显示来自Spring的 ConfigurableEnvironment的属性
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!