天天看点

SpringCloud配置Hystrix Dashboard案例

一、相关环境搭建

1)、监控微服务的项目引入

<!-- hystrix和 hystrix-dashboard相关 -->
<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>
           

运行项目,访问http://localhost:9001/hystrix,出现下图表示运行成功

SpringCloud配置Hystrix Dashboard案例

2)、被监控的微服务需要引入

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
           

 二、数据分析

1)、启动监控和被监控的微服务项目

2)、访问监控微服务的http://localhost:9001/hystrix填写信息

SpringCloud配置Hystrix Dashboard案例

3)、查看数据

SpringCloud配置Hystrix Dashboard案例

  实心圆:共有两种含义。它通过颜色的变化代表了实例的健康程度,它的健康度从绿色<黄色<橙色<红色递减。该实心圆除了颜色的变化之外,它的大小也会根据实例的请求流量发生变化,流量越大该实心圆就越大。所以通过该实心圆的展示,就可以在大量的实例中快速的发现故障实例和高压力实例。

  曲线:用来记录2分钟内流量的相对变化,可以通过它来观察到流量的上升和下降趋势。

继续阅读