相关疑难解决方法(0)

升级到Spring Boot 2后,如何将缓存指标公开给Prometheus?

我最近将Spring Boot应用程序从1.5升级到了2.0.1。我还使用千分尺将Prometheus集成迁移到了新的执行器方法。现在大多数事情都可以工作-包括一些自定义计数器和量规。

我注意到新的Prometheus端点/actuator/prometheus不再发布Spring缓存指标(大小和命中率)。

我唯一能找到的就是这个问题及其相关的提交

仍然无法在Prometheus导出上获取缓存指标。我尝试设置一些属性:

management.metrics.cache.instrument-cache=true
spring.cache.cache-names=cache1Name,cache2Name...
Run Code Online (Sandbox Code Playgroud)

但是什么都没有。我可以看到Hazelcast高速缓存管理器正在启动,注册了高速缓存管理器bean等等,但是都/metrics没有/prometheus显示任何统计信息。使用@Cacheable注释填充缓存。这与Spring Boot 1.5一起使用-我认为通过Hazelcast通过JMX公开了其指标,而prometheus出口商从那里获取了它吗?

现在不确定如何将其连接在一起。任何提示都欢迎!

hazelcast spring-boot spring-cache spring-boot-actuator prometheus

5
推荐指数
1
解决办法
3114
查看次数