Package com.dianping.cat.message.spi

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


    Thread.sleep(1000);
  }

  @Test
  public void testManyOld() throws InterruptedException {
    MessageTree tree = buildMessages();
    PlainTextMessageCodec1 codec = new PlainTextMessageCodec1();
    ChannelBuffer buf = ChannelBuffers.dynamicBuffer(8192);

    codec.encode(tree, buf);

    buf.readInt();
    buf.markReaderIndex();

    long current = System.currentTimeMillis();
    for (int i = 0; i < count; i++) {
      MessageTree tree2 = new DefaultMessageTree();
      codec.decode(buf, tree2);
      buf.resetReaderIndex();
    }
    System.out.println("Cost:" + (System.currentTimeMillis() - current));
View Full Code Here


    t2.addData(convertException(new NullPointerException()));
    t2.setStatus(convertException(new NullPointerException()));
    t4.complete();
    t3.complete();
    t2.complete();
    MessageTree tree = Cat.getManager().getThreadLocalMessageTree();

    t.setStatus("sfsf\t\n");
    ((DefaultTransaction) t).setDurationInMicros(1000);

    return tree;
View Full Code Here

    }

    // please stop CAT server when you run this test case
    Assert.assertEquals("One message should be in the queue.", 1, m_queue.size());

    MessageTree tree = m_queue.poll();
    Message m = tree.getMessage();

    Assert.assertTrue(Transaction.class.isAssignableFrom(m.getClass()));

    Transaction trans = (Transaction) m;
View Full Code Here

    }

    // please stop CAT server when you run this test case
    Assert.assertEquals("One message should be in the queue.", 1, m_queue.size());

    MessageTree tree = m_queue.poll();

    MessageCodec codec = Cat.lookup(MessageCodec.class, "plain-text");
    ChannelBuffer buf = ChannelBuffers.dynamicBuffer(4 * 1024);

    codec.encode(tree, buf);

    buf.readInt();
    MessageTree tree2 = codec.decode(buf);

    Assert.assertEquals(tree.toString(), tree2.toString());
  }
View Full Code Here

    Assert.assertFalse(id.equals(rootId));

    Cat.setup(null);

    MessageTree tree = Cat.getManager().getThreadLocalMessageTree();

    tree.setMessageId(rootId);

    Transaction t = Cat.newTransaction("Mock", "testMode2");
    Cat.logEvent("RemoteCall", url, Message.SUCCESS, id);
    t.setStatus(Message.SUCCESS);
    t.complete();
View Full Code Here

  public static final String ID = "plain-text";

  @Test
  public void testCodePerformance() throws Exception {
    MessageCodec codec = lookup(MessageCodec.class, ID);
    MessageTree tree = buildMessage();
    ChannelBuffer buf = new DynamicChannelBuffer(10240);
    codec.encode(tree, buf);
    MessageTree result = new DefaultMessageTree();
    codec.decode(buf, result);
    Assert.assertEquals(tree.toString(), result.toString());
  }
View Full Code Here

        Cat.logEvent("RemoteLink", "sina", Event.SUCCESS, "http://sina.com.cn/");
        t.addData("channel=channel" + i % 5);
       
        Cat.logMetricForCount("Receipt Verify Success");

        MessageTree tree = (MessageTree) Cat.getManager().getThreadLocalMessageTree();
        tree.setDomain(TuanGou);
        t.complete();
      }

      for (int i = 0; i < 900; i++) {
        Transaction t = Cat.newTransaction("URL", "/detail");
        MessageTree tree = (MessageTree) Cat.getManager().getThreadLocalMessageTree();

        tree.setDomain(TuanGou);
        t.addData("channel=channel" + i % 5);
        t.complete();
      }

      for (int i = 0; i < 500; i++) {
        Transaction t = Cat.newTransaction("URL", "/order/submitOrder");
        MessageTree tree = (MessageTree) Cat.getManager().getThreadLocalMessageTree();

        tree.setDomain(PayOrder);
        Cat.logMetric("order", "quantity", 1, "channel", "channel" + i % 5);
        Cat.logMetric("payment.pending", "amount", i, "channel", "channel" + i % 5);
        Cat.logMetric("payment.success", "amount", i, "channel", "channel" + i % 5);
        t.addData("channel=channel" + i % 5);
        t.complete();
View Full Code Here

      Transaction t = Cat.newTransaction("test", "test");

      Cat.logMetricForCount("MemberCardSuccess");
      Cat.logMetricForCount("MemberCardFail", 2);

      MessageTree tree = Cat.getManager().getThreadLocalMessageTree();
      ((DefaultMessageTree) tree).setDomain("MobileMembercardMainApiWeb");
      t.complete();
    }
    Thread.sleep(100000);
  }
View Full Code Here

      Cat.logEvent("Exception", message, "ERROR", "sdf");

      String plateform = getPlateform(i);
      String version = getVersion(i);

      MessageTree tree = Cat.getManager().getThreadLocalMessageTree();
      ((DefaultMessageTree) tree).setIpAddress(plateform + ":" + version);
      ((DefaultMessageTree) tree).setDomain("CrashLogWeb");
      t.complete();
    }
    Thread.sleep(10000);
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);
    }

    DependencyReport report = m_analyzer.getReport(m_domain);
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.