0

I have a Spring Cloud Consul service that has two applications registered as appservice1 and appservice2. Both applications are exposing a hystrix stream through: http://ip1:8080/appservice1/hystrix.stream and http://ip2:8080/appservice2/hystrix.stream so I can check metrics in another application with the Hystrix Dashboard.

I have created an application with Turbine to aggregate my both applications streams with the same cluster (CLUSTER_NAME) into the hystrix dashboard.

Note: I dont even need to have a cluster for now, I just want both applications in the Hystrix Dashboard

This is my application.yml:

turbine:
  aggregator:
    clusterConfig: CLUSTER_NAME
  appConfig: appservice1,appservice2
  instanceUrlSuffix.CLUSTER_NAME: /hystrix.stream

The problem here is since my both applications have a specific server.contextPath, turbine is not being able to locate the applications /hystrix.stream because is not building the url with each application context path.

The only way I got this working was with this application.yml:

turbine:
  aggregator:
    clusterConfig: appservice1,appservice2
  appConfig: appservice1,appservice2
  instanceUrlSuffix.appservice1: /appservice1/hystrix.stream
  instanceUrlSuffix.appservice2: /appservice2/hystrix.stream

But, this way I would have two clusters, one for each application, and that means I would have to insert each /turbine.stream?cluster=appserviceX separately into the dashboard.

  • First solution, could be to switch from pull to push model with ampq (your services would push messages to a queue, and turbine would read from it) and forget about using context paths. When you want to stick to pull model, I would recommend using actuator management ports to publish hystrix.stream (without any context path). – bart.s Oct 25 '16 at 21:43
  • From what I can see, your configuration is correct and you need to specify one cluster at a time. – spencergibb Oct 26 '16 at 01:21
  • 1
    Thanks for your input @bart.s, that's actually a solution that I am going to consider in a later stage. – Duarte Santos Oct 26 '16 at 08:10
  • @spencergibb thanks for your input. If you have a look at the netflix's implementation of the interface `com.netflix.turbine.monitor.instance.InstanceUrlClosure` you can see that when the url is built, `processAttributeReplacements` is replacing the url placeholders with the Instance attributes. If in consul the service has a `contextPath` tag defined and I set `instanceUrlSuffix.appservice1: {contextPath}/hystrix.stream` it will work. It would be handy if it was covered in Spring's implementation available at `org.springframework.cloud.netflix.turbine.SpringClusterMonitor`. What do you think? – Duarte Santos Oct 26 '16 at 08:20

0 Answers0