Esempio n. 1
0
  @Override
  public ProblemReport getReport(String domain) {
    ProblemReport report = m_reportManager.getHourlyReport(getStartTime(), domain, false);

    report.getDomainNames().addAll(m_reportManager.getDomains(getStartTime()));

    return report;
  }
Esempio n. 2
0
  @Override
  public ProblemReport makeReport(String domain, long startTime, long duration) {
    ProblemReport report = new ProblemReport(domain);

    report.setStartTime(new Date(startTime));
    report.setEndTime(new Date(startTime + duration - 1));

    return report;
  }
Esempio n. 3
0
  @Override
  public void process(MessageTree tree) {
    String domain = tree.getDomain();
    ProblemReport report = m_reportManager.getHourlyReport(getStartTime(), domain, true);

    report.addIp(tree.getIpAddress());
    Machine machine = report.findOrCreateMachine(tree.getIpAddress());

    for (ProblemHandler handler : m_handlers) {
      handler.handle(machine, tree);
    }
  }
Esempio n. 4
0
  @Test
  public void testProcess() throws Exception {
    for (int i = 1; i <= 100; i++) {
      MessageTree tree = generateMessageTree(i);

      m_analyzer.process(tree);
    }

    ProblemReport report = m_analyzer.getReport(m_domain);

    String expected =
        Files.forIO().readFrom(getClass().getResourceAsStream("problem_analyzer.xml"), "utf-8");
    Assert.assertEquals(expected.replaceAll("\r", ""), report.toString().replaceAll("\r", ""));
  }
Esempio n. 5
0
  @Override
  public boolean createHourlyTask(ProblemReport report) {
    String domain = report.getDomain();

    if (m_manager.validateDomain(domain)) {
      return m_taskManager.createTask(
          report.getStartTime(), domain, ProblemAnalyzer.ID, TaskProlicy.ALL);
    } else if (m_manager.isCrashLog(domain)) {
      return m_taskManager.createTask(
          report.getStartTime(), domain, ProblemAnalyzer.ID, TaskProlicy.ALL_EXCLUED_HOURLY);
    } else {
      return true;
    }
  }
Esempio n. 6
0
  @Override
  public ProblemReport mergeReport(ProblemReport old, ProblemReport other) {
    ProblemReportMerger merger = new ProblemReportMerger(old);

    other.accept(merger);
    return old;
  }
Esempio n. 7
0
  @Override
  protected ProblemReport merge(
      ModelRequest request, List<ModelResponse<ProblemReport>> responses) {
    if (responses.size() == 0) {
      return null;
    }
    ProblemReportMerger merger = new ProblemReportMerger(new ProblemReport(request.getDomain()));

    for (ModelResponse<ProblemReport> response : responses) {
      if (response != null) {
        ProblemReport model = response.getModel();

        if (model != null) {
          model.accept(merger);
        }
      }
    }

    return merger.getProblemReport();
  }
Esempio n. 8
0
  @Override
  public void beforeSave(Map<String, ProblemReport> reports) {
    for (ProblemReport report : reports.values()) {
      Set<String> domainNames = report.getDomainNames();

      domainNames.clear();
      domainNames.addAll(reports.keySet());
    }

    if (reports.size() > 0) {
      ProblemReport all = createAggregatedReport(reports);

      reports.put(all.getDomain(), all);
    }

    ProblemReport frontEnd = reports.get(Constants.FRONT_END);

    if (frontEnd != null) {
      reports.put(Constants.FRONT_END, rebuildFrontEndReport(frontEnd));
    }
  }
Esempio n. 9
0
  @Override
  public void beforeSave(Map<String, ProblemReport> reports) {
    for (ProblemReport report : reports.values()) {
      Set<String> domainNames = report.getDomainNames();

      domainNames.clear();
      domainNames.addAll(reports.keySet());
    }

    try {
      ProblemReportURLFilter problemReportURLFilter = new ProblemReportURLFilter();

      for (Entry<String, ProblemReport> entry : reports.entrySet()) {
        ProblemReport report = entry.getValue();

        problemReportURLFilter.visitProblemReport(report);
      }
    } catch (Exception e) {
      Cat.logError(e);
    }
  }
Esempio n. 10
0
  public ProblemReport createAggregatedReport(Map<String, ProblemReport> reports) {
    ProblemReport report = new ProblemReport(Constants.ALL);
    ProblemReportAllBuilder visitor = new ProblemReportAllBuilder(report);

    try {
      for (ProblemReport temp : reports.values()) {
        if (m_manager.validateDomain(temp.getDomain())) {
          report.getIps().add(temp.getDomain());
          report.getDomainNames().add(temp.getDomain());
          visitor.visitProblemReport(temp);
        }
      }
    } catch (Exception e) {
      Cat.logError(e);
    }
    return report;
  }
Esempio n. 11
0
 @Override
 public String getDomain(ProblemReport report) {
   return report.getDomain();
 }
Esempio n. 12
0
 @Override
 public String buildXml(ProblemReport report) {
   return report.toString();
 }
Esempio n. 13
0
  public ProblemReport rebuildFrontEndReport(ProblemReport report) {
    m_problemReportAggregation.refreshRule();
    report.accept(m_problemReportAggregation);

    return m_problemReportAggregation.getReport();
  }
Esempio n. 14
0
 @Override
 public void visitMachine(Machine machine) {
   m_currentMachine = m_report.findOrCreateMachine(machine.getIp());
   super.visitMachine(machine);
 }
Esempio n. 15
0
 @Override
 public void visitProblemReport(ProblemReport problemReport) {
   m_domain = problemReport.getDomain();
   m_report = new ProblemReport();
   m_report.getIps().addAll(problemReport.getIps());
   m_report.getDomainNames().addAll(problemReport.getDomainNames());
   m_report.setDomain(problemReport.getDomain());
   m_report.setStartTime(problemReport.getStartTime());
   m_report.setEndTime(problemReport.getEndTime());
   super.visitProblemReport(problemReport);
 }