Package com.dianping.cat.message.spi

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


    String expected = Files.forIO().readFrom(getClass().getResourceAsStream("dependency_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;
    DefaultEvent event;

    if (i % 3 == 0) {
      t = new DefaultTransaction("Call", "Cat-Test-Call", null);
      event = new DefaultEvent("Exception", "192.168.1.0:3000:class:method1", null);
    } else if (i % 3 == 1) {
      t = new DefaultTransaction("PigeonCall", "Cat-Test-Call", null);
      event = new DefaultEvent("PigeonCall.server", "192.168.1.2:3000:class:method2", null);
    } else {
      t = new DefaultTransaction("SQL", "Cat-Test-SQL", null);
      event = new DefaultEvent("SQL.Database", "jdbc:mysql://127.0.0.1:3306?cat", null);
    }

    event.setTimestamp(m_timestamp + 5 * 60 * 1000);
    event.setStatus(Message.SUCCESS);
    t.setDurationInMillis(i);
    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("test");
    tree.setThreadGroupName("test");
    tree.setThreadId("test");
    tree.setThreadName("test");
    tree.setMessage(message);
    return tree;
  }
View Full Code Here

public class DependencyPerformanceTest extends ComponentTestCase {

  @Test
  public void test() throws Exception {
    DependencyAnalyzer analyzer = (DependencyAnalyzer)lookup(MessageAnalyzer.class,DependencyAnalyzer.ID);
    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("test");
    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 test() throws Exception {
    EventAnalyzer analyzer = (EventAnalyzer)lookup(MessageAnalyzer.class,EventAnalyzer.ID);

    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("test");
    tree.setThreadGroupName("test");
    tree.setThreadId("test");
    tree.setThreadName("test");
    tree.setMessage(message);
    return tree;
  }
View Full Code Here

      }
      Cat.logEvent("Error", parseUrl(url), "Error", error);
      Cat.logEvent("Agent", parseValue("Agent", m_data), Message.SUCCESS,
            new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date(timestamp)));

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

      tree.setDomain(Constants.FRONT_END);
      tree.setHostName(host);
      tree.setIpAddress(host);
    }
    response.getWriter().write("OK");
  }
View Full Code Here

    }
    response.getWriter().write("OK");
  }

  private String parseHost() {
    MessageTree tree = (MessageTree) Cat.getManager().getThreadLocalMessageTree();
    Message message = tree.getMessage();

    if (message.getType().equals("URL") && message instanceof Transaction) {
      Transaction t = (Transaction) message;
      List<Message> messages = t.getChildren();
View Full Code Here

    String actual = buf.toString(Charset.forName("utf-8"));

    Assert.assertEquals(expected, actual);

    MessageTree tree = new DefaultMessageTree();

    codec.decodeMessage(ctx, tree);
    Assert.assertEquals(expected, tree.getMessage().toString());
  }
View Full Code Here

    String actual = buf.toString(Charset.forName("utf-8"));

    Assert.assertEquals(expected, actual);

    MessageTree t = codec.decode(buf);

    Assert.assertEquals(expected, t.toString());
  }
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.