use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl method saveOrUpdateJobRankDistribution.
private void saveOrUpdateJobRankDistribution(List<JobStatistics> jobList, String zkAddr) {
try {
Map<Integer, Integer> jobDegreeCountMap = new HashMap<>();
for (JobStatistics jobStatistics : jobList) {
int jobDegree = jobStatistics.getJobDegree();
Integer count = jobDegreeCountMap.get(jobDegree);
jobDegreeCountMap.put(jobDegree, count == null ? 1 : count + 1);
}
String jobDegreeMapString = JSON.toJSONString(jobDegreeCountMap);
SaturnStatistics jobDegreeMapFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.JOB_RANK_DISTRIBUTION, zkAddr);
if (jobDegreeMapFromDB == null) {
SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.JOB_RANK_DISTRIBUTION, zkAddr, jobDegreeMapString);
saturnStatisticsService.create(ss);
} else {
jobDegreeMapFromDB.setResult(jobDegreeMapString);
saturnStatisticsService.updateByPrimaryKey(jobDegreeMapFromDB);
}
} 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 saveOrUpdateVersionExecutorNumber.
private void saveOrUpdateVersionExecutorNumber(Map<String, Long> versionExecutorNumber, String zkAddr) {
try {
String versionExecutorNumberJsonString = JSON.toJSONString(versionExecutorNumber);
SaturnStatistics versionExecutorNumberFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.VERSION_EXECUTOR_NUMBER, zkAddr);
if (versionExecutorNumberFromDB == null) {
SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.VERSION_EXECUTOR_NUMBER, zkAddr, versionExecutorNumberJsonString);
saturnStatisticsService.create(ss);
} else {
versionExecutorNumberFromDB.setResult(versionExecutorNumberJsonString);
saturnStatisticsService.updateByPrimaryKey(versionExecutorNumberFromDB);
}
} 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 allUnnormalJobByAllZkCluster.
@Override
public String allUnnormalJobByAllZkCluster() {
List<AbnormalJob> abnormalJobList = new ArrayList<>();
Collection<ZkCluster> zkClusterList = registryCenterService.getZkClusterList();
for (ZkCluster zkCluster : zkClusterList) {
SaturnStatistics saturnStatistics = allUnnormalJob(zkCluster.getZkAddr());
if (saturnStatistics != null) {
String result = saturnStatistics.getResult();
List<AbnormalJob> tempList = JSON.parseArray(result, AbnormalJob.class);
if (tempList != null) {
abnormalJobList.addAll(tempList);
}
}
}
abnormalJobList = DashboardServiceHelper.sortUnnormaoJobByTimeDesc(abnormalJobList);
return JSON.toJSONString(abnormalJobList);
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl method saveOrUpdateTimeout4AlarmJob.
private void saveOrUpdateTimeout4AlarmJob(List<Timeout4AlarmJob> timeout4AlarmJobList, String zkAddr) {
try {
String timeout4AlarmJobJsonString = JSON.toJSONString(timeout4AlarmJobList);
SaturnStatistics timeout4AlarmJobFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.TIMEOUT_4_ALARM_JOB, zkAddr);
if (timeout4AlarmJobFromDB == null) {
SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.TIMEOUT_4_ALARM_JOB, zkAddr, timeout4AlarmJobJsonString);
saturnStatisticsService.create(ss);
} else {
List<Timeout4AlarmJob> oldTimeout4AlarmJobs = JSON.parseArray(timeout4AlarmJobFromDB.getResult(), Timeout4AlarmJob.class);
dealWithReadStatus4Timeout4AlarmJob(timeout4AlarmJobList, oldTimeout4AlarmJobs);
timeout4AlarmJobFromDB.setResult(JSON.toJSONString(timeout4AlarmJobList));
saturnStatisticsService.updateByPrimaryKey(timeout4AlarmJobFromDB);
}
} 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 saveOrUpdateUnableFailoverJob.
private void saveOrUpdateUnableFailoverJob(List<AbnormalJob> unableFailoverJobList, String zkAddr) {
try {
String unableFailoverJobJsonString = JSON.toJSONString(unableFailoverJobList);
SaturnStatistics unableFailoverJobFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.UNABLE_FAILOVER_JOB, zkAddr);
if (unableFailoverJobFromDB == null) {
SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.UNABLE_FAILOVER_JOB, zkAddr, unableFailoverJobJsonString);
saturnStatisticsService.create(ss);
} else {
unableFailoverJobFromDB.setResult(unableFailoverJobJsonString);
saturnStatisticsService.updateByPrimaryKey(unableFailoverJobFromDB);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
Aggregations