Package com.dianping.cat.message.spi.internal

Examples of com.dianping.cat.message.spi.internal.DefaultMessageTree


    uploader.setSleepPeriod(0);
    Thread.sleep(30 * 100 * 1000);
  }

  private MessageTree newMessageTree(int i, long timestamp) {
    MessageTree tree = new DefaultMessageTree();

    tree.setDomain("domain");
    tree.setHostName("hostName" + i);
    tree.setIpAddress("ipAddress" + i);
    tree.setMessageId(String.valueOf(i));
    tree.setParentMessageId("parentMessageId" + i);
    tree.setRootMessageId("rootMessageId" + i);
    tree.setSessionToken("sessionToken");
    tree.setThreadGroupName("threadGroupName");
    tree.setThreadId("threadId" + i);
    tree.setThreadName("threadName");

    tree.setMessage(newTransaction("type", "name" + i, timestamp, "0", 123456 + i, "data" + i));
    return tree;
  }
View Full Code Here


  @Override
  public MessageTree findByIndex(int index) throws IOException {
    try {
      byte[] data = m_reader.readMessage(index);
      ChannelBuffer buf = ChannelBuffers.dynamicBuffer(data.length);
      MessageTree tree = new DefaultMessageTree();

      buf.writeBytes(data);
      m_codec.decode(buf, tree);
      m_lastAccessTime = System.currentTimeMillis();
      return tree;
View Full Code Here

import com.dianping.cat.storage.dump.MessageBucketManager;

@RunWith(JUnit4.class)
public class HdfsMessageBucketManagerTest extends ComponentTestCase {
  private MessageTree newMessageTree(String id, int i, long timestamp) {
    MessageTree tree = new DefaultMessageTree();

    tree.setDomain("target");
    tree.setHostName("localhost");
    tree.setIpAddress("127.0.0.1");
    tree.setMessageId(id);
    tree.setParentMessageId("parentMessageId" + i);
    tree.setRootMessageId("rootMessageId" + i);
    tree.setSessionToken("sessionToken");
    tree.setThreadGroupName("threadGroupName");
    tree.setThreadId("threadId" + i);
    tree.setThreadName("threadName");

    tree.setMessage(newTransaction("type", "name" + i, timestamp, "0", 123456 + i, "data" + i));
    return tree;
  }
View Full Code Here

    for (int i = 0; i < count; i++) {

      buf.markReaderIndex();
      // read the size of the message
      buf.readInt();
      DefaultMessageTree result = (DefaultMessageTree) codec.decode(buf);
      buf.resetReaderIndex();
      result.setBuffer(buf);
    }
  }
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

    ChannelBuffer buf = ChannelBuffers.dynamicBuffer(8192);

    codec.encode(tree, buf);

    buf.readInt();
    MessageTree tree2 = new DefaultMessageTree();
    codec.decode(buf, tree2);

    Thread.sleep(1000);
  }
View Full Code Here

    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

    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

    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

        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

TOP

Related Classes of com.dianping.cat.message.spi.internal.DefaultMessageTree

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.