Search in sources :

Example 1 with MonitorData

use of org.apache.servicecomb.huaweicloud.dashboard.monitor.data.MonitorData 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)

Aggregations

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