use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class AlarmStatisticsServiceImpl method setAlarmJobMonitorStatusToRead.
private <T extends AbstractAlarmJob> void setAlarmJobMonitorStatusToRead(String uuid, String alarmJobType, Class<T> t) throws SaturnJobConsoleException {
Collection<ZkCluster> zkClusterList = registryCenterService.getZkClusterList();
for (ZkCluster zkCluster : zkClusterList) {
SaturnStatistics saturnStatistics = saturnStatisticsService.findStatisticsByNameAndZkList(alarmJobType, zkCluster.getZkAddr());
if (null == saturnStatistics) {
continue;
}
String result = saturnStatistics.getResult();
List<T> jobs = JSON.parseArray(result, t);
if (jobs != null) {
boolean find = false;
for (T job : jobs) {
if (uuid.equals(job.getUuid())) {
job.setRead(true);
find = true;
break;
}
}
if (find) {
saturnStatistics.setResult(JSON.toJSONString(jobs));
saturnStatisticsService.updateByPrimaryKeySelective(saturnStatistics);
return;
}
}
}
throw new SaturnJobConsoleException(String.format("该uuid(%s)不存在", uuid));
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl method top10FailureDomainByAllZkCluster.
@Override
public String top10FailureDomainByAllZkCluster() throws SaturnJobConsoleException {
List<DomainStatistics> domainStatisticsList = new ArrayList<>();
Collection<ZkCluster> zkClusterList = registryCenterService.getOnlineZkClusterList();
for (ZkCluster zkCluster : zkClusterList) {
SaturnStatistics saturnStatistics = top10FailureDomain(zkCluster.getZkAddr());
if (saturnStatistics != null) {
String result = saturnStatistics.getResult();
List<DomainStatistics> tempList = JSON.parseArray(result, DomainStatistics.class);
if (tempList != null) {
domainStatisticsList.addAll(tempList);
}
}
}
domainStatisticsList = DashboardServiceHelper.sortDomainByAllTimeFailureRate(domainStatisticsList);
List<DomainStatistics> top10FailureDomain = domainStatisticsList.subList(0, domainStatisticsList.size() > 9 ? 10 : domainStatisticsList.size());
return JSON.toJSONString(top10FailureDomain);
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl method allProcessAndErrorCountOfTheDayByAllZkCluster.
@Override
public String allProcessAndErrorCountOfTheDayByAllZkCluster() throws SaturnJobConsoleException {
long count = 0;
long error = 0;
Collection<ZkCluster> zkClusterList = registryCenterService.getOnlineZkClusterList();
for (ZkCluster zkCluster : zkClusterList) {
SaturnStatistics saturnStatistics = allProcessAndErrorCountOfTheDay(zkCluster.getZkAddr());
if (saturnStatistics != null) {
String result = saturnStatistics.getResult();
ZkStatistics temp = JSON.parseObject(result, ZkStatistics.class);
if (temp != null) {
count += temp.getCount();
error += temp.getError();
}
}
}
return JSON.toJSONString(new ZkStatistics(count, error));
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl method top10AactiveJobByAllZkCluster.
@Override
public String top10AactiveJobByAllZkCluster() throws SaturnJobConsoleException {
List<JobStatistics> jobStatisticsList = new ArrayList<>();
Collection<ZkCluster> zkClusterList = registryCenterService.getOnlineZkClusterList();
for (ZkCluster zkCluster : zkClusterList) {
SaturnStatistics saturnStatistics = top10AactiveJob(zkCluster.getZkAddr());
if (saturnStatistics != null) {
String result = saturnStatistics.getResult();
List<JobStatistics> tempList = JSON.parseArray(result, JobStatistics.class);
if (tempList != null) {
jobStatisticsList.addAll(tempList);
}
}
}
jobStatisticsList = DashboardServiceHelper.sortJobByDayProcessCount(jobStatisticsList);
List<JobStatistics> top10AactiveJob = jobStatisticsList.subList(0, jobStatisticsList.size() > 9 ? 10 : jobStatisticsList.size());
return JSON.toJSONString(top10AactiveJob);
}
use of com.vip.saturn.job.console.mybatis.entity.SaturnStatistics in project Saturn by vipshop.
the class DashboardServiceImpl method top10UnstableDomainByAllZkCluster.
@Override
public String top10UnstableDomainByAllZkCluster() throws SaturnJobConsoleException {
List<DomainStatistics> domainStatisticsList = new ArrayList<>();
Collection<ZkCluster> zkClusterList = registryCenterService.getOnlineZkClusterList();
for (ZkCluster zkCluster : zkClusterList) {
SaturnStatistics saturnStatistics = top10UnstableDomain(zkCluster.getZkAddr());
if (saturnStatistics != null) {
String result = saturnStatistics.getResult();
List<DomainStatistics> tempList = JSON.parseArray(result, DomainStatistics.class);
if (tempList != null) {
domainStatisticsList.addAll(tempList);
}
}
}
domainStatisticsList = DashboardServiceHelper.sortDomainByShardingCount(domainStatisticsList);
List<DomainStatistics> top10UnstableDomain = domainStatisticsList.subList(0, domainStatisticsList.size() > 9 ? 10 : domainStatisticsList.size());
return JSON.toJSONString(top10UnstableDomain);
}
Aggregations