spring-cloud / spring-cloud-commons

Common classes used in different Spring Cloud implementations
Apache License 2.0
707 stars 704 forks source link

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

Open eacdy opened 4 years ago

eacdy commented 4 years ago

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

spencergibb commented 4 years ago

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?

wilkinsona commented 4 years ago

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.

spencergibb commented 4 years ago

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 commented 4 years ago

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