Integrating Hystrix Dashboard in Spring Boot Admin 2
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
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.
Prerequisites
Before using this module, ensure that both the server and all clients use the correct dependencies:
- Server: Spring Boot Admin 2.x (tested with 2.1.5)
- Client: Spring Boot Actuator 2.x (tested with 2.0.0, 2.1.10 and 2.2.0)
- Client: Spring Cloud Starter Netflix Hystrix 2.x (tested with 2.0.4 from Finchley.SR4, 2.1.3 from Greenwich.SR3 and 2.2.0 from Hoxton.RC2)
Installation
To use this module, simply add the following Maven dependency to your Spring Boot Admin application's pom.xml
, rebuild, deploy and enjoy!
pom.xml
1<dependency>2 <groupId>nl.devillers</groupId>3 <artifactId>spring-boot-admin-hystrix-dashboard</artifactId>4 <version>1.0.1</version>5</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:
12019-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)22019-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
:
http://localhost:8080/actuator
1{2 "_links": {3 "self": {4 "href": "http://my.awesome.spring.boot.application.com/actuator",5 "templated": false6 },7 ...8 "hystrix.stream": {9 "href": "http://my.awesome.spring.boot.application.com/actuator/hystrix.stream",10 "templated": false11 }12 }13}
If this is not the case, make sure that:
- The
management.endpoints.web.exposure.include
property includes thehystrix.stream
endpoint (or*
for all endpoints) - The application is annotated with the
org.springframework.cloud.netflix.hystrix.EnableHystrix
annotation from thespring-cloud-starter-netflix-hystrix
package