有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java 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(监控流)按钮,在短时间内显示“正在加载…”但随后我得到“无法连接到命令度量流”

我在仪表盘控制台上也看到了这个

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。流根本没有响应

我不确定是否遗漏了什么,有人能给我一个提示吗

问候


共 (2) 个答案

  1. # 1 楼答案

    我认为您在主类中缺少@HistrixDashBoard注释