问题描述
在 Spring-Boot 2.4 中,我的执行器运行状况端点和就绪探针存在此问题。当我的自定义键组件之一关闭时,/health/readiness
端点表示 DOWN
,/health
端点也是如此,但是readinessstate
的详细信息{1}} 仍然说 /health
。
为什么会这样? UP
不应该也说readinessstate
吗?
我在网上找到的许多教程似乎都没有解决这个问题。
我的假设:DOWN
与准备就绪无关,而是暴露了另一条信息。我希望我是错的,因为那是无稽之谈,而我对 the code 的理解似乎表明并非如此。
更多关于我的配置:
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 不会向这些组添加其他健康指标。