1、新建 dashboard
模块
1)导jar包
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
<version>2.2.10.RELEASE</version>
</dependency>
2)主启动类
@SpringBootApplication
@EnableHystrixDashboard
public class DepartmentConsumerDashboard_9001 {
public static void main(String[] args) {
SpringApplication.run(DepartmentConsumerDashboard_9001.class,args);
}
}
3)配置yml
server:
port: 9001
hystrix:
dashboard:
proxy-stream-allow-list: "*"

2、修改熔断服务提供者模块

1)必备jar包
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
2)主启动类
@Bean
public ServletRegistrationBean hystrixMetricsStreamServlet() {
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
servletRegistrationBean.addUrlMappings("/actuator/hystrix.stream");
return servletRegistrationBean;
}
management:
endpoints:
web:
exposure:
include: info,health
3、测试





4、总结
- 监控模块的yml中要配置
proxy-stream-allow-list: "*"
- 被监控的方法要有
熔断服务
- 监控页面填写流地址时用
主机名
,不要用ip