首页 > 解决方案 > Resilience4J for Springboot - registerHealthIndicator: true 有什么用

问题描述

在 Resilience4J for spring boot 中 registerHealthIndicator: true 的用途是什么?

文档https://resilience4j.readme.io/docs/getting-started-3#health-endpoint说如果我们在 application.yml 中进行如下配置,我们可以看到健康端点中断路器的状态。

management.health.circuitbreakers.enabled: true
resilience4j.circuitbreaker:
  configs:
    default:
      registerHealthIndicator: true

当我尝试执行器健康端点 - http://localhost:8080/actuator/health 时,我只看到一个状态: {"status":"UP"} 。其中没有关于断路器的详细信息。

是否有任何我缺少健康端点的配置?

注意:我可以在其他端点中查看断路器详细信息,例如 - http://localhost:8080/actuator/circuitbreakerevents - http://localhost:8080/actuator/circuitbreakers

标签: spring-bootresilience4j

解决方案


为了在/health端点中查看详细信息,您需要更改属性management.endpoint.health.show-details配置。它定义了何时显示完整的健康细节,默认情况下它的值为never. 您需要always按如下方式实际配置它:

management.endpoint.health.show-details = always

推荐阅读