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

6th
Jul 2017
JonathanAaron
@JonathanAaron
Jul 06 2017 19:03
Sup. So I'm using Ribbon and I have a list of servers I've listed in my application.yml. I'm using Ribbon for load balancing and I would like to log which server my application is hitting when my endpoint is used? I'm not sure how to log it.
or find out which server my app is hitting.
Spencer Gibb
@spencergibb
Jul 06 2017 19:03
how are you using it?
JonathanAaron
@JonathanAaron
Jul 06 2017 19:05
I have a RestService annotated with Ribbon Client and it's using whatever url that ribbon is passing to it.
I'm using a BasicAuthRestTemplate
Unfortunately I'm not the one who wrote this part of the code. I'm just adding more servers to the config and wanted to verify that it's indeed loadbalancing.
Spencer Gibb
@spencergibb
Jul 06 2017 19:06
so a RestTemplate. Is it annotated with @LoadBalanced?
I don't know what RestService and BasicAuthRestTemplate are
JonathanAaron
@JonathanAaron
Jul 06 2017 19:07
yes
```private String disableOptions;
@LoadBalanced
@Bean(name = "restTemplate")
@Primary
public BasicAuthRestTemplate getRestTemplate() {

    log.info(new Object(){}.getClass().getEnclosingMethod().getName() + "() was called; Bean restTemplate Created");
    BasicAuthRestTemplate restTemplate = new BasicAuthRestTemplate(elasticUserID, elasticUserPWD, disableOptions);
    return restTemplate;
}```
That's from my javaconfig
There is a @LoadBalanced above the @Bean....
I missed it.
Spencer Gibb
@spencergibb
Jul 06 2017 19:10
There is some debug logging in the com.netflix.loadbalancer package that will tell you if your new url is part of the group. As for seeing which one it picked, you might have to do some http client logging. We should have some logging where it chooses, but we do not.
JonathanAaron
@JonathanAaron
Jul 06 2017 19:13
Oh okay. Thanks for checking it out man!
JonathanAaron
@JonathanAaron
Jul 06 2017 20:18
Another Ribbon question. We're currently using ribbon to load balance to different elaticsearch client nodes. We are switching to https. do I just need to isSecure: true to my config and it's set to use https or is there more to it. We're not using Zuul or Eureka at the moment.
Spencer Gibb
@spencergibb
Jul 06 2017 20:19
yes
JonathanAaron
@JonathanAaron
Jul 06 2017 20:29
Thanks again @spencergibb