Monitor multiple services using Hystrix Dashboard and Turbine Stream from Spring Cloud Netflix

I have introduced you to Hystrix and Hystrix Dashboard to monitor calling to other services of service in the Microservices system. One problem is: we have a lot of services in a Microservices system, we have to open the Hystrix Dashboard of each service to monitor them, aren’t we? It’s more convenient if we can combine the Hystrix Dashboard of all services into a Dashboard and just need to monitor this Hystrix Dashboard. Thankfully we can do this with using Netflix’s Turbine or Turbine Stream and their wrappers from Spring Cloud Netflix. How is it in details? Let’s find out about Turbine Stream first in this tutorial!

To be an example of this tutorial, I will create 3 services with 1 service with a request URL will be called from the other 2 services.

As follows:

Service 1 exposes a request URL “/hello”:

Monitor multiple services using Hystrix Dashboard and Turbine Stream from Spring Cloud Netflix

We only need to use the Web dependency for this service. Controller expose request URL “/hello” has the following content:

application.properties:

2 service calls to Service 1 above will use Web, Hystrix, Actuator as follows:

Service 2:

Monitor multiple services using Hystrix Dashboard and Turbine Stream from Spring Cloud Netflix

Service2Controller:

SpringCloudTurbineService2Application:

application.properties:

Service 3

Monitor multiple services using Hystrix Dashboard and Turbine Stream from Spring Cloud Netflix

Service3Controller:

SpringCloudTurbineService3Application:

application.properties:

As you can see, both services 2 and 3 call the “/hello” URL request of Service 1 and they are all enabled for Circuit Breaker support.

Next, I will create a separate project that acts as a Hystrix Dashboard, if you don’t have a Turbine Stream, you can only monitor 1 service at a time:

Monitor multiple services using Hystrix Dashboard and Turbine Stream from Spring Cloud Netflix

SpringCloudTurbineHystrixDashboardApplication:

application.properties:

Now if you run all the applications:

Monitor multiple services using Hystrix Dashboard and Turbine Stream from Spring Cloud Netflix

Request to Hystrix Dashboard:

Monitor multiple services using Hystrix Dashboard and Turbine Stream from Spring Cloud Netflix

Enter Hystrix Stream URL of service 2 or service 3, then click Monitor Stream.

Request the URL http://localhost:8083/service2-call-hello or http://localhost:8084/service3-call-hello, you will see Hystrix Dashboard will have the following results:

Monitor multiple services using Hystrix Dashboard and Turbine Stream from Spring Cloud Netflix

You can see that we cannot monitor multiple services at the same time in Hystrix Dashboard.

Now let’s try using Turbine Stream.



To use Turbine Stream, you need to use an MQ server.

All data will be sent to this MQ server.

Here, I will use the RabbitMQ server! You can refer to the tutorial about installing RabbitMQ with Management UI for it to start a server RabbitMQ for yourself.

My RabbitMQ starts as follows:

Monitor multiple services using Hystrix Dashboard and Turbine Stream from Spring Cloud Netflix

The username and password for this RabbitMQ will be guest/guest!

OK, now we will configure service 2 and service 3 so that they can send data to the MQ server. I will add each service to the dependency project as after:

Currently, the latest version of Spring Cloud is having problems, Turbine Stream does not work with this version, you need to use Spring Cloud version Greenwich.M1. Please open pom.xml file of 2 services 2 and 3, edit Spring Cloud version as follows:

Configure RabbitMQ information so that these services send data to MQ server in application.properties file as follows:

After configuring the send data section to MQ Server for services, you need to create another project that serves as Turbine Stream and combine the data in the MQ server to send to Hystrix Dashboard.

The project is as follows:

Result:

In the SpringCloudTurbineStreamApplication class, add the annotation @EnableTurbineStream to implement Turbine Stream. By default Turbine Stream will try to register it with Eureka Server so if you do not disable it, there will be many errors.

Please disable this and configure RabbitMQ server information in the application.properties file of the project. This is as follows:

OK, now start all the apps on you guys:

Monitor multiple services using Hystrix Dashboard and Turbine Stream from Spring Cloud Netflix

Go to Hystrix Dashboard, enter Turbine Stream information http://localhost:8989 turbine.stream, click the Monitor Stream button, call 2 service requests 2 and 3: http://localhost:8083/service2-call-hello, http://localhost:8084/service3-call-hello, you will see the following result:

Monitor multiple services using Hystrix Dashboard and Turbine Stream from Spring Cloud Netflix

Đánh giá bài viết
Chia sẽ bài viết này ...Share on Facebook
Facebook
0Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin

Add Comment