springboot actuator jvm监控丢失

1、背景

系统接入了监控prometheus和grafana,某天grafana突然发现只有几台机器可以看到指标。

随便点击一个地址http://192.168.0.76:8681/lms/actuator/prometheus访问指标,发现JVM相关指标全部丢失

2、解决方法

从网上查找相关资料,逐一排查,发现可能是组件问题、配置文件或者是依赖的版本问题。

检查git代码,没发现配置或者依赖的变动。

参考文档:https://www.choupangxia.com/2021/07/27/spring-boot-actuator-metrics-no-jvm-info/

然后在项目的启动类里注入bean就行了

复制代码
@Bean
@Lazy(value = false)
InitializingBean forcePrometheusPostProcessor(BeanPostProcessor meterRegistryPostProcessor, PrometheusMeterRegistry registry) {
	return () -> meterRegistryPostProcessor.postProcessAfterInitialization(registry, "");
}
相关推荐
涡能增压发动积1 天前
同样的代码循环 10次正常 循环 100次就抛异常?自定义 Comparator 的 bug 让我丢尽颜面
后端
云烟成雨TD1 天前
Spring AI Alibaba 1.x 系列【6】ReactAgent 同步执行 & 流式执行
java·人工智能·spring
Wenweno0o1 天前
0基础Go语言Eino框架智能体实战-chatModel
开发语言·后端·golang
于慨1 天前
Lambda 表达式、方法引用(Method Reference)语法
java·前端·servlet
swg3213211 天前
Spring Boot 3.X Oauth2 认证服务与资源服务
java·spring boot·后端
tyung1 天前
一个 main.go 搞定协作白板:你画一笔,全世界都看见
后端·go
gelald1 天前
SpringBoot - 自动配置原理
java·spring boot·后端
@yanyu6661 天前
07-引入element布局及spring boot完善后端
javascript·vue.js·spring boot
殷紫川1 天前
深入理解 AQS:从架构到实现,解锁 Java 并发编程的核心密钥
java
一轮弯弯的明月1 天前
贝尔数求集合划分方案总数
java·笔记·蓝桥杯·学习心得