コード例 #1
0
  private ServiceReport queryHourlyReportsByDuration(
      String name, String domain, Date start, Date end) {
    long startTime = start.getTime();
    long endTime = end.getTime();
    ServiceReportMerger merger = new ServiceReportMerger(new ServiceReport(domain));

    for (; startTime < endTime; startTime = startTime + TimeHelper.ONE_HOUR) {
      Date date = new Date(startTime);
      ServiceReport reportModel =
          m_reportService.queryReport(domain, date, new Date(date.getTime() + TimeHelper.ONE_HOUR));

      reportModel.accept(merger);
    }

    ServiceReport serviceReport = merger.getServiceReport();

    serviceReport.setStartTime(start);
    serviceReport.setEndTime(end);
    return serviceReport;
  }
コード例 #2
0
  private ServiceReport queryDailyReportsByDuration(String domain, Date start, Date end) {
    long startTime = start.getTime();
    long endTime = end.getTime();
    ServiceReportMerger merger = new ServiceReportMerger(new ServiceReport(domain));

    for (; startTime < endTime; startTime += TimeHelper.ONE_DAY) {
      try {
        ServiceReport reportModel =
            m_reportService.queryReport(
                domain, new Date(startTime), new Date(startTime + TimeHelper.ONE_DAY));
        reportModel.accept(merger);
      } catch (Exception e) {
        Cat.logError(e);
      }
    }
    ServiceReport serviceReport = merger.getServiceReport();

    serviceReport.setStartTime(start);
    serviceReport.setEndTime(end);
    return serviceReport;
  }