解决Unable to connect to Command Metric Stream问题:Hystrix Dashboard 一直是Loading ...的情况

1.Hystrix Dashboard是正常打开的

解决Unable to connect to Command Metric Stream问题:Hystrix Dashboard 一直是Loading ...的情况

2.查看Hystrix对服务监控时,一直是loading...... 最终显示Unable to connect to Command Metric Stream.

解决Unable to connect to Command Metric Stream问题:Hystrix Dashboard 一直是Loading ...的情况

经过多次排查是没有错的。

Hystrix Dashboard 监控工程

第一:Hystrix Dashboard工程里的pom添加如下依赖:

<!--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>

第二:工程的主启动类上增加@EnableHystrixDashboard

@EnableHystrixDashboard
public class DeptConsumer_DashBoard_App {

被监控的服务工程:

第一:pom文件添加 :

<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-hystrix</artifactId>
        </dependency>

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

第二:针对提供的服务方法的controller里要添加 了熔断处理如下:

@HystrixCommand(fallbackMethod="processHystrix_Get")
    public Dept get(@PathVariable("id") Long id)
    {

最后发现还是个一直loading......

再次打开一个服务消费工程,访问一下提供的服务接口(注意:这里一定要访问一下添加了@HystrixCommand注解的方法

最后成功出现监控图。

解决Unable to connect to Command Metric Stream问题:Hystrix Dashboard 一直是Loading ...的情况