Package com.dianping.cat.report.task.bug

Examples of com.dianping.cat.report.task.bug.BugReportMerger


    return report;
  }

  @Override
  public BugReport queryDailyReport(String domain, Date start, Date end) {
    BugReportMerger merger = new BugReportMerger(new BugReport(domain));
    long startTime = start.getTime();
    long endTime = end.getTime();
    String name = Constants.REPORT_BUG;

    for (; startTime < endTime; startTime = startTime + TimeHelper.ONE_DAY) {
      try {
        DailyReport report = m_dailyReportDao.findByDomainNamePeriod(domain, name, new Date(startTime),
              DailyReportEntity.READSET_FULL);
        String xml = report.getContent();

        if (xml != null && xml.length() > 0) {
          BugReport reportModel = com.dianping.cat.home.bug.transform.DefaultSaxParser.parse(xml);
          reportModel.accept(merger);
        } else {
          BugReport reportModel = queryFromDailyBinary(report.getId(), domain);
          reportModel.accept(merger);
        }
      } catch (DalNotFoundException e) {
        //ignore
      } catch (Exception e) {
        Cat.logError(e);
      }
    }
    BugReport bugReport = merger.getBugReport();

    bugReport.setStartTime(start);
    bugReport.setEndTime(end);
    return bugReport;
  }
View Full Code Here


    }
  }

  @Override
  public BugReport queryHourlyReport(String domain, Date start, Date end) {
    BugReportMerger merger = new BugReportMerger(new BugReport(domain));
    long startTime = start.getTime();
    long endTime = end.getTime();
    String name = Constants.REPORT_BUG;

    for (; startTime < endTime; startTime = startTime + TimeHelper.ONE_HOUR) {
      List<HourlyReport> reports = null;
      try {
        reports = m_hourlyReportDao.findAllByDomainNamePeriod(new Date(startTime), domain, name,
              HourlyReportEntity.READSET_FULL);
      } catch (DalException e) {
        Cat.logError(e);
      }
      if (reports != null) {
        for (HourlyReport report : reports) {
          String xml = report.getContent();

          try {
            if (xml != null && xml.length() > 0) {
              BugReport reportModel = com.dianping.cat.home.bug.transform.DefaultSaxParser.parse(xml);
              reportModel.accept(merger);
            } else {
              BugReport reportModel = queryFromHourlyBinary(report.getId(), domain);
              reportModel.accept(merger);
            }
          } catch (DalNotFoundException e) {
            //ignore
          } catch (Exception e) {
            Cat.logError(e);
          }
        }
      }
    }
    BugReport bugReport = merger.getBugReport();

    bugReport.setStartTime(start);
    bugReport.setEndTime(new Date(end.getTime() - 1));

    return bugReport;
View Full Code Here

TOP

Related Classes of com.dianping.cat.report.task.bug.BugReportMerger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.