@Override public HeavyReport queryMonthlyReport(String domain, Date start) { try { MonthlyReport entity = m_monthlyReportDao.findReportByDomainNamePeriod( start, domain, Constants.REPORT_HEAVY, MonthlyReportEntity.READSET_FULL); return queryFromMonthlyBinary(entity.getId(), domain); } catch (DalNotFoundException e) { // ignore } catch (Exception e) { Cat.logError(e); } return new HeavyReport(domain); }
@Override public StateReport queryMonthlyReport(String domain, Date start) { try { MonthlyReport entity = m_monthlyReportDao.findReportByDomainNamePeriod( start, domain, StateAnalyzer.ID, MonthlyReportEntity.READSET_FULL); String content = entity.getContent(); if (content != null && content.length() > 0) { return com.dianping.cat.consumer.state.model.transform.DefaultSaxParser.parse(content); } else { return queryFromMonthlyBinary(entity.getId(), domain); } } catch (DalNotFoundException e) { // ignore } catch (Exception e) { Cat.logError(e); } return new StateReport(domain); }
@Override public boolean buildMonthlyTask(String name, String domain, Date period) { ServiceReport serviceReport = queryDailyReportsByDuration(domain, period, TaskHelper.nextMonthStart(period)); MonthlyReport report = new MonthlyReport(); report.setCreationDate(new Date()); report.setDomain(domain); report.setIp(NetworkInterfaceManager.INSTANCE.getLocalHostAddress()); report.setName(name); report.setPeriod(period); report.setType(1); byte[] binaryContent = DefaultNativeBuilder.build(serviceReport); return m_reportService.insertMonthlyReport(report, binaryContent); }
@Override public boolean buildMonthlyTask(String name, String domain, Date period) { BugReport bugReport = queryDailyReportsByDuration(domain, period, TaskHelper.nextMonthStart(period)); for (Domain d : bugReport.getDomains().values()) { d.setProblemUrl( String.format( "http://%s/cat/r/p?op=history&reportType=month&domain=%s&date=%s", getDomainName(), d.getId(), m_daily_formate.format(period))); } MonthlyReport report = new MonthlyReport(); report.setContent(""); report.setCreationDate(new Date()); report.setDomain(domain); report.setIp(NetworkInterfaceManager.INSTANCE.getLocalHostAddress()); report.setName(name); report.setPeriod(period); report.setType(1); byte[] binaryContent = DefaultNativeBuilder.build(bugReport); return m_reportService.insertMonthlyReport(report, binaryContent); }