一. 引入
-
pom.xml中加入依赖
<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>
-
启动类添加注解“@EnableHystrixDashboard”
-
配置文件添加endpoint
management:
endpoints:
web:
exposure:
include: "*"
-
访问入口
-
Hystrix Dashboard输入: http://localhost:8781/actuator/hystrix.stream
-
参考资料
-
配置文件类:spring-configuration-metadata.json
二. 仪表盘参数解析
-
首页
-
监控方式
-
默认的集群监控:通过URLhttp://turbine-hostname:port/turbine.stream开启,实现对默认集群的监控。
-
指定的集群监控:通过URLhttp://turbine-hostname:port/turbine.stream?cluster=[clusterName]开启,实现对clusterName集群的监控。
-
单体应用的监控:通过URLhttp://hystrix-app:port/hystrix.stream开启,实现对具体某个服务实例的监控。
-
-
delay:该参数用来控制服务器上轮询监控信息的延迟时间,默认为2000毫秒,我们可以通过配置该属性来降低客户端的网络和CPU消耗。
-
Title:该参数对应了上图头部标题Hystrix Stream之后的内容,默认会使用具体监控实例的URL,我们可以通过配置该信息来展示更合适的标题。
-
监控页面
-
实心圆:共有两种含义。
-
颜色的变化——实例的健康程度:它的健康度从绿色、黄色、橙色、红色递减。
-
大小的变化——实例的请求流量:流量越大该实心圆就越大。
-
-
曲线:用来记录2分钟内流量的相对变化,我们可以通过它来观察到流量的上升和下降趋势。