【问题标题】:hystrix dashboard doesnt load metrixhystrix 仪表板不加载指标
【发布时间】:2021-11-23 09:16:13
【问题描述】:

专家,

在我的 spring boot 2.5.5 项目中使用 spring cloud version2020.0.4 并配置了具有以下依赖项的 Hystrix 仪表板

 <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
    <version>2.2.9.RELEASE</version>
</dependency>

我已经在 api 网关中配置了类似这样的回退

filters:
            - name: CircuitBreaker
              args:
                name: My-SERVICE
                fallbackuri: forward:/myServiceFallBack

API 网关在端口:9191 上运行

到目前为止还不错。当我通过 API 网关访问 API 时,我可以看到 CircuirtBreaker 启动,并且在需要时请求被转发到“后备 URI”。

现在当我访问时

http://localhost:9191/actuator/hystrix.stream

我也可以看到那里列出的 pings

我通过 API Gateway 调用最终用户 API 端点。

但是,当我尝试查看 Hystrix 仪表板时,它只是在加载。我在浏览器控制台或网络选项卡中没有看到任何问题。

知道这里出了什么问题。

【问题讨论】:

  • 1.你也可以分享 chrome 开发者控制台的记录吗?我想看看对后端服务器进行了哪些调用,以及它们的响应/状态是什么。由于仪表板处于永久加载状态,后端可能不会定期刷新响应。 2. 您是否在 Spring 应用程序中缓存任何请求/响应?

标签: spring spring-boot hystrix hystrix-dashboard


【解决方案1】:

正如我所见,问题是您缺少依赖项。 Hystrix 仪表板将提供 Hystrix stream 并且可以通过 Actuator 端点获得,因此还需要执行器依赖项。请添加以下依赖并尝试。

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

将以下行添加到应用程序属性中,以允许所有 Actuator 端点。

# Allow all Actuator endpoints
management.endpoints.web.exposure.include=*

(允许所有端点仅用于测试目的,并根据生产要求单独控制对每个端点的访问)

【讨论】:

    猜你喜欢
    • 2020-09-05
    • 2018-05-08
    • 2013-09-14
    • 2017-10-22
    • 2019-10-18
    • 2023-03-12
    • 2020-10-01
    • 2020-12-03
    • 2016-09-25
    相关资源
    最近更新 更多