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, "");
}
相关推荐
程序员爱钓鱼3 分钟前
Node.js 编程实战:图像与文件上传下载
前端·后端·node.js
程序员爱钓鱼3 分钟前
Node.js 编程实战:日志管理与分析
后端·面试·node.js
kong79069281 小时前
Java-Intellij IDEA 自动导包设置
java·ide·intellij-idea
twj_one5 小时前
Arthas使用
java
lizz315 小时前
C++模板编程:从入门到精通
java·开发语言·c++
吴佳浩6 小时前
Python入门指南(五) - 为什么选择 FastAPI?
后端·python·fastapi
shoubepatien6 小时前
JAVA -- 05
java·开发语言
寰天柚子6 小时前
Java并发编程中的线程安全问题与解决方案全解析
java·开发语言·python
memgLIFE6 小时前
Springboot 分层结构
java·spring boot·spring
GoGeekBaird6 小时前
分享几个使用Nano Banana Pro 画信息图的提示词
后端·github