use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class AlarmStatisticsServiceImpl method getTimeout4AlarmJobsStringByZKCluster.
@Override
public String getTimeout4AlarmJobsStringByZKCluster(String zkClusterKey) throws SaturnJobConsoleException {
ZkCluster zkCluster = validateAndGetZKCluster(zkClusterKey);
SaturnStatistics saturnStatistics = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.TIMEOUT_4_ALARM_JOB, zkCluster.getZkAddr());
return saturnStatistics != null ? saturnStatistics.getResult() : null;
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class AlarmStatisticsServiceImpl method getAbnormalContainers.
@Override
public String getAbnormalContainers(String zkClusterKey) throws SaturnJobConsoleException {
ZkCluster zkCluster = validateAndGetZKCluster(zkClusterKey);
SaturnStatistics saturnStatistics = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.ABNORMAL_CONTAINER, zkCluster.getZkAddr());
return saturnStatistics != null ? saturnStatistics.getResult() : null;
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl method top10FailureExecutorByAllZkCluster.
@Override
public String top10FailureExecutorByAllZkCluster() throws SaturnJobConsoleException {
List<ExecutorStatistics> executorStatisticsList = new ArrayList<>();
Collection<ZkCluster> zkClusterList = registryCenterService.getOnlineZkClusterList();
for (ZkCluster zkCluster : zkClusterList) {
SaturnStatistics saturnStatistics = top10FailureExecutor(zkCluster.getZkAddr());
if (saturnStatistics != null) {
String result = saturnStatistics.getResult();
List<ExecutorStatistics> tempList = JSON.parseArray(result, ExecutorStatistics.class);
if (tempList != null) {
executorStatisticsList.addAll(tempList);
}
}
}
executorStatisticsList = DashboardServiceHelper.sortExecutorByFailureRate(executorStatisticsList);
List<ExecutorStatistics> top10FailureExecutor = executorStatisticsList.subList(0, executorStatisticsList.size() > 9 ? 10 : executorStatisticsList.size());
return JSON.toJSONString(top10FailureExecutor);
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl 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 DashboardServiceImpl method setTimeout4AlarmJobMonitorStatusToReadByAllZkCluster.
@Override
public void setTimeout4AlarmJobMonitorStatusToReadByAllZkCluster(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.TIMEOUT_4_ALARM_JOB, zkAddr);
if (saturnStatistics != null) {
boolean find = false;
String result = saturnStatistics.getResult();
List<Timeout4AlarmJob> jobs = JSON.parseArray(result, Timeout4AlarmJob.class);
if (jobs != null) {
for (Timeout4AlarmJob job : jobs) {
if (uuid.equals(job.getUuid())) {
job.setRead(true);
find = true;
break;
}
}
}
if (find) {
saturnStatistics.setResult(JSON.toJSONString(jobs));
saturnStatisticsService.updateByPrimaryKeySelective(saturnStatistics);
return;
}
}
}
}
Aggregations