打開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; }
重啟項目,並重新打開監控頁面,訪問一下即可就可以了