1.pom添加依赖
复制代码
1
2
3
4
5
6<!-- hystrix dashboard 图形化监控依赖 --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId> </dependency>
2.启动类加注解@EnableHystrixDashboard
3.重启项目,浏览器输入http://localhost:8085/hystrix
点击Monltor Stream进入,发现报错
这是因为springcloud(Finchley.SR2)需要使用这个地址: http://localhost:9721/actuator/hystrix.stream!!!
而不是http://localhost:9721/hystrix.stream地址
修改地址:
将下面的代码配置加到Application启动类的配置中
复制代码
1
2
3
4
5
6
7
8
9
10@Bean public ServletRegistrationBean getServlet() { HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet(); ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet); registrationBean.setLoadOnStartup(1); registrationBean.addUrlMappings("/hystrix.stream"); registrationBean.setName("HystrixMetricsStreamServlet"); return registrationBean; }
重启项目
postman模拟发送请求
最后
以上就是执着网络最近收集整理的关于8.集成Hystrix Dashboard配置及图形化监控的全部内容,更多相关8.集成Hystrix内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复