Search in sources :

Example 36 with SaturnStatistics

use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.

the class DashboardServiceImpl method saveOrUpdateTop10FailExecutor.

private void saveOrUpdateTop10FailExecutor(List<ExecutorStatistics> executorList, String zkAddr) {
    try {
        executorList = DashboardServiceHelper.sortExecutorByFailureRate(executorList);
        List<ExecutorStatistics> top10FailExecutor = executorList.subList(0, executorList.size() > 9 ? 10 : executorList.size());
        String top10FailExecutorJsonString = JSON.toJSONString(top10FailExecutor);
        SaturnStatistics top10FailExecutorFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.TOP_10_FAIL_EXECUTOR, zkAddr);
        if (top10FailExecutorFromDB == null) {
            SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.TOP_10_FAIL_EXECUTOR, zkAddr, top10FailExecutorJsonString);
            saturnStatisticsService.create(ss);
        } else {
            top10FailExecutorFromDB.setResult(top10FailExecutorJsonString);
            saturnStatisticsService.updateByPrimaryKey(top10FailExecutorFromDB);
        }
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    }
}
Also used : SaturnStatistics(com.vip.saturn.job.console.mybatis.entity.SaturnStatistics) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException) JobConsoleException(com.vip.saturn.job.console.exception.JobConsoleException) NoNodeException(org.apache.zookeeper.KeeperException.NoNodeException)

Example 37 with SaturnStatistics

use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.

the class DashboardServiceImpl method saveOrUpdateTop10FailDomain.

private void saveOrUpdateTop10FailDomain(List<DomainStatistics> domainList, String zkAddr) {
    try {
        domainList = DashboardServiceHelper.sortDomainByAllTimeFailureRate(domainList);
        List<DomainStatistics> top10FailDomainList = domainList.subList(0, domainList.size() > 9 ? 10 : domainList.size());
        String top10FailDomainJsonString = JSON.toJSONString(top10FailDomainList);
        SaturnStatistics top10FailDomainFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.TOP_10_FAIL_DOMAIN, zkAddr);
        if (top10FailDomainFromDB == null) {
            SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.TOP_10_FAIL_DOMAIN, zkAddr, top10FailDomainJsonString);
            saturnStatisticsService.create(ss);
        } else {
            top10FailDomainFromDB.setResult(top10FailDomainJsonString);
            saturnStatisticsService.updateByPrimaryKey(top10FailDomainFromDB);
        }
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    }
}
Also used : SaturnStatistics(com.vip.saturn.job.console.mybatis.entity.SaturnStatistics) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException) JobConsoleException(com.vip.saturn.job.console.exception.JobConsoleException) NoNodeException(org.apache.zookeeper.KeeperException.NoNodeException)

Example 38 with SaturnStatistics

use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.

the class DashboardServiceImpl method abnormalContainerByAllZkCluster.

@Override
public String abnormalContainerByAllZkCluster() {
    List<AbnormalContainer> abnormalContainerList = new ArrayList<>();
    Collection<ZkCluster> zkClusterList = registryCenterService.getZkClusterList();
    for (ZkCluster zkCluster : zkClusterList) {
        SaturnStatistics saturnStatistics = abnormalContainer(zkCluster.getZkAddr());
        if (saturnStatistics != null) {
            String result = saturnStatistics.getResult();
            List<AbnormalContainer> tempList = JSON.parseArray(result, AbnormalContainer.class);
            if (tempList != null) {
                abnormalContainerList.addAll(tempList);
            }
        }
    }
    return JSON.toJSONString(abnormalContainerList);
}
Also used : SaturnStatistics(com.vip.saturn.job.console.mybatis.entity.SaturnStatistics)

Example 39 with SaturnStatistics

use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.

the class DashboardServiceImpl method saveOrUpdateVersionDomainNumber.

private void saveOrUpdateVersionDomainNumber(Map<String, Long> versionDomainNumber, String zkAddr) {
    try {
        String versionDomainNumberJsonString = JSON.toJSONString(versionDomainNumber);
        SaturnStatistics versionDomainNumberFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.VERSION_DOMAIN_NUMBER, zkAddr);
        if (versionDomainNumberFromDB == null) {
            SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.VERSION_DOMAIN_NUMBER, zkAddr, versionDomainNumberJsonString);
            saturnStatisticsService.create(ss);
        } else {
            versionDomainNumberFromDB.setResult(versionDomainNumberJsonString);
            saturnStatisticsService.updateByPrimaryKey(versionDomainNumberFromDB);
        }
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    }
}
Also used : SaturnStatistics(com.vip.saturn.job.console.mybatis.entity.SaturnStatistics) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException) JobConsoleException(com.vip.saturn.job.console.exception.JobConsoleException) NoNodeException(org.apache.zookeeper.KeeperException.NoNodeException)

Example 40 with SaturnStatistics

use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.

the class DashboardServiceImpl method allTimeout4AlarmJobByAllZkCluster.

@Override
public String allTimeout4AlarmJobByAllZkCluster() {
    List<Timeout4AlarmJob> abnormalJobList = new ArrayList<>();
    Collection<ZkCluster> zkClusterList = registryCenterService.getZkClusterList();
    for (ZkCluster zkCluster : zkClusterList) {
        SaturnStatistics saturnStatistics = allTimeout4AlarmJob(zkCluster.getZkAddr());
        if (saturnStatistics != null) {
            String result = saturnStatistics.getResult();
            List<Timeout4AlarmJob> tempList = JSON.parseArray(result, Timeout4AlarmJob.class);
            if (tempList != null) {
                abnormalJobList.addAll(tempList);
            }
        }
    }
    return JSON.toJSONString(abnormalJobList);
}
Also used : SaturnStatistics(com.vip.saturn.job.console.mybatis.entity.SaturnStatistics)

Aggregations

SaturnStatistics (com.vip.saturn.job.console.mybatis.entity.SaturnStatistics)68 SaturnJobConsoleException (com.vip.saturn.job.console.exception.SaturnJobConsoleException)21 JobConsoleException (com.vip.saturn.job.console.exception.JobConsoleException)19 NoNodeException (org.apache.zookeeper.KeeperException.NoNodeException)19 SuccessResponseEntity (com.vip.saturn.job.console.controller.SuccessResponseEntity)8 ZkCluster (com.vip.saturn.job.console.domain.ZkCluster)8 ApiResponses (io.swagger.annotations.ApiResponses)8 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 CuratorFrameworkOp (com.vip.saturn.job.console.repository.zookeeper.CuratorRepository.CuratorFrameworkOp)1 HashMap (java.util.HashMap)1 CuratorFramework (org.apache.curator.framework.CuratorFramework)1