Resilience4J for Springboot - registerHealthIndicator: true 有什么用
Resilience4J for Springboot - what is the use of registerHealthIndicator: true
在 Resilience4J 中 spring 启动时 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
为了在 /health
端点中查看详细信息,您需要更改 属性 management.endpoint.health.show-details
配置。它定义了何时显示完整的健康细节,默认情况下它的值为 never
。你需要实际配置为always
如下:
management.endpoint.health.show-details = always
在 Resilience4J 中 spring 启动时 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
为了在 /health
端点中查看详细信息,您需要更改 属性 management.endpoint.health.show-details
配置。它定义了何时显示完整的健康细节,默认情况下它的值为 never
。你需要实际配置为always
如下:
management.endpoint.health.show-details = always