【springCloud基础篇-7】SpringCloud的熔断监控之Hystrix-dashboard(接上篇)的基础使用

demo代码地址:https://download.csdn.net/download/qq_33333654/12014918

环境:基于上篇consumer项目基础

 

1、添加依赖


    org.springframework.cloud
    spring-cloud-starter-hystrix


    org.springframework.cloud
    spring-cloud-starter-hystrix-dashboard


    org.springframework.boot
    spring-boot-starter-actuator

2、启动类 

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@EnableHystrixDashboard
@EnableCircuitBreaker
public class ConsumerApplication {

    public static void main(String[] args) {
        SpringApplication.run(ConsumerApplication.class, args);
    }

}

 

3、测试

启动工程后访问 http://localhost:9001/hystrix,将会看到如下界面:

【springCloud基础篇-7】SpringCloud的熔断监控之Hystrix-dashboard(接上篇)的基础使用_第1张图片

图中会有一些提示: 

大概意思就是如果查看默认集群使用第一个url,查看指定集群使用第二个url,单个应用的监控使用最后一个,我们暂时只演示单个应用的所以在输入框中输入: http://localhost:9001/hystrix.stream ,输入之后点击 monitor,进入页面。

如果没有请求会先显示Loading ...,访问http://localhost:9001/hystrix.stream 也会不断的显示ping。

请求服务http://localhost:9001/hello/neo,就可以看到监控的效果了,首先访问http://localhost:9001/hystrix.stream,显示如下:

 

ping: 

data: {"type":...}

data: {"type":...}

 

说明已经返回了监控的各项结果

到监控页面就会显示如下图:

 【springCloud基础篇-7】SpringCloud的熔断监控之Hystrix-dashboard(接上篇)的基础使用_第2张图片

其实就是http://localhost:9001/hystrix.stream返回结果的图形化显示,Hystrix Dashboard Wiki上详细说明了图上每个指标的含义,如下图:

【springCloud基础篇-7】SpringCloud的熔断监控之Hystrix-dashboard(接上篇)的基础使用_第3张图片

你可能感兴趣的:(springCloud)