Hystrix Stream的监控页面不显示内容

打开Hystrix Stream页面,进入后,发现只有一行Unable to connect to Command Metric Stream.

因为springboot的默认路径不是 "/hystrix.stream",在启动类中加入如下代码

    @Bean
    public ServletRegistrationBean getServlet() {
        HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
        ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
        registrationBean.setLoadOnStartup(1);
        registrationBean.addUrlMappings("/hystrix.stream");
        registrationBean.setName("HystrixMetricsStreamServlet");
        return registrationBean;
    }

重启项目,并重新打开监控页面,访问一下即可就可以了

 

posted @ 2019-03-13 11:33  张左左  阅读(2312)  评论(0编辑  收藏  举报