首页 /  技术专区  /  SpringCloud 宽屏模式 >

Hystrix:Dashboard流监控

1.新建Module,springcloud-consumer-hystrix-dashboard。

image.png

2.复制80里面的依赖,并加入hystrix的依赖和dashboard的依赖。

image.png

<!-- hystrix -->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
    <version>2.1.1.RELEASE</version>
</dependency>

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-netflix-hystrix-dashboard</artifactId>
    <version>2.1.1.RELEASE</version>
</dependency>

3.新建application.yml文件,配置端口9001

image.png

4.新建启动类

image.png

package com.allen.springcloud;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;

@SpringBootApplication
@EnableHystrixDashboard
public class DeptConsumerDashboard_9001 {
    public static void main(String[] args) {
        SpringApplication.run(DeptConsumerDashboard_9001.class, args);
    }
}

5.启动测试

image.png

6.在springcloud-provider-dept-hystrix-8001启动类里面新增一个Servlet,前提要满足maven依赖里面有这两个依赖。

image.png

image.png

@Bean
public ServletRegistrationBean hystrixMetricsStreamServlet(){
    ServletRegistrationBean registrationBean = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
    registrationBean.addUrlMappings("/actuator/hystrix.stream");
    return registrationBean;
}

7.启动测试,7001注册中心,8001服务提供者,80服务消费者,9001监控。

image.png

8.进入9001设置监控信息,完成后点击按钮进入。

image.png

调用接口观察监控。

image.png

如何看呢?

七色:

image.png

一圈

实心圆:公有两种含义,他通过颜色的变化代表了实例的健康程度

它的健康程度从绿色<黄色<橙色<红色递减

该实心圆除了颜色的变化之外,它的大小也会根据实例的请求流量发生变化,流量越大,该实心圆就越大,所以通过该实心圆的展示,就可以在大量的实例中快速发现故障实例和高压力实例。

image.png

一线

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

image.png

整图说明:

image.png



头像
0/200
图片验证码