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

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

相关推荐
todoitbo1 分钟前
从 mysql 命令切到 ksql,第一步先把连接搞明白
数据库·mysql·国产数据库·ksql
小小龙学IT3 分钟前
Go 后端并发实战:从 goroutine 到流水线架构
开发语言·架构·golang
marsh02065 分钟前
60 openclaw与物联网:连接物理世界的智能应用
开发语言·物联网·青少年编程·php·技术美术
Sam_Deep_Thinking7 分钟前
结算分摊的策略模式:不同营销活动的扣点计算方案
java·设计模式·架构·系统架构
我有满天星辰13 分钟前
【Dart 语言学习教程 】第三章:函数式编程与高阶特性
开发语言·javascript·ecmascript
wearegogog12317 分钟前
基于C#的电机监控上位机(串口通信+实时波形)
开发语言·c#
星栈独行19 分钟前
Makepad、egui、Dioxus、Tauri:Rust GUI 到底怎么选
开发语言·后端·程序人生·ui·rust
niaiheni21 分钟前
MySQL JDBC 不出网攻击 → Spring 临时文件利用:完整攻击链复现笔记
笔记·mysql·spring
兰令水28 分钟前
leecodecode【回溯组合】【2026.6.5打卡-java版本】
java·开发语言
8Qi828 分钟前
LeetCode 518:零钱兑换 II(Coin Change II)—— 题解 ✅
java·算法·leetcode·动态规划·完全背包