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

Examples of com.dianping.cat.consumer.cross.model.entity.CrossReport


  }

  @Override
  public void visitCrossReport(CrossReport crossReport) {
    super.visitCrossReport(crossReport);
    CrossReport report = getCrossReport();
    report.getDomainNames().addAll(crossReport.getDomainNames());
    report.getIps().addAll(crossReport.getIps());
  }
View Full Code Here


    m_logger = logger;
  }

  @Override
  public CrossReport getReport(String domain) {
    CrossReport report = m_reportManager.getHourlyReport(getStartTime(), domain, false);

    report.getDomainNames().addAll(m_reportManager.getDomains(getStartTime()));
    return report;
  }
View Full Code Here

    return info;
  }

  private void updateServerCrossReport(Transaction t, String domain, CrossInfo info) {
    if (!HostinfoService.UNKNOWN_PROJECT.equals(domain)) {
      CrossReport report = m_reportManager.getHourlyReport(getStartTime(), domain, true);

      report.addIp(info.getLocalAddress());
      updateCrossReport(report, t, info);
    }
  }
View Full Code Here

  }

  @Override
  public void process(MessageTree tree) {
    String domain = tree.getDomain();
    CrossReport report = m_reportManager.getHourlyReport(getStartTime(), domain, true);

    Message message = tree.getMessage();
    report.addIp(tree.getIpAddress());

    if (message instanceof Transaction) {
      processTransaction(report, tree, (Transaction) message);
    }
  }
View Full Code Here

      if (reports == null && createIfNotExist) {
        reports = new ConcurrentHashMap<String, CrossReport>();
        m_reports.put(startTime, reports);
      }

      CrossReport report = reports.get(domain);

      if (report == null && createIfNotExist) {
        report = new CrossReport(domain);

        report.setStartTime(new Date(startTime));
        report.setEndTime(new Date(startTime + Constants.HOUR - 1));
        reports.put(domain, report);
      }
      return report;
    }
View Full Code Here

public class CrossReportMergerTest {
  @Test
  public void testCrossReportMerge() throws Exception {
    String oldXml = Files.forIO().readFrom(getClass().getResourceAsStream("cross_analyzer.xml"), "utf-8");
    String newXml = Files.forIO().readFrom(getClass().getResourceAsStream("cross_analyzer.xml"), "utf-8");
    CrossReport reportOld = DefaultSaxParser.parse(oldXml);
    CrossReport reportNew = DefaultSaxParser.parse(newXml);
    String expected = Files.forIO().readFrom(getClass().getResourceAsStream("cross_analyzer_merger.xml"), "utf-8");
    CrossReportMerger merger = new CrossReportMerger(new CrossReport(reportOld.getDomain()));

    reportOld.accept(merger);
    reportNew.accept(merger);

    Assert.assertEquals("Check the merge result!", expected.replace("\r", ""), merger.getCrossReport().toString()
          .replace("\r", ""));
    Assert.assertEquals("Source report is changed!", newXml.replace("\r", ""), reportNew.toString().replace("\r", ""));
  }
View Full Code Here

      MessageTree tree = generateMessageTree(i);

      m_analyzer.process(tree);
    }

    CrossReport report = m_analyzer.getReport(m_domain);
    String expected = Files.forIO().readFrom(getClass().getResourceAsStream("cross_analyzer.xml"), "utf-8");
    Assert.assertEquals(expected.replaceAll("\r", ""), report.toString().replaceAll("\r", ""));

    CrossReport reportCaller = m_analyzer.getReport("server");
    String expectedCaller = Files.forIO().readFrom(getClass().getResourceAsStream("cross_analyzer_caller.xml"),
          "utf-8");
    Assert.assertEquals(expectedCaller.replaceAll("\r", ""), reportCaller.toString().replaceAll("\r", ""));
  }
View Full Code Here

  @Inject(type = ModelService.class, value = CrossAnalyzer.ID)
  private ModelService<CrossReport> m_service;

  private ProjectInfo buildCallProjectInfo(String domain, ModelPeriod period, String date, long duration) {
    CrossReport projectReport = getHourlyReport(domain, period, date, Constants.ALL);
    ProjectInfo projectInfo = new ProjectInfo(duration);

    projectInfo.setHostinfoService(m_hostinfoService);
    projectInfo.setClientIp(Constants.ALL);
    projectInfo.visitCrossReport(projectReport);
View Full Code Here

    return projectInfo;
  }

  private ProjectInfo buildHistoryCallProjectInfo(String domain, Date start, Date end) {
    CrossReport projectReport = getSummarizeReport(domain, start, end);
    ProjectInfo projectInfo = new ProjectInfo(end.getTime() - start.getTime());

    projectInfo.setHostinfoService(m_hostinfoService);
    projectInfo.setClientIp(Constants.ALL);
    projectInfo.visitCrossReport(projectReport);
View Full Code Here

    ModelRequest request = new ModelRequest(domain, payload.getDate()) //
          .setProperty("ip", ipAddress);

    if (m_service.isEligable(request)) {
      ModelResponse<CrossReport> response = m_service.invoke(request);
      CrossReport report = response.getModel();

      if (payload.getPeriod().isLast()) {
        Set<String> domains = m_reportService.queryAllDomainNames(new Date(payload.getDate()),
              new Date(payload.getDate() + TimeHelper.ONE_HOUR), CrossAnalyzer.ID);
        Set<String> domainNames = report.getDomainNames();

        domainNames.addAll(domains);
      }
      return report;
    } else {
View Full Code Here

TOP

Related Classes of com.dianping.cat.consumer.cross.model.entity.CrossReport

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.