为什么 /health 的“readinessState”细节与就绪探测状态不同?

问题描述

在 Spring-Boot 2.4 中,我的执行器运行状况端点和就绪探针存在此问题。当我的自定义键组件之一关闭时,/health/readiness 端点表示 DOWN/health 端点也是如此,但是readinessstate 的详细信息{1}} 仍然说 /health

为什么会这样? UP不应该也说readinessstate吗?

我在网上找到的许多教程似乎都没有解决这个问题。

我的假设:DOWN 与准备就绪无关,而是暴露了另一条信息。我希望我是错的,因为那是无稽之谈,而我对 the code 的理解似乎表明并非如此。


更多关于我的配置:

来自readinessstate的相关摘录

application.yml

当我让 management: endpoints: web: base-path: / endpoint: health: show-details: ALWAYS probes: enabled: true group: readiness: include: db,myCustom,diskSpace 转到 myCustom 时,会出现以下结果:

DOWN

GET /health

{ "status": "DOWN","components": { ...,// other components "myCustom": { "status": "DOWN" },"readinessstate": { "status": "UP" // here UP } },"groups": [ "liveness","readiness" ] }

GET /health/readiness

解决方法

就绪状态仅监控特定的健康组。需要告知您的自定义组件。

默认情况下,Spring Boot 不会向这些组添加其他健康指标。

https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#production-ready-kubernetes-probes-external-state