熔断监控HystrixDashBoard
1. Ribbon+HystrixDashboard
- 使用Consumer9001改造,pom中增加依赖(actuator/hystrix/hystrixdashboard必备)
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
</dependency>
- 启动类上开启注解@EnableHystrixDashboard
@SpringBootApplication
@EnableEurekaClient
@EnableCircuitBreaker
@EnableHystrixDashboard
public class Consumer9001 {
public static void main(String[] args) {
SpringApplication.run(Consumer9001.class, args);
}
}
- application中暴露监控信息
#暴露hystrix dashboard的全部监控信息
management:
endpoints:
web:
exposure:
include: ["health","info","hystrix.stream"]
2. Feign + HystrixDashboard
- 使用ConsumerFeign9101项目改造,pom中引入支持文件
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
- 修改主配置类,增加@EnableCircuitBreaker和@EnableHystrixDashboard注解
@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients
@EnableCircuitBreaker
@EnableHystrixDashboard
public class ConsumerFeign9101 {
public static void main(String[] args) {
SpringApplication.run(ConsumerFeign9101.class, args);
}
}
- application.yml中暴露actuator全部监控信息
#暴露hystrix dashboard的全部监控信息
management:
endpoints:
web:
exposure:
include: "*"
- Hystrix DashBoard参数解释(来源于github-wiki)