SpringBoot1.5.x 使用prometheus监控Tomcat线程显示异常解决办法

2020年4月24日17:21:32 发表评论 5,301 ℃

项目之前一直使用的SpringBoot 1.5.10 (SpringCloud Dalston.RELEASE),prometheus监控的依赖micrometer-registry-prometheus 1.0.3;监控数据一切正常。

但是在发现Spring-cloud-netflix 1.4.x存在严重bug以后,升级了版本到SpringBoot 1.5.22 (SpringCloud Edgware.SR6),然后就出现了诡异的问题,有些服务Tomcat线程监控项显示为0,有些服务却正常,通过debug获取Tomcat线程,这些显示为0的服务,只是显示异常,实际线程配置已经生效。

tomcat_threads_config_max{application="micrometer-gateway",name="http-nio-8080",} 0.0

tomcat_threads_busy{application="micrometer-gateway",name="http-nio-8080",} 0.0

tomcat_threads_current{application="micrometer-gateway",name="http-nio-8080",} 0.0

总结最近遇到的一些灵异问题,好多都是版本原因导致,想着把prometheus监控的依赖版本升级试试,在Apache中央仓库查了下,发现此版本最高是micrometer-registry-prometheus 1.0.11,果断把micrometer-spring-legacy和micrometer-registry-prometheus升级到了1.011,测试显示就正常了。

【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: