Package com.dianping.cat.consumer.problem.model.entity

Examples of com.dianping.cat.consumer.problem.model.entity.ProblemReport


    List<ProblemReport> reports = new ArrayList<ProblemReport>();
    long startTime = start.getTime();
    long endTime = end.getTime();

    for (; startTime < endTime; startTime = startTime + TimeHelper.ONE_HOUR) {
      ProblemReport report = m_reportService.queryProblemReport(domain, new Date(startTime), new Date(startTime
            + TimeHelper.ONE_HOUR));

      reports.add(report);
    }
    return m_problemMerger.mergeForDaily(domain, reports, domainSet);
View Full Code Here


    int eventFlag = names.indexOf(EventAnalyzer.ID);
    int problemFlag = names.indexOf(ProblemAnalyzer.ID);
    Date end = new Date(start.getTime() + TimeHelper.ONE_DAY);
    TransactionReport transactionReport = m_reportService.queryTransactionReport(domain, start, end);
    EventReport eventReport = m_reportService.queryEventReport(domain, start, end);
    ProblemReport problemReport = m_reportService.queryProblemReport(domain, start, end);

    StringBuilder sb = new StringBuilder(10240);
    sb.append(m_sdf.format(start)).append("</br>");
    if (transactionFlag > -1) {
      sb.append(m_render.renderReport(transactionReport));
View Full Code Here

  @Test
  public void testProblem() throws Exception {
    String excepted = Files.forIO().readFrom(getClass().getResourceAsStream("ProblemRender.txt"), "utf-8");
    String oldXml = Files.forIO().readFrom(getClass().getResourceAsStream("Problem.xml"), "utf-8");
    ProblemReport report = com.dianping.cat.consumer.problem.model.transform.DefaultSaxParser.parse(oldXml);

    String result = m_render.renderReport(report);
    Assert.assertEquals(excepted.replaceAll("\r", ""), result.replaceAll("\r", ""));
  }
View Full Code Here

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

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

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

    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);
View Full Code Here

  public String buildXml(ProblemReport report) {
    return report.toString();
  }

  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);
View Full Code Here

    return report.getDomain();
  }

  @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;
  }
View Full Code Here

    return DefaultNativeParser.parse(bytes);
  }

  @Override
  public ProblemReport parseXml(String xml) throws Exception {
    ProblemReport report = DefaultSaxParser.parse(xml);

    return report;
  }
View Full Code Here

  @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();
View Full Code Here

    super(ProblemAnalyzer.ID);
  }

  @Override
  protected ProblemReport getReport(ModelRequest request, ModelPeriod period, String domain) throws Exception {
    ProblemReport report = super.getReport(request, period, domain);

    if (report == null && period.isLast()) {
      long startTime = request.getStartTime();
      report = getReportFromLocalDisk(startTime, domain);
   
      if (report == null) {
        report = new ProblemReport(domain);
        report.setStartTime(new Date(startTime));
        report.setEndTime(new Date(startTime + TimeHelper.ONE_HOUR - 1));
      }
    }
    return report;
  }
View Full Code Here

  @Override
  protected ProblemReport buildModel(ModelRequest request) throws Exception {
    String domain = request.getDomain();
    long date = request.getStartTime();
    ProblemReport report;

    if (isLocalMode()) {
      report = getReportFromLocalDisk(date, domain);
    } else {
      report = getReportFromDatabase(date, domain);
View Full Code Here

TOP

Related Classes of com.dianping.cat.consumer.problem.model.entity.ProblemReport

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.