use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl 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);
}
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl method saveOrUpdateTop10FailDomain.
private void saveOrUpdateTop10FailDomain(List<DomainStatistics> domainList, String zkAddr) {
try {
domainList = DashboardServiceHelper.sortDomainByAllTimeFailureRate(domainList);
List<DomainStatistics> top10FailDomainList = domainList.subList(0, domainList.size() > 9 ? 10 : domainList.size());
String top10FailDomainJsonString = JSON.toJSONString(top10FailDomainList);
SaturnStatistics top10FailDomainFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.TOP_10_FAIL_DOMAIN, zkAddr);
if (top10FailDomainFromDB == null) {
SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.TOP_10_FAIL_DOMAIN, zkAddr, top10FailDomainJsonString);
saturnStatisticsService.create(ss);
} else {
top10FailDomainFromDB.setResult(top10FailDomainJsonString);
saturnStatisticsService.updateByPrimaryKey(top10FailDomainFromDB);
}
} 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 abnormalContainerByAllZkCluster.
@Override
public String abnormalContainerByAllZkCluster() {
List<AbnormalContainer> abnormalContainerList = new ArrayList<>();
Collection<ZkCluster> zkClusterList = registryCenterService.getZkClusterList();
for (ZkCluster zkCluster : zkClusterList) {
SaturnStatistics saturnStatistics = abnormalContainer(zkCluster.getZkAddr());
if (saturnStatistics != null) {
String result = saturnStatistics.getResult();
List<AbnormalContainer> tempList = JSON.parseArray(result, AbnormalContainer.class);
if (tempList != null) {
abnormalContainerList.addAll(tempList);
}
}
}
return JSON.toJSONString(abnormalContainerList);
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl method saveOrUpdateVersionDomainNumber.
private void saveOrUpdateVersionDomainNumber(Map<String, Long> versionDomainNumber, String zkAddr) {
try {
String versionDomainNumberJsonString = JSON.toJSONString(versionDomainNumber);
SaturnStatistics versionDomainNumberFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.VERSION_DOMAIN_NUMBER, zkAddr);
if (versionDomainNumberFromDB == null) {
SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.VERSION_DOMAIN_NUMBER, zkAddr, versionDomainNumberJsonString);
saturnStatisticsService.create(ss);
} else {
versionDomainNumberFromDB.setResult(versionDomainNumberJsonString);
saturnStatisticsService.updateByPrimaryKey(versionDomainNumberFromDB);
}
} 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 allTimeout4AlarmJobByAllZkCluster.
@Override
public String allTimeout4AlarmJobByAllZkCluster() {
List<Timeout4AlarmJob> abnormalJobList = new ArrayList<>();
Collection<ZkCluster> zkClusterList = registryCenterService.getZkClusterList();
for (ZkCluster zkCluster : zkClusterList) {
SaturnStatistics saturnStatistics = allTimeout4AlarmJob(zkCluster.getZkAddr());
if (saturnStatistics != null) {
String result = saturnStatistics.getResult();
List<Timeout4AlarmJob> tempList = JSON.parseArray(result, Timeout4AlarmJob.class);
if (tempList != null) {
abnormalJobList.addAll(tempList);
}
}
}
return JSON.toJSONString(abnormalJobList);
}
Aggregations