Search in sources :

Example 16 with SaturnStatistics

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

the class DashboardController method top10FailExecutor.

@ApiResponses(value = { @ApiResponse(code = 200, message = "Success/Fail", response = RequestResult.class) })
@GetMapping(value = "/top10FailExecutor")
public SuccessResponseEntity top10FailExecutor(@RequestParam(required = false) String zkClusterKey) throws SaturnJobConsoleException {
    if (StringUtils.isNotBlank(zkClusterKey)) {
        ZkCluster zkCluster = checkAndGetZkCluster(zkClusterKey);
        SaturnStatistics ss = dashboardService.top10FailureExecutor(zkCluster.getZkAddr());
        return ss == null ? new SuccessResponseEntity() : new SuccessResponseEntity(ss.getResult());
    }
    return new SuccessResponseEntity(dashboardService.top10FailureExecutorByAllZkCluster());
}
Also used : SaturnStatistics(com.vip.saturn.job.console.mybatis.entity.SaturnStatistics) SuccessResponseEntity(com.vip.saturn.job.console.controller.SuccessResponseEntity) ZkCluster(com.vip.saturn.job.console.domain.ZkCluster) ApiResponses(io.swagger.annotations.ApiResponses)

Example 17 with SaturnStatistics

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

the class DashboardController method top10UnstableDomain.

@ApiResponses(value = { @ApiResponse(code = 200, message = "Success/Fail", response = RequestResult.class) })
@GetMapping(value = "/top10UnstableDomain")
public SuccessResponseEntity top10UnstableDomain(@RequestParam(required = false) String zkClusterKey) throws SaturnJobConsoleException {
    if (StringUtils.isNotBlank(zkClusterKey)) {
        ZkCluster zkCluster = checkAndGetZkCluster(zkClusterKey);
        SaturnStatistics ss = dashboardService.top10UnstableDomain(zkCluster.getZkAddr());
        return ss == null ? new SuccessResponseEntity() : new SuccessResponseEntity(ss.getResult());
    }
    return new SuccessResponseEntity(dashboardService.top10UnstableDomainByAllZkCluster());
}
Also used : SaturnStatistics(com.vip.saturn.job.console.mybatis.entity.SaturnStatistics) SuccessResponseEntity(com.vip.saturn.job.console.controller.SuccessResponseEntity) ZkCluster(com.vip.saturn.job.console.domain.ZkCluster) ApiResponses(io.swagger.annotations.ApiResponses)

Example 18 with SaturnStatistics

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

the class DashboardController method top10LoadExecutor.

@ApiResponses(value = { @ApiResponse(code = 200, message = "Success/Fail", response = RequestResult.class) })
@GetMapping(value = "/top10LoadExecutor")
public SuccessResponseEntity top10LoadExecutor(@RequestParam(required = false) String zkClusterKey) throws SaturnJobConsoleException {
    if (StringUtils.isNotBlank(zkClusterKey)) {
        ZkCluster zkCluster = checkAndGetZkCluster(zkClusterKey);
        SaturnStatistics ss = dashboardService.top10LoadExecutor(zkCluster.getZkAddr());
        return ss == null ? new SuccessResponseEntity() : new SuccessResponseEntity(ss.getResult());
    }
    return new SuccessResponseEntity(dashboardService.top10LoadExecutorByAllZkCluster());
}
Also used : SaturnStatistics(com.vip.saturn.job.console.mybatis.entity.SaturnStatistics) SuccessResponseEntity(com.vip.saturn.job.console.controller.SuccessResponseEntity) ZkCluster(com.vip.saturn.job.console.domain.ZkCluster) ApiResponses(io.swagger.annotations.ApiResponses)

Example 19 with SaturnStatistics

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

the class DashboardController method domainProcessCount.

@ApiResponses(value = { @ApiResponse(code = 200, message = "Success/Fail", response = RequestResult.class) })
@GetMapping(value = "/domainProcessCount")
public SuccessResponseEntity domainProcessCount(@RequestParam(required = false) String zkClusterKey) throws SaturnJobConsoleException {
    if (StringUtils.isNotBlank(zkClusterKey)) {
        ZkCluster zkCluster = checkAndGetZkCluster(zkClusterKey);
        SaturnStatistics ss = dashboardService.allProcessAndErrorCountOfTheDay(zkCluster.getZkAddr());
        return ss == null ? new SuccessResponseEntity() : new SuccessResponseEntity(ss.getResult());
    }
    return new SuccessResponseEntity(dashboardService.allProcessAndErrorCountOfTheDayByAllZkCluster());
}
Also used : SaturnStatistics(com.vip.saturn.job.console.mybatis.entity.SaturnStatistics) SuccessResponseEntity(com.vip.saturn.job.console.controller.SuccessResponseEntity) ZkCluster(com.vip.saturn.job.console.domain.ZkCluster) ApiResponses(io.swagger.annotations.ApiResponses)

Example 20 with SaturnStatistics

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

the class DashboardServiceImpl method top10FailureJobByAllZkCluster.

@Override
public String top10FailureJobByAllZkCluster() throws SaturnJobConsoleException {
    List<JobStatistics> jobStatisticsList = new ArrayList<>();
    Collection<ZkCluster> zkClusterList = registryCenterService.getOnlineZkClusterList();
    for (ZkCluster zkCluster : zkClusterList) {
        SaturnStatistics saturnStatistics = top10FailureJob(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.sortJobByAllTimeFailureRate(jobStatisticsList);
    List<JobStatistics> top10FailJob = jobStatisticsList.subList(0, jobStatisticsList.size() > 9 ? 10 : jobStatisticsList.size());
    return JSON.toJSONString(top10FailJob);
}
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