Integrating Hystrix Dashboard in Spring Boot Admin 2

Door Martin Devillers Op 19 November 2019 Met Reacties

After upgrading a dozen Spring Boot applications from 1.x to 2.x I noticed that the UI of the new Spring Boot Admin 2 application no longer showed the Hystrix Dashboard. A quick look at the release notes of Spring Boot Admin 2 revealed that support for Hystrix Dashboard was dropped in version 2. As my teams rely on Hystrix Dashboard to perform ops on our Spring Boot applications, I decided to use my spare time to hack together a module that brings it back to live! Below is a copy of the guide to getting this module up and running quickly. For a more complete and up-to-date manual, please look at the module’s README on GitHub.

Note: as of 19 november 2018, Hystrix has entered maintenance mode. If you’re doing a greenfield project I suggest you look into a more modern fault tolerance library like resilience4j and using Grafana to generate a dashboard. For those without this luxury, I hope this module will suffice.

Hystrix Dashboard for Spring Boot Admin 2.x

Maven Central Build Status GitHub last commit GitHub stars

This module adds Hystrix Dashboard to Spring Boot Admin 2.x. It is implemented as a Custom View Module using the spring-boot-admin-sample-custom-ui project as a template.

Screenshot dashboard


Prerequisites

Before using this module, ensure that both the server and all clients use the correct dependencies:

Installation

To use this module, simply add the following Maven dependency to your Spring Boot Admin application’s pom.xml, rebuild, deploy and enjoy!

<dependency>
    <groupId>nl.devillers</groupId>
    <artifactId>spring-boot-admin-hystrix-dashboard</artifactId>
    <version>1.0.1</version>
</dependency>

 

Troubleshooting

If the Hystrix option does not appear in the instances view, then first make sure that Spring Boot Admin has loaded this module correctly by checking the logs during startup. The logs should show two entries like the following:

2019-11-15 13:31:30.627  INFO 17624 --- [           main] b.a.s.u.c.AdminServerUiAutoConfiguration : Loaded Spring Boot Admin UI Extension: UiExtension(resourcePath=hystrix-dashboard/css/custom.6134ab29.css, resourceLocation=classpath:/META-INF/spring-boot-admin-server-ui/extensions/hystrix-dashboard/css/custom.6134ab29.css)
2019-11-15 13:31:30.628  INFO 17624 --- [           main] b.a.s.u.c.AdminServerUiAutoConfiguration : Loaded Spring Boot Admin UI Extension: UiExtension(resourcePath=hystrix-dashboard/js/custom.6b4c7d50.js, resourceLocation=classpath:/META-INF/spring-boot-admin-server-ui/extensions/hystrix-dashboard/js/custom.6b4c7d50.js)

 
Second, check that the Hystrix Stream endpoint in the Spring Boot application is properly exposed to Spring Boot Actuator by querying the discovery endpoint. This endpoint is accessible at the base-path of Spring Boot Actuator (default: /actuator). The output should list an entry for hystrix.stream:

{
	"_links": {
		"self": {
			"href": "http://my.awesome.spring.boot.application.com/actuator",
			"templated": false
		},
		...
		"hystrix.stream": {
			"href": "http://my.awesome.spring.boot.application.com/actuator/hystrix.stream",
			"templated": false
		}
	}
}

 
If this is not the case, make sure that:

  • The management.endpoints.web.exposure.include property includes the hystrix.stream endpoint (or * for all endpoints)
  • The application is annotated with the org.springframework.cloud.netflix.hystrix.EnableHystrix annotation from the spring-cloud-starter-netflix-hystrix package