Package com.dianping.cat.message.spi

Examples of com.dianping.cat.message.spi.MessageTree


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


        return t;
      }
    }.build();

    MessageTree tree = new DefaultMessageTree();
    tree.setDomain("cat");
    tree.setHostName("test");
    tree.setIpAddress("test");
    tree.setThreadGroupName("test");
    tree.setThreadId("test");
    tree.setThreadName("test");
    tree.setMessage(message);
    return tree;
  }
View Full Code Here

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

    long current = System.currentTimeMillis();

    long size = 10000000000l;
    for (int i = 0; i < size; i++) {
View Full Code Here

        return t;
      }
    }.build();

    MessageTree tree = new DefaultMessageTree();
    tree.setDomain("cat");
    tree.setHostName("test");
    tree.setIpAddress("test");
    tree.setThreadGroupName("test");
    tree.setThreadId("test");
    tree.setThreadName("test");
    tree.setMessage(message);
    return tree;
  }
View Full Code Here

  }

  @Test
  public void testProcess() throws Exception {
    for (int i = 1; i <= 60; i++) {
      MessageTree tree = generateMessageTree(i);

      m_analyzer.process(tree);
    }

    MetricReport report = m_analyzer.getReport(m_domain);
View Full Code Here

    Assert.assertEquals(2, m_businessReportDao.m_count);
    Assert.assertEquals(2, m_bucketCount);
  }

  protected MessageTree generateMessageTree(int i) {
    MessageTree tree = new DefaultMessageTree();

    tree.setMessageId("" + i);
    tree.setDomain(m_domain);
    tree.setHostName("group001");
    tree.setIpAddress("192.168.1.1");

    DefaultTransaction t;

    if (i % 3 == 0) {
      t = new DefaultTransaction("URL", "TuanGouWeb", null);
      t.setTimestamp(m_timestamp + i * MINITE);
      DefaultEvent event = new DefaultEvent("URL", "ABTest");

      DefaultMetric metric = new DefaultMetric("City", "/beijing");

      metric.setTimestamp(m_timestamp + i * MINITE);
      metric.setStatus("S");
      metric.addData("10");

      t.addChild(metric);
      t.addChild(event);
    } else if (i % 3 == 1) {
      t = new DefaultTransaction("Service", "TuanGouWeb", null);
      t.setTimestamp(m_timestamp + i * MINITE);
      DefaultEvent event = new DefaultEvent("URL", "ABTest");

      DefaultMetric metric = new DefaultMetric("", "/nanjing");

      metric.setTimestamp(m_timestamp + i * MINITE);
      metric.setStatus("S,C");
      metric.addData("10,10");

      t.addChild(metric);
      t.addChild(event);
    } else {
      t = new DefaultTransaction("Metric", "TuanGouWeb", null);
      t.setTimestamp(m_timestamp + 1000);
      DefaultMetric metric = new DefaultMetric("", "/shanghai");

      metric.setTimestamp(m_timestamp + i * MINITE);
      metric.setStatus("C");
      metric.addData("10");

      t.addChild(metric);

      DefaultMetric durationMetric = new DefaultMetric("", "/shenzhen");

      durationMetric.setTimestamp(m_timestamp + i * MINITE);
      durationMetric.setStatus("T");
      durationMetric.addData("10");

      t.addChild(durationMetric);
    }

    t.complete();
    t.setDurationInMillis(i * 2);
    tree.setMessage(t);

    return tree;
  }
View Full Code Here

    analyzer.setIpConvertManager(new IpConvertManager());
    analyzer.setServerConfigManager(new ServerConfigManager());
    analyzer.setReportManager(new MockCrossReportManager());

    MessageTree tree = buildMessage();

    long current = System.currentTimeMillis();

    int size = 10000000;
    for (int i = 0; i < size; i++) {
View Full Code Here

        return t;
      }
    }.build();

    MessageTree tree = new DefaultMessageTree();
    tree.setDomain("cat");
    tree.setHostName("test");
    tree.setIpAddress("10.10.10.1");
    tree.setThreadGroupName("test");
    tree.setThreadId("test");
    tree.setThreadName("test");
    tree.setMessage(message);
    tree.setMessageId("MobileApi-0a01077f-379304-1362256");
    return tree;
  }
View Full Code Here

  }

  @Test
  public void testProcess() throws Exception {
    for (int i = 1; i <= 100; i++) {
      MessageTree tree = generateMessageTree(i);

      m_analyzer.process(tree);
    }

    MatrixReport report = m_analyzer.getReport(m_domain);
View Full Code Here

    String expected = Files.forIO().readFrom(getClass().getResourceAsStream("matrix_analyzer.xml"), "utf-8");
    Assert.assertEquals(expected.replaceAll("\r", ""), report.toString().replaceAll("\r", ""));
  }

  protected MessageTree generateMessageTree(int i) {
    MessageTree tree = new DefaultMessageTree();

    tree.setMessageId("" + i);
    tree.setDomain(m_domain);
    tree.setHostName("group001");
    tree.setIpAddress("192.168.1.1");

    DefaultTransaction t;
    DefaultTransaction event;

    if (i % 3 == 0) {
      t = new DefaultTransaction("URL", "Cat-Test-Call", null);
      event = new DefaultTransaction("Call", "192.168.1.0:3000:class:method1", null);
    } else if (i % 3 == 1) {
      t = new DefaultTransaction("PigeonService", "Cat-Test-Service", null);
      event = new DefaultTransaction("SQL", "192.168.1.2:3000:class:method2", null);
    } else {
      t = new DefaultTransaction("Service", "Cat-Test-Service", null);
      event = new DefaultTransaction("Cache.CatTest", "192.168.1.2:3000:class:method2", null);
    }

    event.setTimestamp(m_timestamp + 5 * 60 * 1000);
    event.setDurationInMillis(i);
    event.setStatus(Message.SUCCESS);
    t.addChild(event);

    t.complete();
    t.setDurationInMillis(i * 2);
    t.setTimestamp(m_timestamp + 1000);
    tree.setMessage(t);

    return tree;
  }
View Full Code Here

TOP

Related Classes of com.dianping.cat.message.spi.MessageTree

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.