Hystrix-Dashboard可视化
Hystrix-Dashboard可视化
1.新建子项目引pom.xml
<dependencies> <!--hystrix dashboard--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId> </dependency> <!--监控--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <!--热部署--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency>
2.新建main方法
@EnableHystrixDashboard @SpringBootApplication @Slf4j public class HystrixDashboardMain9001 { public static void main(String[] args) { SpringApplication.run( HystrixDashboardMain9001.class,args); log.info("****************HystrixDashboardMain9001 监控启动 ************ "); } }
3.新建application.yml
server:
port: 9001
4.在需要监控的项目中加入
/** * 此配置是为了服务监控而配置。 与服务容错没有关系。 springcloud升级的一个炕 * 只要在自己的项目中配置下面的servlet即可 * @return */ @Bean public ServletRegistrationBean getServlet(){ HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet(); ServletRegistrationBean<HystrixMetricsStreamServlet> registrationBean = new ServletRegistrationBean<>(streamServlet); registrationBean.setLoadOnStartup(1); registrationBean.addUrlMappings("/hystrix.stream"); registrationBean.setName("HystrixMetricsStreamServlet"); return registrationBean; }
实心的圈圈处了颜色的变化之外,大小也会根据实例的请求的流量发生变化。 流量越大区区圈圈就越大。 所以通过该实心圈就可以发现大量的实例中有故障实例和高压力的实例。
曲线图: 用来记录2分钟的流量的相对变化 。 可以通过它来观察到流量的上升和下降得趋势 。

浙公网安备 33010602011771号