spring-cloud-commons icon indicating copy to clipboard operation
spring-cloud-commons copied to clipboard

Spring Cloud LoadBalancer's cache won't show in /actuator/caches

Open eacdy opened this issue 5 years ago • 4 comments

As the title. I use Spring Cloud LoadBalancer, but When I call /actuator/caches , It just shows json like below:

{
    "cacheManagers": {}
}

I think It Should show Spring Cloud LoadBalancer's cacheManager.

@ryanjbaxter @spencergibb

eacdy avatar Jan 27 '20 10:01 eacdy

I don't know. That is specifically for the cache managers provided by spring framework. As such, it may not be possible to plug in custom cache managers. /cc @wilkinsona @philwebb?

spencergibb avatar Jan 27 '20 18:01 spencergibb

Assuming that the load balancer's cache manager is a org.springframework.cache.CacheManager and that it is exposed as a bean in the application context, it should be picked up by the caches endpoint.

wilkinsona avatar Jan 27 '20 18:01 wilkinsona

This was done very specifically as to not interfere with the user-defined cache manager. Unless we can come up with a simple way to have the cache manager not over-ride the user configured one, we may have to live without the cache manager showing up in the actuator.

spencergibb avatar Jan 27 '20 20:01 spencergibb

from @wilkinsona

You could experiment with that idea without any changes in Boot using a BeanFactoryPostProcessor that calls setPrimary on the cache manager’s bean definition

spencergibb avatar Jan 27 '20 21:01 spencergibb