Search in sources :

Example 1 with Diagnosis

use of org.apache.servicecomb.huaweicloud.dashboard.monitor.data.Diagnosis 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;
}
Also used : InstanceCacheChecker(org.apache.servicecomb.serviceregistry.diagnosis.instance.InstanceCacheChecker) Microservice(org.apache.servicecomb.registry.api.registry.Microservice) MicroserviceInstance(org.apache.servicecomb.registry.api.registry.MicroserviceInstance) Diagnosis(org.apache.servicecomb.huaweicloud.dashboard.monitor.data.Diagnosis) HystrixCommandMetrics(com.netflix.hystrix.HystrixCommandMetrics) MonitorData(org.apache.servicecomb.huaweicloud.dashboard.monitor.data.MonitorData)

Example 2 with Diagnosis

use of org.apache.servicecomb.huaweicloud.dashboard.monitor.data.Diagnosis in project incubator-servicecomb-java-chassis by apache.

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;
}
Also used : InstanceCacheChecker(org.apache.servicecomb.serviceregistry.diagnosis.instance.InstanceCacheChecker) Microservice(org.apache.servicecomb.registry.api.registry.Microservice) MicroserviceInstance(org.apache.servicecomb.registry.api.registry.MicroserviceInstance) Diagnosis(org.apache.servicecomb.huaweicloud.dashboard.monitor.data.Diagnosis) HystrixCommandMetrics(com.netflix.hystrix.HystrixCommandMetrics) MonitorData(org.apache.servicecomb.huaweicloud.dashboard.monitor.data.MonitorData)

Aggregations

HystrixCommandMetrics (com.netflix.hystrix.HystrixCommandMetrics)2 Diagnosis (org.apache.servicecomb.huaweicloud.dashboard.monitor.data.Diagnosis)2 MonitorData (org.apache.servicecomb.huaweicloud.dashboard.monitor.data.MonitorData)2 Microservice (org.apache.servicecomb.registry.api.registry.Microservice)2 MicroserviceInstance (org.apache.servicecomb.registry.api.registry.MicroserviceInstance)2 InstanceCacheChecker (org.apache.servicecomb.serviceregistry.diagnosis.instance.InstanceCacheChecker)2