java - Hystrix仪表板

标签 java spring-boot gradle hystrix

我对Hystrix完全陌生,但是我需要从中监视指标。

到目前为止,我有一个独立的显示器,用于显示/运行Hystrix仪表板。

在我的项目中,添加依赖项;

compile(group:"com.netflix.hystrix", name:"hystrix-metrics-event-stream", version:'1.5.5')
compile(group:"org.springframework.cloud", name:"spring-cloud-starter-hystrix-dashboard", version:'1.1.5.RELEASE')
compile(group:"org.springframework.boot", name:"spring-boot-starter-actuator", version:'1.4.0.RELEASE')
compile(group:"org.springframework.cloud", name:"spring-cloud-starter-hystrix", version:'1.1.5.RELEASE')

同样在我的SpringConfig中,我添加
@EnableHystrix
public class MyAppConfig {

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

我成功启动了我可以检查它是否由localhost:8080 / health运行的服务,并得到了答案。

当我添加localhost:8080 / hystrix.stream并在Hystrix仪表板中短暂按下Monitor Streams按钮时,它显示“正在加载...”,但随后出现“无法连接到Command Metric Stream”。

我也在仪表板控制台中得到了这个。
17:19:26.858 [vert.x-eventloop-thread-0] INFO  c.g.k.h.c.s.d.HystrixDashboardProxyConnectionHandler - Proxing request to http://localhost:8080/hystrix.stream
17:19:31.879 [vert.x-eventloop-thread-0] ERROR c.g.k.h.c.s.d.HystrixDashboardProxyConnectionHandler - Proxying request
java.util.concurrent.TimeoutException: The timeout period of 5000ms has been exceeded
        at io.vertx.core.http.impl.HttpClientRequestBase.timeout(HttpClientRequestBase.java:155)
        at io.vertx.core.http.impl.HttpClientRequestBase.handleTimeout(HttpClientRequestBase.java:140)
        at io.vertx.core.http.impl.HttpClientRequestBase.lambda$setTimeout$0(HttpClientRequestBase.java:100)
        at io.vertx.core.impl.VertxImpl$InternalTimerHandler.handle(VertxImpl.java:782)
        at io.vertx.core.impl.VertxImpl$InternalTimerHandler.handle(VertxImpl.java:753)
        at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:316)
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:418)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:440)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873)
        at java.lang.Thread.run(Thread.java:745)
17:19:31.894 [vert.x-eventloop-thread-0] ERROR c.g.k.h.c.s.d.HystrixDashboardProxyConnectionHandler - Proxying request
io.vertx.core.VertxException: Connection was closed
        at io.vertx.core.http.impl.ClientConnection.handleClosed(ClientConnection.java:396)
        at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:314)
        at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:190)
        at io.vertx.core.net.impl.VertxHandler.channelInactive(VertxHandler.java:97)

最终尝试使curl localhost:8080 / hystrix.stream完全没有响应。

我不确定是否缺少任何人可以给我提示的信息?

问候。

最佳答案

我认为您在主类上缺少@HistrixDashBoard批注

关于java - Hystrix仪表板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47481273/

相关文章:

java - 当 Get 请求不是 Id 时,会出现此异常 :Failed to convert value of type java. lang.String 为所需类型 java.lang.Long

android - 我在gradle中使用firebase-ui时不会获得firebase token

java - Java中如何使用通配符检查文件是否存在?

java - 通过测试套件中的@ExcludeCategory 忽略 junit 测试

java - 如何在 Java 中编写一个传入类名的函数?

spring-data-jpa - CloudFoundry/Pivotal Web 服务上的 Spring Boot JPA 自动重新配置

java - IntelliJ IDEA "SpringIO"项目报告 "unable to make the module..."

android - 任务失败 ':app:processReleaseResources' 无法执行 aapt

gradle - 我在命令提示符下收到消息 'ancestor C:\Users\max\gradle is not a directory'

java - 多次抛出的异常是检查的还是运行时的?