无法在Hystrix仪表板上查看Hystrix报告

时间:2016-09-22 03:41:56

标签: java rest tomcat hystrix

我有一个休息应用程序(基于cxf),它在内部调用soap Web服务。我想将 hystrix 集成到我的其他应用程序中。

1)使用我们现有的服务数据修改了下面的hystrix演示源代码,并部署了其余的应用程序。

https://github.com/Netflix/Hystrix/tree/master/hystrix-examples/src/main/java/com/netflix/hystrix/examples/demo

2)我下载了 hystrix-dashboard war文件并部署到tomcat中,我可以看到hystrix仪表板主页。

现在,当我尝试通过提供hystrix集成的休息应用程序来监控流时,将显示带有hystrix图标的url.Empty页面。当我看IE开发者控制台时,它显示以下错误

未定义EventSource。

  //code snippet from ie developer console
  var proxyStream = "../proxy.stream?origin=http://localhost:8080/hystrix/hystrix.stream;
  // start the EventSource which will open a streaming connection to the server
  var source = new EventSource(proxyStream);

注意:两者都部署在同一台机器上 - localhost

1 个答案:

答案 0 :(得分:0)

您必须添加以下代码:

@Bean
public ServletRegistrationBean servletRegistration() {
  ServletRegistrationBean registration = new ServletRegistrationBean(new     HystrixMetricsStreamServlet(), "/hystrix.stream"); 
  return registration;
}

您还要确保/hystrix.stream不受保护。