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
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:
These are the lines which specifically say that Health indicator should report UP:
spring-cloud-netflix/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaHealthIndicator.java
Lines 76 to 77 in b635363
spring-cloud-netflix/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaHealthIndicator.java
Lines 80 to 81 in b635363
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: