Source:
public InstanceInfo getInstanceInfo(String clusterId, String instanceName, List<HealthCheck> healthChecks) { InstanceInfo.Builder instanceInfoBuilder = new InstanceInfo.Builder(instanceName); InstanceConfig instanceConfig = _dataAccessor.getProperty(_dataAccessor.keyBuilder().instanceConfig(instanceName)); LiveInstance liveInstance = _dataAccessor.getProperty(_dataAccessor.keyBuilder().liveInstance(instanceName)); if (instanceConfig != null) { instanceInfoBuilder.instanceConfig(instanceConfig.getRecord()); } else { LOG.warn("Missing instance config for {}", instanceName); } if (liveInstance != null) { instanceInfoBuilder.liveInstance(liveInstance.getRecord()); String sessionId = liveInstance.getEphemeralOwner(); List<String> resourceNames = _dataAccessor .getChildNames(_dataAccessor.keyBuilder().currentStates(instanceName, sessionId)); instanceInfoBuilder.resources(resourceNames); List<String> partitions = new ArrayList<>(); for (String resourceName : resourceNames) { CurrentState currentState = _dataAccessor.getProperty( _dataAccessor.keyBuilder().currentState(instanceName, sessionId, resourceName)); if (currentState != null && currentState.getPartitionStateMap() != null) { partitions.addAll(currentState.getPartitionStateMap().keySet()); } else { LOG.warn( "Current state is either null or partitionStateMap is missing. InstanceName: {}, SessionId: {}, ResourceName: {}", instanceName, sessionId, resourceName); } } instanceInfoBuilder.partitions(partitions); } else { LOG.warn("Missing instance config for {}", instanceName); } try { Map<String, Boolean> healthStatus = getInstanceHealthStatus(clusterId, instanceName, healthChecks); instanceInfoBuilder.healthStatus(healthStatus); } catch (HelixException ex) { LOG.error( "Exception while getting health status. Cluster: {}, Instance: {}, reporting health status as unHealth", clusterId, instanceName, ex); instanceInfoBuilder.healthStatus(false); } return instanceInfoBuilder.build(); }

Target:
public InstanceInfo getInstanceInfo(String clusterId, String instanceName, List<HealthCheck> healthChecks) { InstanceInfo.Builder instanceInfoBuilder = new InstanceInfo.Builder(instanceName); InstanceConfig instanceConfig = _dataAccessor.getProperty(_dataAccessor.keyBuilder().instanceConfig(instanceName)); LiveInstance liveInstance = _dataAccessor.getProperty(_dataAccessor.keyBuilder().liveInstance(instanceName)); if (instanceConfig != null) { instanceInfoBuilder.instanceConfig(instanceConfig.getRecord()); } else { LOG.warn("Missing instance config for {}", instanceName); } if (liveInstance != null) { instanceInfoBuilder.liveInstance(liveInstance.getRecord()); String sessionId = liveInstance.getEphemeralOwner(); List<String> resourceNames = _dataAccessor .getChildNames(_dataAccessor.keyBuilder().currentStates(instanceName, sessionId)); instanceInfoBuilder.resources(resourceNames); List<String> partitions = new ArrayList<>(); for (String resourceName : resourceNames) { CurrentState currentState = _dataAccessor.getProperty( _dataAccessor.keyBuilder().currentState(instanceName, sessionId, resourceName)); if (currentState != null && currentState.getPartitionStateMap() != null) { partitions.addAll(currentState.getPartitionStateMap().keySet()); } else { LOG.warn( "Current state is either null or partitionStateMap is missing. InstanceName: {}, SessionId: {}, ResourceName: {}", instanceName, sessionId, resourceName); } } instanceInfoBuilder.partitions(partitions); } else { LOG.warn("Missing live instance for {}", instanceName); } try { Map<String, Boolean> healthStatus = getInstanceHealthStatus(clusterId, instanceName, healthChecks); instanceInfoBuilder.healthStatus(healthStatus); } catch (HelixException ex) { LOG.error( "Exception while getting health status. Cluster: {}, Instance: {}, reporting health status as unHealth", clusterId, instanceName, ex); instanceInfoBuilder.healthStatus(false); } return instanceInfoBuilder.build(); }