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;
    }

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

猜你喜欢

转载自www.cnblogs.com/z0909y/p/10522019.html
今日推荐