use of org.apache.servicecomb.serviceregistry.diagnosis.instance.InstanceCacheChecker in project java-chassis by ServiceComb.
the class HealthMonitorDataProvider method getMonitorData.
private MonitorData getMonitorData() {
Collection<HystrixCommandMetrics> instances = HystrixCommandMetrics.getInstances();
MonitorData monitorData = new MonitorData();
Microservice microservice = RegistryUtils.getMicroservice();
MicroserviceInstance microserviceInstance = RegistryUtils.getMicroserviceInstance();
monitorData.setAppId(microservice.getAppId());
monitorData.setName(microservice.getServiceName());
monitorData.setVersion(microservice.getVersion());
monitorData.setServiceId(microservice.getServiceId());
monitorData.setInstance(microserviceInstance.getHostName());
monitorData.setInstanceId(microserviceInstance.getInstanceId());
if (MonitorConstant.insCacheEnabled()) {
InstanceCacheChecker checker = new InstanceCacheChecker(DiscoveryManager.INSTANCE.getAppManager());
monitorData.setProvidersCache(checker.check().getProducers());
}
exactProcessInfo(monitorData);
synchronized (lock) {
if (this.instanceCacheSummary != null) {
Diagnosis diagnosis = new Diagnosis();
diagnosis.setInstanceCache(instanceCacheSummary);
monitorData.setDiagnosis(diagnosis);
this.instanceCacheSummary = null;
}
}
if (instances.isEmpty()) {
return monitorData;
}
for (HystrixCommandMetrics instance : instances) {
monitorData.appendInterfaceInfo(instance);
}
return monitorData;
}
Aggregations