玩转springboot之springboot项目监测

项目监测

springboot中提供了actuator项目来进行监测和度量

基于springboot2.x版本

复制代码
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

actuator中提供了多个端点来对springboot项目进行监测

可以访问http://{ip}:{port}/actuator/{endpoint} 端点来进行访问

  • actuator/archaius
  • actuator/beans 列出应用中的所有bean
  • actuator/caches
  • actuator/caches/{cache}
  • actuator/health 应用健康检查,实现了HealthIndicator,有UP、DOWN、OUTOFSERVICE、UNKNOWN,如果需要查看详情,需要配置 management.endpoint.health.show-details
  • actuator/health/{*path}
  • actuator/info 列出应用信息,在配置中以info开头的配置,实现了InfoContributor接口的配置类
  • actuator/conditions 显示自动配置信息
  • actuator/configprops 显示所有@ConfigurationProperties的配置属性列表
  • actuator/env 列出应用中的配置
  • actuator/env/{toMatch}
  • actuator/loggers/{name}
  • actuator/loggers
  • actuator/heapdump 堆快照
  • actuator/threaddump 线程快照
  • actuator/metrics/{requiredMetricName}
  • actuator/metrics 显示应用度量标准信息
  • actuator/scheduledtasks 列出应用中的定时任务
  • actuator/mappings 列出所有的地址映射
  • actuator/refresh
  • actuator/features
  • actuator/service-registry

如果想要暴露所有的端点,则需要配置暴露所有

复制代码
management:
  endpoints:
    web:   #使用http访问端点暴露,默认根路径是actuator,可以使用base-path来配置
      exposure:
        include: '*'  #暴露所有端点
        exclude: env,mappings  #排除某些端点

https://zhhll.icu/2021/框架/springboot/基础/13.项目监测/

本文由mdnice多平台发布
© 著作权归作者所有,转载或内容合作请联系作者

喜欢的朋友记得点赞、收藏、关注哦!!!

相关推荐
怒放吧德德2 小时前
Netty 4.2 入门指南:从概念到第一个程序
java·后端·netty
雨中飘荡的记忆4 小时前
大流量下库存扣减的数据库瓶颈:Redis分片缓存解决方案
java·redis·后端
心之语歌6 小时前
基于注解+拦截器的API动态路由实现方案
java·后端
初次攀爬者8 小时前
Kafka 基础介绍
spring boot·kafka·消息队列
华仔啊8 小时前
Stream 代码越写越难看?JDFrame 让 Java 逻辑回归优雅
java·后端
ray_liang8 小时前
用六边形架构与整洁架构对比是伪命题?
java·架构
用户8307196840828 小时前
spring ai alibaba + nacos +mcp 实现mcp服务负载均衡调用实战
spring boot·spring·mcp
Ray Liang9 小时前
用六边形架构与整洁架构对比是伪命题?
java·python·c#·架构设计
Java水解9 小时前
SpringBoot3全栈开发实战:从入门到精通的完整指南
spring boot·后端
Java水解9 小时前
Java 中间件:Dubbo 服务降级(Mock 机制)
java·后端