Search in sources :

Example 51 with SaturnStatistics

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

the class AlarmStatisticsServiceImpl method setAlarmJobMonitorStatusToRead.

private <T extends AbstractAlarmJob> void setAlarmJobMonitorStatusToRead(String uuid, String alarmJobType, Class<T> t) throws SaturnJobConsoleException {
    Collection<ZkCluster> zkClusterList = registryCenterService.getZkClusterList();
    for (ZkCluster zkCluster : zkClusterList) {
        SaturnStatistics saturnStatistics = saturnStatisticsService.findStatisticsByNameAndZkList(alarmJobType, zkCluster.getZkAddr());
        if (null == saturnStatistics) {
            continue;
        }
        String result = saturnStatistics.getResult();
        List<T> jobs = JSON.parseArray(result, t);
        if (jobs != null) {
            boolean find = false;
            for (T job : jobs) {
                if (uuid.equals(job.getUuid())) {
                    job.setRead(true);
                    find = true;
                    break;
                }
            }
            if (find) {
                saturnStatistics.setResult(JSON.toJSONString(jobs));
                saturnStatisticsService.updateByPrimaryKeySelective(saturnStatistics);
                return;
            }
        }
    }
    throw new SaturnJobConsoleException(String.format("该uuid(%s)不存在", uuid));
}
Also used : SaturnStatistics(com.vip.saturn.job.console.mybatis.entity.SaturnStatistics) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException)

Example 52 with SaturnStatistics

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

the class DashboardServiceImpl method top10FailureDomainByAllZkCluster.

@Override
public String top10FailureDomainByAllZkCluster() throws SaturnJobConsoleException {
    List<DomainStatistics> domainStatisticsList = new ArrayList<>();
    Collection<ZkCluster> zkClusterList = registryCenterService.getOnlineZkClusterList();
    for (ZkCluster zkCluster : zkClusterList) {
        SaturnStatistics saturnStatistics = top10FailureDomain(zkCluster.getZkAddr());
        if (saturnStatistics != null) {
            String result = saturnStatistics.getResult();
            List<DomainStatistics> tempList = JSON.parseArray(result, DomainStatistics.class);
            if (tempList != null) {
                domainStatisticsList.addAll(tempList);
            }
        }
    }
    domainStatisticsList = DashboardServiceHelper.sortDomainByAllTimeFailureRate(domainStatisticsList);
    List<DomainStatistics> top10FailureDomain = domainStatisticsList.subList(0, domainStatisticsList.size() > 9 ? 10 : domainStatisticsList.size());
    return JSON.toJSONString(top10FailureDomain);
}
Also used : SaturnStatistics(com.vip.saturn.job.console.mybatis.entity.SaturnStatistics)

Example 53 with SaturnStatistics

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

the class DashboardServiceImpl method allProcessAndErrorCountOfTheDayByAllZkCluster.

@Override
public String allProcessAndErrorCountOfTheDayByAllZkCluster() throws SaturnJobConsoleException {
    long count = 0;
    long error = 0;
    Collection<ZkCluster> zkClusterList = registryCenterService.getOnlineZkClusterList();
    for (ZkCluster zkCluster : zkClusterList) {
        SaturnStatistics saturnStatistics = allProcessAndErrorCountOfTheDay(zkCluster.getZkAddr());
        if (saturnStatistics != null) {
            String result = saturnStatistics.getResult();
            ZkStatistics temp = JSON.parseObject(result, ZkStatistics.class);
            if (temp != null) {
                count += temp.getCount();
                error += temp.getError();
            }
        }
    }
    return JSON.toJSONString(new ZkStatistics(count, error));
}
Also used : SaturnStatistics(com.vip.saturn.job.console.mybatis.entity.SaturnStatistics)

Example 54 with SaturnStatistics

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

the class DashboardServiceImpl method top10AactiveJobByAllZkCluster.

@Override
public String top10AactiveJobByAllZkCluster() throws SaturnJobConsoleException {
    List<JobStatistics> jobStatisticsList = new ArrayList<>();
    Collection<ZkCluster> zkClusterList = registryCenterService.getOnlineZkClusterList();
    for (ZkCluster zkCluster : zkClusterList) {
        SaturnStatistics saturnStatistics = top10AactiveJob(zkCluster.getZkAddr());
        if (saturnStatistics != null) {
            String result = saturnStatistics.getResult();
            List<JobStatistics> tempList = JSON.parseArray(result, JobStatistics.class);
            if (tempList != null) {
                jobStatisticsList.addAll(tempList);
            }
        }
    }
    jobStatisticsList = DashboardServiceHelper.sortJobByDayProcessCount(jobStatisticsList);
    List<JobStatistics> top10AactiveJob = jobStatisticsList.subList(0, jobStatisticsList.size() > 9 ? 10 : jobStatisticsList.size());
    return JSON.toJSONString(top10AactiveJob);
}
Also used : SaturnStatistics(com.vip.saturn.job.console.mybatis.entity.SaturnStatistics)

Example 55 with SaturnStatistics

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

the class DashboardServiceImpl method top10UnstableDomainByAllZkCluster.

@Override
public String top10UnstableDomainByAllZkCluster() throws SaturnJobConsoleException {
    List<DomainStatistics> domainStatisticsList = new ArrayList<>();
    Collection<ZkCluster> zkClusterList = registryCenterService.getOnlineZkClusterList();
    for (ZkCluster zkCluster : zkClusterList) {
        SaturnStatistics saturnStatistics = top10UnstableDomain(zkCluster.getZkAddr());
        if (saturnStatistics != null) {
            String result = saturnStatistics.getResult();
            List<DomainStatistics> tempList = JSON.parseArray(result, DomainStatistics.class);
            if (tempList != null) {
                domainStatisticsList.addAll(tempList);
            }
        }
    }
    domainStatisticsList = DashboardServiceHelper.sortDomainByShardingCount(domainStatisticsList);
    List<DomainStatistics> top10UnstableDomain = domainStatisticsList.subList(0, domainStatisticsList.size() > 9 ? 10 : domainStatisticsList.size());
    return JSON.toJSONString(top10UnstableDomain);
}
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