Turbine dashboard

Turbine is a tool for aggregating events produced on Hystrix. Suppose that we have a distributed system with more than 10 microservices and each one with Hystrix. So, it is very difficult to monitor all the circuits. Spring Cloud Netflix offers Turbine to provide aggregation for the circuit-breakers. Turbine is a system that aggregates all the /hystrix.stream endpoints of all microservices of a distributed system into a combined /turbine.stream for use in Hystrix Dashboard.

To include Turbine in your project, add the following Turbine Maven dependency to your pom.xml file:

<dependency> 
   <groupId>org.springframework.cloud</groupId> 
   <artifactId>spring-cloud-starter-netflix-turbine</artifactId> 
</dependency> 

We have added a Maven dependency for Turbine. The spring-cloud-starter-netflix-turbine Starter provides the @EnableTurbine annotation. Annotate your main application class with this annotation to enable Turbine functionality in your project.

Let's see the main application class for this Turbine application:

package com.dineshonjava.turbine; 
 
import org.springframework.boot.SpringApplication; 
import org.springframework.boot.autoconfigure.SpringBootApplication; 
import org.springframework.cloud.netflix.eureka.EnableEurekaClient; 
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; 
import org.springframework.cloud.netflix.turbine.EnableTurbine; 
 
@SpringBootApplication 
@EnableTurbine 
@EnableEurekaClient 
@EnableHystrixDashboard 
public class TurbineApplication { 
 
   public static void main(String[] args) { 
         SpringApplication.run(TurbineApplication.class, args); 
   } 
} 

The main application class has been annotated with the @EnableTurbine annotation to enable Turbine functionality in your project. Other annotations are the same ones we used in earlier examples in the chapter.

Let's see the following configuration files for this Turbine application (application.yml) file:

spring: 
  application: 
    name: turbine 
 
server: 
  port: 6262 
 
eureka: 
  client: 
    service-url: 
      default-zone: ${EUREKA_URI:http://localhost:8761/eureka} 
  instance: 
    prefer-ip-address: true 
     
turbine: 
  aggregator: 
    cluster-config: 
    - CUSTOMER-SERVICE 
  app-config: CUSTOMER-SERVICE 

This configuration file has a configuration for application name, server port, and Eureka registry information, and it has Turbine configurations of the aggregator cluster config and appConfig, which means we have to add those services with @HystrixCommand. Here I have added only one service, (CUSTOMER-SERVICE), to the Turbine aggregator for the Turbine dashboard.

Let's run this Turbine application and look the following Eureka Server Dashboard:

As you can in the preceding screenshot, there are three running instances registered with the Eureka registry server.

Let's open Turbine, following the same steps we completed for Hystrix Dashboard. But here we have to inform the cluster via Turbine as follows: http://localhost:6262/turbine.stream?cluster=CUSTOMER-SERVICE

Now open same screen that we opened with Hystrix with http://localhost:6262/hystrix and use the /turbine.stream endpoint (http://localhost:6262/turbine.stream?cluster=CUSTOMER-SERVICE) instead of the /hystrix.stream endpoint to access the Turbine dashboard. It will open the same screen as Hystrix, but if you have more services, they will appear in an aggregated way. Let's see the following screenshot:

As you can see, it is very similar to the Hystrix Dashboard, but here it is the Turbine dashboard that aggregates all the /hystrix.stream endpoints to a single /turbine.stream endpoint.

Let's discuss the Turbine stream and what t is used for.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset