首页 文章

Hystrix仪表板

提问于
浏览
0

我对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 Dashboard中的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根本没有响应 .

我不确定是否遗漏任何人可以给我一个提示吗?

问候 .

1 回答

  • 0

    我认为你缺少对主类的@HistrixDashBoard注释

相关问题