在PCF上部署的带有Spring Boot的Hystrix仪表板未显示度量标准

时间:2015-02-12 13:56:49

标签: spring cloudfoundry spring-cloud hystrix

我使用Spring启动和spring cloud启动程序hystrix库创建了一个简单的应用程序。

在我的build.gradle中:

dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.cloud:spring-cloud-starter-hystrix-dashboard:1.0.0.RC2")
compile("org.springframework.cloud:spring-cloud-starter-hystrix:1.0.0.RC2")
}

我使用上述库和@EnableHystrixDashboard

将一个应用程序部署为hystrix仪表板

然后我部署了另一个使用@EnableHystrix

注释的应用

我添加了一个组件,它有一个我通过控制器调用的命令,只是为了测试:

@HystrixCommand(fallbackMethod = "onFailedToSayHello")
public String sayHello(Map<String, String> parameters) {
    if (parameters.get("fail") != null && parameters.get("fail").equals("yes")) {
        throw new RuntimeException("I failed because you told me to");
    }
    return "Hello";
}

private String onFailedToSayHello(Map<String, String> parameters) {
    return "Bye";
}

hystrix app运行正常。当我点击网址时,我会看到该流,我将其放入一个要点here

我只是看到一遍又一遍地重复着。

我的信息中心已启动并正在运行,当我输入正在运行的hystrix示例应用的网址时,我会看到一个加载屏幕:

hystrix dashboard loading screen

然后,当我再次检查我的hystrix应用程序时,我看到了:

λ curl http://myappurl/hystrix.stream
{"timestamp":1423748238280,"status":503,"error":"Service      Unavailable","message":"MaxConcurrentConnections reached: 5","path":"/hystrix.stream"}

我不知道从哪里开始。我尝试部署hystrix仪表板战争,而不是自己构建它,我从here下载但得到了相同的结果。

我还注意到浏览器控制台中的一些JavaScript错误输出,我将其放在here以防它们有用。

在服务器日志中,我一遍又一遍地重复这个:

  

2015-02-15 20:03:55.324 INFO 9360 --- [nio-8080-exec-9]   ashboardConfiguration $ ProxyStreamServlet:

     

代理开放连接:http://myappurl/hystrix.stream

我现在要尝试让turbine运行,看看是否使用它以某种方式神奇地修复了一些事情。我以为我会在这里发帖,但是根据我迄今所做的事情,有人可以发现我的错误。

编辑: 我没有提到的重点是我在PCF上部署了应用程序和仪表板。这似乎很重要,因为当我在本地部署时,这个问题不会发生。但仍然不知道是什么导致了它。

2 个答案:

答案 0 :(得分:1)

如果您从最新的source构建hystrix-dashboard,或者在撰写本文时使用最近发布的war(3月27日版本1.4.3),问题就会消失。

答案 1 :(得分:0)

有些事情可能会导致MaxConcurrentConnections,其中一个不是应用程序生成的任何度量数据。 servlet(Hystrix.stream servlets)将继续循环以等待数据,然后它将消耗所有连接。关于Hystrix github wiki的讨论非常好。例如: hystrix.stream holds connection open if no metrics #85