Package com.dianping.cat.home.bug.entity

Examples of com.dianping.cat.home.bug.entity.BugReport


  private SimpleDateFormat m_daily_formate = new SimpleDateFormat("yyyyMMdd");

  @Override
  public boolean buildDailyTask(String name, String domain, Date period) {
    BugReport bugReport = queryHourlyReportsByDuration(name, domain, period, TaskHelper.tomorrowZero(period));

    for (Domain d : bugReport.getDomains().values()) {
      d.setProblemUrl(String.format("http://%s/cat/r/p?op=history&reportType=day&domain=%s&date=%s",
            getDomainName(), d.getId(), m_daily_formate.format(period)));
    }
    DailyReport report = new DailyReport();
View Full Code Here


    return m_reportService.insertDailyReport(report, binaryContent);
  }

  @Override
  public boolean buildHourlyTask(String name, String domain, Date start) {
    BugReport bugReport = new BugReport(Constants.CAT);
    ProblemReportVisitor visitor = new ProblemReportVisitor().setReport(bugReport);
    Date end = new Date(start.getTime() + TimeHelper.ONE_HOUR);
    Set<String> domains = m_reportService.queryAllDomainNames(start, end, ProblemAnalyzer.ID);

    for (String domainName : domains) {
      if (validateDomain(domainName)) {
        ProblemReport problemReport = m_reportService.queryProblemReport(domainName, start, end);
        visitor.visitProblemReport(problemReport);
      }
    }

    for (Domain d : bugReport.getDomains().values()) {
      d.setProblemUrl(String.format("http://%s/cat/r/p?domain=%s&date=%s", getDomainName(), d.getId(),
            m_hourly_formate.format(start)));
    }
    HourlyReport report = new HourlyReport();
View Full Code Here

    return m_reportService.insertHourlyReport(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();
View Full Code Here

    return m_reportService.insertMonthlyReport(report, binaryContent);
  }

  @Override
  public boolean buildWeeklyTask(String name, String domain, Date period) {
    BugReport bugReport = queryDailyReportsByDuration(domain, period, new Date(period.getTime() + TimeHelper.ONE_WEEK));

    for (Domain d : bugReport.getDomains().values()) {
      d.setProblemUrl(String.format("http://%s/cat/r/p?op=history&reportType=week&domain=%s&date=%s",
            getDomainName(), d.getId(), m_daily_formate.format(period)));
    }
    WeeklyReport report = new WeeklyReport();
View Full Code Here

  }

  private BugReport queryDailyReportsByDuration(String domain, Date start, Date end) {
    long startTime = start.getTime();
    long endTime = end.getTime();
    HistoryBugReportMerger merger = new HistoryBugReportMerger(new BugReport(domain));

    for (; startTime < endTime; startTime += TimeHelper.ONE_DAY) {
      try {
        BugReport reportModel = m_reportService.queryBugReport(domain, new Date(startTime), new Date(startTime
              + TimeHelper.ONE_DAY));
        reportModel.accept(merger);
      } catch (Exception e) {
        Cat.logError(e);
      }
    }
    BugReport bugReport = merger.getBugReport();
    bugReport.setStartTime(start);
    bugReport.setEndTime(end);
    return bugReport;
  }
View Full Code Here

  }

  private BugReport queryHourlyReportsByDuration(String name, String domain, Date start, Date end) {
    long startTime = start.getTime();
    long endTime = end.getTime();
    BugReportMerger merger = new BugReportMerger(new BugReport(domain));

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

      reportModel.accept(merger);
    }
    com.dianping.cat.home.bug.entity.BugReport bugReport = merger.getBugReport();

    return bugReport;
  }
View Full Code Here

    }
  }  private List<String> queryExceptionList() {
    long current = System.currentTimeMillis();
    Date start = new Date(current - current % TimeHelper.ONE_HOUR - TimeHelper.ONE_HOUR - TimeHelper.ONE_DAY);
    Date end = new Date(start.getTime() + TimeHelper.ONE_HOUR);
    BugReport report = m_reportService.queryBugReport(Constants.CAT, start, end);
    Set<String> keys = new HashSet<String>();
    List<String> exceptions = new ArrayList<String>();

    for (Entry<String, com.dianping.cat.home.bug.entity.Domain> domain : report.getDomains().entrySet()) {
      keys.addAll(domain.getValue().getExceptionItems().keySet());
    }

    for (String key : keys) {
      exceptions.add(key.replaceAll("\n", " "));
View Full Code Here

TOP

Related Classes of com.dianping.cat.home.bug.entity.BugReport

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.