Skip to content

Health indicator for Eureka client reports UP when not connected to server #4562

Description

@ViliusS

Describe the bug
If Eureka server is not available, Health indicator for Eureka client will always report that it is UP. One such sample from Spring Cloud Gateway:

{
  "status": "DOWN",
  "components": {
    "discoveryComposite": {
      "status": "UP",
      "components": {
        "discoveryClient": {
          "status": "UP",
          "details": {
            "services": []
          }
        },
        "eureka": {
          "description": "Eureka discovery client has not yet successfully connected to a Eureka server",
          "status": "UP",
          "details": {
            "applications": {

            }
          }
        }
      }
    },
    "reactiveDiscoveryClients": {
      "status": "UP",
      "components": {
        "Simple Reactive Discovery Client": {
          "status": "UP",
          "details": {
            "services": []
          }
        },
        "Spring Cloud Eureka Reactive Discovery Client": {
          "status": "UP",
          "details": {
            "services": []
          }
        }
      }
    },
    "redis": {
      "status": "DOWN",
      "details": {
        "error": "org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis"
      }
    },
  }
}

These are the lines which specifically say that Health indicator should report UP:

status = new Status("UP",
"Eureka discovery client has not yet successfully connected to a Eureka server");
and
status = new Status("UP",
"Eureka discovery client is reporting failures to connect to a Eureka server");

Not sure why it was done this way, but I don't think this is right. If Eureka client cannot connect to Eureka server the application should report as DOWN at least for readiness probe.

Sample
Just take standard Spring Cloud Gateway application, add Spring Cloud Netflix Client dependency to it, and start the gateway. For visibility add:

management.endpoints.web.exposure.include=health
management.endpoint.health.show-details=always

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions