Package com.dianping.cat.consumer.problem

Examples of com.dianping.cat.consumer.problem.ProblemAnalyzer


public class ProblemPerformanceTest extends ComponentTestCase {

  @Test
  public void test() throws Exception {
    ProblemAnalyzer analyzer = (ProblemAnalyzer) lookup(
        MessageAnalyzer.class, ProblemAnalyzer.ID);
    MessageTree tree = buildMessage();

    long current = System.currentTimeMillis();

    long size = 1000000000l;
    for (int i = 0; i < size; i++) {
      analyzer.process(tree);
    }
    System.out.println(analyzer.getReport("cat"));
    System.out.println("Cost " + (System.currentTimeMillis() - current)
        / 1000);
    // cost 64
  }
View Full Code Here


    // cost 64
  }

  @Test
  public void test2() throws Exception {
    ProblemAnalyzer analyzer = (ProblemAnalyzer) lookup(
        MessageAnalyzer.class, ProblemAnalyzer.ID);
    MessageTree tree = buildMessage();

    long current = System.currentTimeMillis();

    long size = 10000000000l;
    for (int i = 0; i < size; i++) {
      Event event = new DefaultEvent("Exception", "name" + i % 100);
      tree.setMessage(event);
      analyzer.process(tree);

      Event event2 = new DefaultEvent("Error", "name" + i % 100);
      tree.setMessage(event2);
      analyzer.process(tree);

      Event event3 = new DefaultEvent("Call", "name" + i % 100);
      tree.setMessage(event3);
      analyzer.process(tree);
    }
    System.out.println(analyzer.getReport("cat"));
    System.out.println("Cost " + (System.currentTimeMillis() - current)
        / 1000);
    // cost 64
  }
View Full Code Here

            "utf-8");
      TransactionReport transactionReport = transactionDelegate.parseXml(xml);
      rebuildTransactionReport(transactionReport);
      transactionManager.setReport(transactionReport);

      ProblemAnalyzer problemAnalyzer = (ProblemAnalyzer) lookup(MessageAnalyzer.class, ProblemAnalyzer.ID);
      ProblemDelegate problemDelegate = (ProblemDelegate) lookup(ReportDelegate.class, "problem");
      MockProblemReportManager problemManager = (MockProblemReportManager) lookup(ReportManager.class, "problem");
      xml = Files.forIO().readFrom(ProblemAnalyzerTest.class.getResourceAsStream("problem-report.xml"), "utf-8");
      ProblemReport problemReport = problemDelegate.parseXml(xml);
      problemManager.setReport(problemReport);
View Full Code Here

TOP

Related Classes of com.dianping.cat.consumer.problem.ProblemAnalyzer

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.