use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl method setUnnormalJobMonitorStatusToReadByAllZkCluster.
@Override
public void setUnnormalJobMonitorStatusToReadByAllZkCluster(String uuid) {
if (StringUtils.isBlank(uuid)) {
return;
}
Collection<ZkCluster> zkClusterList = registryCenterService.getZkClusterList();
for (ZkCluster zkCluster : zkClusterList) {
String zkAddr = zkCluster.getZkAddr();
SaturnStatistics saturnStatistics = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.UNNORMAL_JOB, zkAddr);
if (saturnStatistics != null) {
boolean find = false;
String result = saturnStatistics.getResult();
List<AbnormalJob> abnormalJobList = JSON.parseArray(result, AbnormalJob.class);
if (abnormalJobList != null) {
for (AbnormalJob abnormalJob : abnormalJobList) {
if (uuid.equals(abnormalJob.getUuid())) {
abnormalJob.setRead(true);
find = true;
break;
}
}
}
if (find) {
saturnStatistics.setResult(JSON.toJSONString(abnormalJobList));
saturnStatisticsService.updateByPrimaryKeySelective(saturnStatistics);
return;
}
}
}
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl method saveOrUpdateDomainProcessCount.
private void saveOrUpdateDomainProcessCount(ZkStatistics zks, String zkAddr) {
try {
String domainListJsonString = JSON.toJSONString(zks);
SaturnStatistics domainProcessCountFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.DOMAIN_PROCESS_COUNT_OF_THE_DAY, zkAddr);
if (domainProcessCountFromDB == null) {
SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.DOMAIN_PROCESS_COUNT_OF_THE_DAY, zkAddr, domainListJsonString);
saturnStatisticsService.create(ss);
} else {
domainProcessCountFromDB.setResult(domainListJsonString);
saturnStatisticsService.updateByPrimaryKey(domainProcessCountFromDB);
}
} 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 DashboardServiceImpl method allUnableFailoverJobByAllZkCluster.
@Override
public String allUnableFailoverJobByAllZkCluster() {
List<AbnormalJob> abnormalJobList = new ArrayList<>();
Collection<ZkCluster> zkClusterList = registryCenterService.getZkClusterList();
for (ZkCluster zkCluster : zkClusterList) {
SaturnStatistics saturnStatistics = allUnableFailoverJob(zkCluster.getZkAddr());
if (saturnStatistics != null) {
String result = saturnStatistics.getResult();
List<AbnormalJob> tempList = JSON.parseArray(result, AbnormalJob.class);
if (tempList != null) {
abnormalJobList.addAll(tempList);
}
}
}
return JSON.toJSONString(abnormalJobList);
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardController method top10LoadJob.
@ApiResponses(value = { @ApiResponse(code = 200, message = "Success/Fail", response = RequestResult.class) })
@GetMapping(value = "/top10LoadJob")
public SuccessResponseEntity top10LoadJob(@RequestParam(required = false) String zkClusterKey) throws SaturnJobConsoleException {
if (StringUtils.isNotBlank(zkClusterKey)) {
ZkCluster zkCluster = checkAndGetZkCluster(zkClusterKey);
SaturnStatistics ss = dashboardService.top10LoadJob(zkCluster.getZkAddr());
return ss == null ? new SuccessResponseEntity() : new SuccessResponseEntity(ss.getResult());
}
return new SuccessResponseEntity(dashboardService.top10LoadJobByAllZkCluster());
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardController method top10ActiveJob.
@ApiResponses(value = { @ApiResponse(code = 200, message = "Success/Fail", response = RequestResult.class) })
@GetMapping(value = "/top10ActiveJob")
public SuccessResponseEntity top10ActiveJob(@RequestParam(required = false) String zkClusterKey) throws SaturnJobConsoleException {
if (StringUtils.isNotBlank(zkClusterKey)) {
ZkCluster zkCluster = checkAndGetZkCluster(zkClusterKey);
SaturnStatistics ss = dashboardService.top10AactiveJob(zkCluster.getZkAddr());
return ss == null ? new SuccessResponseEntity() : new SuccessResponseEntity(ss.getResult());
}
return new SuccessResponseEntity(dashboardService.top10AactiveJobByAllZkCluster());
}
Aggregations