These are chat archives for spring-cloud/spring-cloud

8th
Jan 2019
HubertTatar
@HubertTatar
Jan 08 07:58
Hi, is there any particular reason that one cannot disable list of services in spring-cloud-consul healthcheck ?
Marcos Barbero
@marcosbarbero
Jan 08 08:09
Hi @HubertTatar what do you mean? If you want to disable a service healthcheck endpoint you need to do it in the service itself, management.endpoint.consul.enabled=false should do
HubertTatar
@HubertTatar
Jan 08 08:14
@marcosbarbero I want to have healthcheck enabled, but it always list all services from discovery, it doubles the size of healthcheck, I would like to only to have status shown
Marcos Barbero
@marcosbarbero
Jan 08 08:17
You mean in the UI?
HubertTatar
@HubertTatar
Jan 08 08:24
"consul": { "leader": "172.20.0.21:8300", "services": { "rabbitmq": [], "rabbitmq": [], "rabbitmq": [], "service1": [ tags... ], ...
typical helacheck looks like that
but there are lots of services and tags.
In consul ui you cannot see details of healthcheck because of that, and queries of health are kinda big because of all these information carried
and it looks like quite easy change in ConsulHealthIndicator, so Im asking is there any particular reason for showing all this information in healthcheck, without option to disable it
Marcos Barbero
@marcosbarbero
Jan 08 08:32
it's done like that to provide as much info as possible out of the box, I think the easiest way to go is implementing your own ConsulHealthIndicator, as you can see here it's a conditional bean
HubertTatar
@HubertTatar
Jan 08 08:42
I've done that, I was just curious about default implementation. Thx for reply.
Marcos Barbero
@marcosbarbero
Jan 08 08:59
Nie ma za co
Marcin Grzejszczak
@marcingrzejszczak
Jan 08 09:00
:laughing:
Marcos Barbero
@marcosbarbero
Jan 08 09:01
hahaha I know how to summon you @marcingrzejszczak
Marcin Grzejszczak
@marcingrzejszczak
Jan 08 09:01
now I feel like a deamon
cause you need to summon me
Marcos Barbero
@marcosbarbero
Jan 08 09:01
you're not wrong
hahaha
Hugh Hamill
@hughwphamill
Jan 08 09:53
@spencergibb Yeah it's a hard problem to solve for sure. Maybe it's one that has to be tackled at the back end server.
Gilles Robert
@ask4gilles
Jan 08 18:52

@spencergibb just adding @RefreshScope on my LocalContainerEntityManagerFactoryBean and removing unnecessary PlatformTransactionManager (already auto configured) does the trick. I can now enable/disable hibernate stats on the fly. Thx!

@spencergibb I do see that JpaProperties are refreshed but not taken into account.
Here is my config, but I guess this property is tight to the hibernate session factory which is not refreshed... ?

@Bean
  public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource,
                                                                     JpaProperties jpaProperties) {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
    factoryBean.setDataSource(dataSource);
    factoryBean.setPackagesToScan("x.y.z");
    factoryBean.setJpaVendorAdapter(vendorAdapter);
    factoryBean.setJpaPropertyMap(jpaProperties.getProperties());

    return factoryBean;
  }
Spencer Gibb
@spencergibb
Jan 08 23:53
sweet @ask4gilles good to know!