use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class StatisticsPersistence method saveOrUpdateTop10UnstableDomain.
private void saveOrUpdateTop10UnstableDomain(List<DomainStatistics> domainList, String zkAddr) {
try {
domainList = DashboardServiceHelper.sortDomainByShardingCount(domainList);
List<DomainStatistics> top10UnstableDomain = domainList.subList(0, domainList.size() > 9 ? 10 : domainList.size());
String top10UnstableDomainJsonString = JSON.toJSONString(top10UnstableDomain);
SaturnStatistics top10UnstableDomainFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.TOP_10_UNSTABLE_DOMAIN, zkAddr);
if (top10UnstableDomainFromDB == null) {
SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.TOP_10_UNSTABLE_DOMAIN, zkAddr, top10UnstableDomainJsonString);
saturnStatisticsService.create(ss);
} else {
top10UnstableDomainFromDB.setResult(top10UnstableDomainJsonString);
saturnStatisticsService.updateByPrimaryKey(top10UnstableDomainFromDB);
}
} 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 saveOrUpdateTop10FailJob.
private void saveOrUpdateTop10FailJob(List<JobStatistics> jobList, String zkAddr) {
try {
jobList = DashboardServiceHelper.sortJobByAllTimeFailureRate(jobList);
List<JobStatistics> top10FailJob = jobList.subList(0, jobList.size() > 9 ? 10 : jobList.size());
String top10FailJobJsonString = JSON.toJSONString(top10FailJob);
SaturnStatistics top10FailJobFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.TOP_10_FAIL_JOB, zkAddr);
if (top10FailJobFromDB == null) {
SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.TOP_10_FAIL_JOB, zkAddr, top10FailJobJsonString);
saturnStatisticsService.create(ss);
} else {
top10FailJobFromDB.setResult(top10FailJobJsonString);
saturnStatisticsService.updateByPrimaryKey(top10FailJobFromDB);
}
} 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 saveOrUpdateTop10ActiveJob.
private void saveOrUpdateTop10ActiveJob(List<JobStatistics> jobList, String zkAddr) {
try {
jobList = DashboardServiceHelper.sortJobByDayProcessCount(jobList);
List<JobStatistics> top10ActiveJob = jobList.subList(0, jobList.size() > 9 ? 10 : jobList.size());
String top10ActiveJobJsonString = JSON.toJSONString(top10ActiveJob);
SaturnStatistics top10ActiveJobFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.TOP_10_ACTIVE_JOB, zkAddr);
if (top10ActiveJobFromDB == null) {
SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.TOP_10_ACTIVE_JOB, zkAddr, top10ActiveJobJsonString);
saturnStatisticsService.create(ss);
} else {
top10ActiveJobFromDB.setResult(top10ActiveJobJsonString);
saturnStatisticsService.updateByPrimaryKey(top10ActiveJobFromDB);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
Aggregations