use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class StatisticsPersistence 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 StatisticsPersistence method saveOrUpdateExecutorInDockerCount.
private void saveOrUpdateExecutorInDockerCount(int exeInDocker, String zkAddr) {
try {
String exeInDockerString = JSON.toJSONString(exeInDocker);
SaturnStatistics exeInDockerFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.EXECUTOR_IN_DOCKER_COUNT, zkAddr);
if (exeInDockerFromDB == null) {
SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.EXECUTOR_IN_DOCKER_COUNT, zkAddr, exeInDockerString);
saturnStatisticsService.create(ss);
} else {
exeInDockerFromDB.setResult(exeInDockerString);
saturnStatisticsService.updateByPrimaryKey(exeInDockerFromDB);
}
} 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 saveOrUpdateJobRankDistribution.
private void saveOrUpdateJobRankDistribution(List<JobStatistics> jobList, String zkBsKey) {
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, zkBsKey);
if (jobDegreeMapFromDB == null) {
SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.JOB_RANK_DISTRIBUTION, zkBsKey, 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 StatisticsRefreshServiceImpl method getOldTimeout4AlarmJobs.
private List<Timeout4AlarmJob> getOldTimeout4AlarmJobs(ZkCluster zkCluster) {
SaturnStatistics saturnStatistics = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.TIMEOUT_4_ALARM_JOB, zkCluster.getZkAddr());
List<Timeout4AlarmJob> oldTimeout4AlarmJobs = new ArrayList<>();
if (saturnStatistics != null) {
String result = saturnStatistics.getResult();
if (StringUtils.isNotBlank(result)) {
oldTimeout4AlarmJobs = JSON.parseArray(result, Timeout4AlarmJob.class);
}
}
return oldTimeout4AlarmJobs;
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class StatisticsRefreshServiceImpl method getOldAbnormalJobs.
private List<AbnormalJob> getOldAbnormalJobs(ZkCluster zkCluster) {
SaturnStatistics saturnStatistics = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.UNNORMAL_JOB, zkCluster.getZkAddr());
List<AbnormalJob> oldAbnormalJobs = new ArrayList<>();
if (saturnStatistics != null) {
String result = saturnStatistics.getResult();
if (StringUtils.isNotBlank(result)) {
oldAbnormalJobs = JSON.parseArray(result, AbnormalJob.class);
}
}
return oldAbnormalJobs;
}
Aggregations