Hystrix服务监控Dashboard仪表盘
在实际生产中,成千上万的服务,我们怎么知道提供服务的高可用情况,即服务的成功失败超时等相关情况;
Hystrix提供了,实时的服务调用监控项目Dashboard,能够实时记录通过Hystrix发起的请求执行情况,并可以通过图表的形式展现给用户看,非常的直观
2.具体实现
第一步:构建Dashboard监控模块,模块名称为:hystrix-dashboard-8080,端口号为:8080
pom.xml文件导入jar包如下:
<dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-hystrix</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> </dependencies>
application.yml文件
server:
port: 8080
context-path: /
启动类:DashboardApplication_8080,
注意添加注解:@EnableHystrixDashboard
package com.wfd360; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; /** * @author 姿势帝-博客园 * @address https://www.cnblogs.com/newAndHui/ * @WeChat 851298348 * @create 07/19 5:12 * @description */ @SpringBootApplication(exclude={DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) @EnableHystrixDashboard public class DashboardApplication_8080 { public static void main(String[] args) { SpringApplication.run(DashboardApplication_8080.class, args); } }