use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl method top10LoadExecutorByAllZkCluster.
@Override
public String top10LoadExecutorByAllZkCluster() throws SaturnJobConsoleException {
List<ExecutorStatistics> executorStatisticsList = new ArrayList<>();
Collection<ZkCluster> zkClusterList = registryCenterService.getOnlineZkClusterList();
for (ZkCluster zkCluster : zkClusterList) {
SaturnStatistics saturnStatistics = top10LoadExecutor(zkCluster.getZkAddr());
if (saturnStatistics != null) {
String result = saturnStatistics.getResult();
List<ExecutorStatistics> tempList = JSON.parseArray(result, ExecutorStatistics.class);
if (tempList != null) {
executorStatisticsList.addAll(tempList);
}
}
}
executorStatisticsList = DashboardServiceHelper.sortExecutorByLoadLevel(executorStatisticsList);
List<ExecutorStatistics> top10LoadExecutor = executorStatisticsList.subList(0, executorStatisticsList.size() > 9 ? 10 : executorStatisticsList.size());
return JSON.toJSONString(top10LoadExecutor);
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardController method top10FailJob.
@ApiResponses(value = { @ApiResponse(code = 200, message = "Success/Fail", response = RequestResult.class) })
@GetMapping(value = "/top10FailJob")
public SuccessResponseEntity top10FailJob(@RequestParam(required = false) String zkClusterKey) throws SaturnJobConsoleException {
if (StringUtils.isNotBlank(zkClusterKey)) {
ZkCluster zkCluster = checkAndGetZkCluster(zkClusterKey);
SaturnStatistics ss = dashboardService.top10FailureJob(zkCluster.getZkAddr());
return ss == null ? new SuccessResponseEntity() : new SuccessResponseEntity(ss.getResult());
}
return new SuccessResponseEntity(dashboardService.top10FailureJobByAllZkCluster());
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardController method top10FailDomain.
@ApiResponses(value = { @ApiResponse(code = 200, message = "Success/Fail", response = RequestResult.class) })
@GetMapping(value = "/top10FailDomain")
public SuccessResponseEntity top10FailDomain(@RequestParam(required = false) String zkClusterKey) throws SaturnJobConsoleException {
if (StringUtils.isNotBlank(zkClusterKey)) {
ZkCluster zkCluster = checkAndGetZkCluster(zkClusterKey);
SaturnStatistics ss = dashboardService.top10FailureDomain(zkCluster.getZkAddr());
return ss == null ? new SuccessResponseEntity() : new SuccessResponseEntity(ss.getResult());
}
return new SuccessResponseEntity(dashboardService.top10FailureDomainByAllZkCluster());
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class StatisticsPersistence method saveOrUpdateExecutorNotInDockerCount.
private void saveOrUpdateExecutorNotInDockerCount(int exeNotInDocker, String zkAddr) {
try {
String exeNotInDockerString = JSON.toJSONString(exeNotInDocker);
SaturnStatistics exeNotInDockerFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.EXECUTOR_NOT_IN_DOCKER_COUNT, zkAddr);
if (exeNotInDockerFromDB == null) {
SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.EXECUTOR_NOT_IN_DOCKER_COUNT, zkAddr, exeNotInDockerString);
saturnStatisticsService.create(ss);
} else {
exeNotInDockerFromDB.setResult(exeNotInDockerString);
saturnStatisticsService.updateByPrimaryKey(exeNotInDockerFromDB);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class StatisticsPersistence 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);
}
}
Aggregations