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

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

相关推荐
码兄科技3 小时前
实战:基于Spring Boot + UniApp的地理信息小程序开发
spring boot·后端·uni-app
程序喵大人3 小时前
【C++进阶】STL容器与迭代器 - 01 STL 容器先解决元素放在哪里
开发语言·c++·stl
cui_ruicheng4 小时前
Python从入门到实战(十六):多进程编程
开发语言·python
Jelena157795857924 小时前
电商运营分析数据比价接口实战:多平台价格监控与智能决策系统
java·大数据·数据库
wdfk_prog5 小时前
嵌入式面试真题第 15 题:不可恢复异常后的通用崩溃快照、调用栈保存与离线分析架构
linux·开发语言·面试·架构
晴空了无痕5 小时前
从 Go 基础到 K8s:一条可落地的 Go 服务端成长路线
开发语言·后端·golang·kubernetes
神明不懂浪漫5 小时前
【第五章】Java中的继承与多态
java·开发语言
二宝哥6 小时前
MySQL 修改密码策略详解:从基础到高级配置
mysql·密码学
jieyucx6 小时前
Nuxt4阶段六:工程化与进阶 —— 模块、中间件、插件、TS 与测试
中间件·vue·web·nuxt·全栈·ssr
神州世通6 小时前
解密企业通信安全防线:Avaya Aura 三层安全架构深度解析
开发语言·php