Implementing Hystrix Dashboard in our project

Hystrix Dashboard provides benefits to monitoring the set of metrics on a dashboard. It displays the health of each circuit-breaker in a very simple way. Let's include Hystrix Dashboard in your project by using the Starter with the org.springframework.cloudand group and the spring-cloud-starter-netflix-hystrix-dashboard artifact ID:

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

We have to add in the pom.xml file. But it is not enough to add Hystrix Dashboard in your project, we have to add one more annotation, @EnableHystrixDashboard, to your Spring Boot main class:

@SpringBootApplication 
@EnableEurekaClient 
@EnableCircuitBreaker 
@EnableHystrixDashboard 
public class CustomerServiceApplication { 
 
   public static void main(String[] args) { 
         SpringApplication.run(CustomerServiceApplication.class, args); 
   } 
   ... 
} 

Now run the main class as a Spring Boot application to run Hystrix Dashboard in your project. You can visit /hystrix endpoint to see the dashboard for an individual-instance /hystrix.stream endpoint in a Hystrix client application. Let's access the http://localhost:6161/hystrix URI and see the following output on the browser:

The preceding diagram is a visual dashboard in its initial state. Now let's add the http://localhost:6161/actuator/hystrix.stream URI in the dashboard and click on the Monitor Stream button to get a meaningful dynamic visual representation of the circuit being monitored by the Hystrix component. Let's see the following visual dashboard after providing the stream input in the homepage:

Hystrix provides information about the individual instance using the /hystrix.stream endpoints, but in a distributed system, we must have more than one instance. So, getting a collaborated view about all instances in a distributed system is not possible with Hystrix Dashboard. Spring Cloud Netflix provides a solution to aggregate all the information about all the instances, which is Turbine. Let's discuss it in the next section.

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

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