class EurekaHealthIndicator implements DiscoveryHealthIndicator {

	private final EurekaClient eurekaClient;

	private final EurekaInstanceConfig instanceConfig;

	private final EurekaClientConfig clientConfig;

	public EurekaHealthIndicator(EurekaClient eurekaClient, EurekaInstanceConfig instanceConfig,
			EurekaClientConfig clientConfig) {
		super();
		this.eurekaClient = eurekaClient;
		this.instanceConfig = instanceConfig;
		this.clientConfig = clientConfig;
	}

	@Override
	public String getName() {
		return "eureka";
	}

	@Override
	public Health health() {<FILL_FUNCTION_BODY>}

	private Status getStatus(Builder builder) {
		Status status = new Status(this.eurekaClient.getInstanceRemoteStatus().toString(),
				"Remote status from Eureka server");
		DiscoveryClient discoveryClient = getDiscoveryClient();
		if (discoveryClient != null && clientConfig.shouldFetchRegistry()) {
			long lastFetch = discoveryClient.getLastSuccessfulRegistryFetchTimePeriod();

			if (lastFetch < 0) {
				status = new Status("UP",
						"Eureka discovery client has not yet successfully connected to a Eureka server");
			}
			else if (lastFetch > clientConfig.getRegistryFetchIntervalSeconds() * 2000) {
				status = new Status("UP",
						"Eureka discovery client is reporting failures to connect to a Eureka server");
				builder.withDetail("renewalPeriod", instanceConfig.getLeaseRenewalIntervalInSeconds());
				builder.withDetail("failCount", lastFetch / clientConfig.getRegistryFetchIntervalSeconds());
			}
		}

		return status;
	}

	private DiscoveryClient getDiscoveryClient() {
		DiscoveryClient discoveryClient = null;
		if (AopUtils.isAopProxy(eurekaClient)) {
			discoveryClient = ProxyUtils.getTargetObject(eurekaClient);
		}
		else if (eurekaClient instanceof DiscoveryClient) {
			discoveryClient = (DiscoveryClient) eurekaClient;
		}
		return discoveryClient;
	}

	private Map<String, Object> getApplications() {
		Applications applications = this.eurekaClient.getApplications();
		if (applications == null) {
			return Collections.emptyMap();
		}
		Map<String, Object> result = new HashMap<>();
		for (Application application : applications.getRegisteredApplications()) {
			if (!application.getInstances().isEmpty()) {
				result.put(application.getName(), application.getInstances().size());
			}
		}
		return result;
	}

}

		Builder builder = Health.unknown();
		Status status = getStatus(builder);
		return builder.status(status).withDetail("applications", getApplications()).build();
	
<no_super_class>