return m_reportService.insertDailyReport(report, binaryContent);
}
@Override
public boolean buildHourlyTask(String name, String domain, Date start) {
UtilizationReport utilizationReport = new UtilizationReport(Constants.CAT);
Date end = new Date(start.getTime() + TimeHelper.ONE_HOUR);
Set<String> domains = m_reportService.queryAllDomainNames(start, end, TransactionAnalyzer.ID);
TransactionReportVisitor transactionVisitor = new TransactionReportVisitor()
.setUtilizationReport(utilizationReport);
HeartbeatReportVisitor heartbeatVisitor = new HeartbeatReportVisitor().setUtilizationReport(utilizationReport);
for (String domainName : domains) {
if (m_configManger.validateDomain(domainName)) {
TransactionReport transactionReport = m_reportService.queryTransactionReport(domainName, start, end);
int size = transactionReport.getMachines().size();
utilizationReport.findOrCreateDomain(domainName).setMachineNumber(size);
transactionReport = m_mergeManager.mergerAllIp(transactionReport, Constants.ALL);
transactionVisitor.visitTransactionReport(transactionReport);
}
}
for (String domainName : domains) {
if (m_configManger.validateDomain(domainName)) {
HeartbeatReport heartbeatReport = m_reportService.queryHeartbeatReport(domainName, start, end);
heartbeatVisitor.visitHeartbeatReport(heartbeatReport);
}
}
for (String domainName : domains) {
if (m_configManger.validateDomain(domainName)) {
CrossReport crossReport = m_reportService.queryCrossReport(domainName, start, end);
ProjectInfo projectInfo = new ProjectInfo(TimeHelper.ONE_HOUR);
projectInfo.setHostinfoService(m_hostinfoService);
projectInfo.setClientIp(Constants.ALL);
projectInfo.visitCrossReport(crossReport);
Collection<TypeDetailInfo> callInfos = projectInfo.getCallProjectsInfo();
for (TypeDetailInfo typeInfo : callInfos) {
String project = typeInfo.getProjectName();
if (!validataService(project)) {
long failure = typeInfo.getFailureCount();
Domain d = utilizationReport.findOrCreateDomain(project);
ApplicationState service = d.findApplicationState("PigeonService");
if (service != null) {
service.setFailureCount(service.getFailureCount() + failure);
long count = service.getCount();
if (count > 0) {
service.setFailurePercent(service.getFailureCount() * 1.0 / count);
}
}
}
}
}
}
utilizationReport.setStartTime(start);
utilizationReport.setEndTime(end);
HourlyReport report = new HourlyReport();
report.setContent("");
report.setCreationDate(new Date());