Spring Boot应用程序的可用性(活跃性和就绪性)返回404。

huangapple go评论49阅读模式
英文:

Spring Boot Application Availability (Liveness and Readiness) Returns 404

问题

我有一个Spring Boot应用程序(v2.3.2),并启用了健康检查组的活动状态和准备状态:

management:
  endpoints:
    enabled-by-default: false
  endpoint:
    health:
      enabled: true
      probes:
        enabled: true

GET /actuator/health 返回:

{
    "groups": [
        "liveness",
        "readiness"
    ],
    "status": "UP"
}

根据文档,我应该能够访问 GET /actuator/health/livenessGET /actuator/health/readiness,但两者都返回 404。我是否漏掉了任何配置或其他内容?

英文:

I've got a Spring Boot application (v2.3.2) and enabled the actuator health group for liveness and readiness:

management:
  endpoints:
    enabled-by-default: false
  endpoint:
    health:
      enabled: true
      probes:
        enabled: true

And GET /actuator/health returns:

{
    "groups": [
        "liveness",
        "readiness"
    ],
    "status": "UP"
}

According to the documentation, I should also be able to GET /actuator/health/liveness and GET /actuator/health/readiness, but both return 404.
Did I miss any configuration or something?

答案1

得分: 2

这应该可以工作

management:
  endpoints:
    enabled-by-default: false
  endpoint:
    health:
      enabled: true
      probes:
        enabled: true
      group:
        liveness:
          include: "livenessStateProbeIndicator"
        readiness:
          include: "readinessStateProbeIndicator"

这是一个因为问题而采取的临时解决措施(参考链接:https://github.com/spring-projects/spring-boot/issues/22562)

英文:

this should work

management:
  endpoints:
    enabled-by-default: false
  endpoint:
    health:
      enabled: true
      probes:
        enabled: true
      group:
        liveness:
          include: "livenessStateProbeIndicator"
        readiness:
          include: "readinessStateProbeIndicator"

it is a workaround due to an issue

huangapple
  • 本文由 发表于 2020年7月31日 23:12:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/63194537.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定