Java Code Examples for com.netflix.eureka.util.StatusInfo#getInstanceInfo()

The following examples show how to use com.netflix.eureka.util.StatusInfo#getInstanceInfo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EurekaResource.java    From flair-registry with Apache License 2.0 6 votes vote down vote up
private void populateInstanceInfo(Map<String, Object> model) {

        StatusInfo statusInfo;
        try {
            statusInfo = new StatusResource().getStatusInfo();
        } catch (Exception e) {
            log.error(e.getMessage());
            statusInfo = StatusInfo.Builder.newBuilder().isHealthy(false).build();
        }
        if (statusInfo != null && statusInfo.getGeneralStats() != null) {
            model.put("generalStats", statusInfo.getGeneralStats());
        }
        if (statusInfo != null && statusInfo.getInstanceInfo() != null) {
            InstanceInfo instanceInfo = statusInfo.getInstanceInfo();
            Map<String, String> instanceMap = new HashMap<>();
            instanceMap.put("ipAddr", instanceInfo.getIPAddr());
            instanceMap.put("status", instanceInfo.getStatus().toString());
            model.put("instanceInfo", instanceMap);
        }
    }
 
Example 2
Source File: EurekaResource.java    From jhipster-microservices-example with Apache License 2.0 6 votes vote down vote up
private void populateInstanceInfo(Map<String, Object> model) {

        StatusInfo statusInfo;
        try {
            statusInfo = new StatusResource().getStatusInfo();
        } catch (Exception e) {
            log.error(e.getMessage());
            statusInfo = StatusInfo.Builder.newBuilder().isHealthy(false).build();
        }
        if (statusInfo != null && statusInfo.getGeneralStats() != null) {
            model.put("generalStats", statusInfo.getGeneralStats());
        }
        if (statusInfo != null && statusInfo.getInstanceInfo() != null) {
            InstanceInfo instanceInfo = statusInfo.getInstanceInfo();
            Map<String, String> instanceMap = new HashMap<>();
            instanceMap.put("ipAddr", instanceInfo.getIPAddr());
            instanceMap.put("status", instanceInfo.getStatus().toString());
            model.put("instanceInfo", instanceMap);
        }
    }
 
Example 3
Source File: EurekaController.java    From didi-eureka-server with MIT License 6 votes vote down vote up
private void populateInstanceInfo(Map<String, Object> model, StatusInfo statusInfo) {
	InstanceInfo instanceInfo = statusInfo.getInstanceInfo();
	Map<String, String> instanceMap = new HashMap<>();
	instanceMap.put("ipAddr", instanceInfo.getIPAddr());
	instanceMap.put("status", instanceInfo.getStatus().toString());
	if (instanceInfo.getDataCenterInfo().getName() == DataCenterInfo.Name.Amazon) {
		AmazonInfo info = (AmazonInfo) instanceInfo.getDataCenterInfo();
		instanceMap.put("availability-zone",
				info.get(AmazonInfo.MetaDataKey.availabilityZone));
		instanceMap.put("public-ipv4", info.get(AmazonInfo.MetaDataKey.publicIpv4));
		instanceMap.put("instance-id", info.get(AmazonInfo.MetaDataKey.instanceId));
		instanceMap.put("public-hostname",
				info.get(AmazonInfo.MetaDataKey.publicHostname));
		instanceMap.put("ami-id", info.get(AmazonInfo.MetaDataKey.amiId));
		instanceMap.put("instance-type",
				info.get(AmazonInfo.MetaDataKey.instanceType));
	}
	model.put("instanceInfo", instanceMap);
}
 
Example 4
Source File: EurekaResource.java    From jhipster-registry with Apache License 2.0 6 votes vote down vote up
private void populateInstanceInfo(Map<String, Object> model) {

        StatusInfo statusInfo;
        try {
            statusInfo = new StatusResource().getStatusInfo();
        } catch (Exception e) {
            log.error(e.getMessage());
            statusInfo = StatusInfo.Builder.newBuilder().isHealthy(false).build();
        }
        if (statusInfo != null && statusInfo.getGeneralStats() != null) {
            model.put("generalStats", statusInfo.getGeneralStats());
        }
        if (statusInfo != null && statusInfo.getInstanceInfo() != null) {
            InstanceInfo instanceInfo = statusInfo.getInstanceInfo();
            Map<String, String> instanceMap = new HashMap<>();
            instanceMap.put("ipAddr", instanceInfo.getIPAddr());
            instanceMap.put("status", instanceInfo.getStatus().toString());
            model.put("instanceInfo", instanceMap);
        }
    }
 
Example 5
Source File: EurekaController.java    From spring-cloud-netflix with Apache License 2.0 6 votes vote down vote up
private void populateInstanceInfo(Map<String, Object> model, StatusInfo statusInfo) {
	InstanceInfo instanceInfo = statusInfo.getInstanceInfo();
	Map<String, String> instanceMap = new HashMap<>();
	instanceMap.put("ipAddr", instanceInfo.getIPAddr());
	instanceMap.put("status", instanceInfo.getStatus().toString());
	if (instanceInfo.getDataCenterInfo().getName() == DataCenterInfo.Name.Amazon) {
		AmazonInfo info = (AmazonInfo) instanceInfo.getDataCenterInfo();
		instanceMap.put("availability-zone",
				info.get(AmazonInfo.MetaDataKey.availabilityZone));
		instanceMap.put("public-ipv4", info.get(AmazonInfo.MetaDataKey.publicIpv4));
		instanceMap.put("instance-id", info.get(AmazonInfo.MetaDataKey.instanceId));
		instanceMap.put("public-hostname",
				info.get(AmazonInfo.MetaDataKey.publicHostname));
		instanceMap.put("ami-id", info.get(AmazonInfo.MetaDataKey.amiId));
		instanceMap.put("instance-type",
				info.get(AmazonInfo.MetaDataKey.instanceType));
	}
	model.put("instanceInfo", instanceMap);
}