玩转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多平台发布
© 著作权归作者所有,转载或内容合作请联系作者

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

相关推荐
lgcgkCQ33 分钟前
【AI 转型实战 1】SpringAI 入门:搭建基础大模型对话能力
java·ai·agent·rag·spring ai·mcp·langchain4j
Wang's Blog38 分钟前
Java 项目实战:交友项目 - 用户体系集成总结
java·开发语言·交友
学到老活到老1 小时前
第 24 集:配置文件写了 80,Spring Boot 为什么读到 90?
java·后端·spring
cnskylee1 小时前
【MySQL】麒麟V10 SP3系统安装MySQL-Commercial-8.0.46
数据库·mysql·adb
梦幻通灵1 小时前
修改MySQL数据库递增序列【持续更新】
数据库·mysql
tongyiixiaohuang1 小时前
供应商主数据同步实战:从易快报到金蝶云星空的单一策略落地
java·网络·数据库
中科三方1 小时前
IPv6检测常见问题:AAAA记录检测不通过是什么原因?
开发语言·php
鱼宵2 小时前
取集合第一个元素,Java 为什么要写三种写法?
java·windows·python·java21
特立独行的猫a2 小时前
ROS 2 主流DDS中间件入门:Cyclone DDS 与 Fast DDS 完全指南
中间件·ros2·dds·fast dds·cyclone dds
学长毕设2 小时前
基于SpringBoot的餐厅管理系统-附源码
java·spring boot·后端