I'm using Eureka Server 2.2.3.RELEASE.
Trying to debug an issue with Spring Boot Admin and it seems that DiscoveryClient::getServices is not returning services that are in the DOWN state.
Is that the intention? That doesn't seem right. A DiscoveryClient should be able to get all registered services. The service remains registered at /eureka/apps:
<application>
<name>xxx-VAULT</name>
<instance>
<instanceId>vault01.xxx.com:xxx-Vault:8200</instanceId>
<hostName>vault01.xxx.com</hostName>
<app>xxx-VAULT</app>
<ipAddr>192.168.1.100</ipAddr>
<status>DOWN</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="false">8200</port>
<securePort enabled="true">8200</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>30</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1593882488337</registrationTimestamp>
<lastRenewalTimestamp>1593884192355</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1593839546168</serviceUpTimestamp>
</leaseInfo>
<metadata>
<management.port>8199</management.port>
</metadata>
<homePageUrl>https://vault01.xxx.com:8200</homePageUrl>
<statusPageUrl>https://vault01.xxx.com:8199/actuator/info</statusPageUrl>
<healthCheckUrl>https://vault01.xxx.com:8199/actuator/health</healthCheckUrl>
<secureHealthCheckUrl>https://vault01.xxx.com:8199/actuator/health</secureHealthCheckUrl>
<vipAddress>xxx-Vault</vipAddress>
<secureVipAddress>xxx-Vault</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1593882488337</lastUpdatedTimestamp>
<lastDirtyTimestamp>1593882488320</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
In this case, :8200 is a Vault server. Since that doesn't have a compatible health endpoint, I'm using Sidecar at :8199 to call the Vault endpoint and return the correct status. In the case of Vault being shutdown, the Sidecar remains registered, but returns a DOWN status.
DiscoveryClient::getServices doesn't return this service.
@Override
public List<String> getServices() {
Applications applications = this.eurekaClient.getApplications();
if (applications == null) {
return Collections.emptyList();
}
List<Application> registered = applications.getRegisteredApplications();
List<String> names = new ArrayList<>();
for (Application app : registered) {
if (app.getInstances().isEmpty()) {
continue;
}
names.add(app.getName().toLowerCase());
}
return names;
}
Looking at this code, looks like you require at least one instance to return... what if the service only has one instance? In that case, it will drop completely off of Spring Boot Admin and kind of defeat the whole purpose.