Package com.dianping.cat.message

Examples of com.dianping.cat.message.Message


    System.out.println("Cost " + (System.currentTimeMillis() - current) / 1000);
    //cost 28
  }

  public MessageTree buildMessage() {
    Message message = new MockMessageBuilder() {
      @Override
      public MessageHolder define() {
        TransactionHolder t = t("WEB CLUSTER", "GET", 112819)
              //
              .at(1348374838231L)
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();

      for (Message temp : messages) {
        String name = temp.getName();
View Full Code Here

    System.out.println("Cost " + (System.currentTimeMillis() - current) / 1000);
    //21
  }

  public MessageTree buildMessage() {
    Message message = new MockMessageBuilder() {
      @Override
      public MessageHolder define() {
        TransactionHolder t = t("URL", "GET", 112819)
              //
              .at(1348374838231L)
View Full Code Here

    System.out.println("Cost " + (System.currentTimeMillis() - current) / 1000);
    // 21
  }

  public MessageTree buildMessage() {
    Message message = new MockMessageBuilder() {

      @Override
      public MessageHolder define() {
        TransactionHolder t = t("URL", "/index", 112819)
              .child(m("order", "order", "quantity=1"))
View Full Code Here

import com.dianping.cat.message.Message;

public class MockMessageBuilderTest {
  @Test
  public void test() {
    Message message = new MockMessageBuilder() {
      @Override
      public MessageHolder define() {
        TransactionHolder t = t("WEB CLUSTER", "GET", 112819) //
              .at(1348374838231L) //
              .after(1300).child(t("QUICKIE SERVICE", "gimme_stuff", 1571)) //
              .after(100).child(e("SERVICE", "event1")) //
              .after(100).child(h("SERVICE", "heartbeat1")) //
              .after(100).child(t("WEB SERVER", "GET", 109358) //
                    .after(1000).child(t("SOME SERVICE", "get", 4345) //
                          .after(4000).child(t("MEMCACHED", "Get", 279))) //
                    .mark().after(200).child(t("MEMCACHED", "Inc", 319)) //
                    .reset().after(500).child(t("BIG ASS SERVICE", "getThemDatar", 97155) //
                          .after(1000).mark().child(t("SERVICE", "getStuff", 3760)) //
                          .reset().child(t("DATAR", "findThings", 94537)) //
                          .after(200).child(t("THINGIE", "getMoar", 1435)) //
                    ) //
                    .after(100).mark().child(t("OTHER DATA SERVICE", "get", 4394) //
                          .after(1000).mark().child(t("MEMCACHED", "Get", 378)) //
                          .reset().child(t("MEMCACHED", "Get", 3496)) //
                    ) //
                    .reset().child(t("FINAL DATA SERVICE", "get", 4394) //
                          .after(1000).mark().child(t("MEMCACHED", "Get", 386)) //
                          .reset().child(t("MEMCACHED", "Get", 322)) //
                          .reset().child(t("MEMCACHED", "Get", 322)) //
                    ) //
              ) //
        ;

        return t;
      }
    }.build();

    Assert.assertEquals("t2012-09-23 12:33:58.231  WEB CLUSTER  GET  \n" + //
          "A2012-09-23 12:33:58.232  QUICKIE SERVICE  gimme_stuff  0  1571us    \n" + //
          "E2012-09-23 12:33:58.233  SERVICE  event1  0    \n" + //
          "H2012-09-23 12:33:58.234  SERVICE  heartbeat1  0    \n" + //
          "t2012-09-23 12:33:58.234  WEB SERVER  GET  \n" + //
          "t2012-09-23 12:33:58.235  SOME SERVICE  get  \n" + //
          "A2012-09-23 12:33:58.239  MEMCACHED  Get  0  279us    \n" + //
          "T2012-09-23 12:33:58.239  SOME SERVICE  get  0  4345us    \n" + //
          "A2012-09-23 12:33:58.239  MEMCACHED  Inc  0  319us    \n" + //
          "t2012-09-23 12:33:58.240  BIG ASS SERVICE  getThemDatar  \n" + //
          "A2012-09-23 12:33:58.241  SERVICE  getStuff  0  3760us    \n" + //
          "A2012-09-23 12:33:58.241  DATAR  findThings  0  94537us    \n" + //
          "A2012-09-23 12:33:58.335  THINGIE  getMoar  0  1435us    \n" + //
          "T2012-09-23 12:33:58.337  BIG ASS SERVICE  getThemDatar  0  97155us    \n" + //
          "t2012-09-23 12:33:58.337  OTHER DATA SERVICE  get  \n" + //
          "A2012-09-23 12:33:58.338  MEMCACHED  Get  0  378us    \n" + //
          "A2012-09-23 12:33:58.338  MEMCACHED  Get  0  3496us    \n" + //
          "T2012-09-23 12:33:58.341  OTHER DATA SERVICE  get  0  4394us    \n" + //
          "t2012-09-23 12:33:58.337  FINAL DATA SERVICE  get  \n" + //
          "A2012-09-23 12:33:58.338  MEMCACHED  Get  0  386us    \n" + //
          "A2012-09-23 12:33:58.338  MEMCACHED  Get  0  322us    \n" + //
          "A2012-09-23 12:33:58.338  MEMCACHED  Get  0  322us    \n" + //
          "T2012-09-23 12:33:58.341  FINAL DATA SERVICE  get  0  4394us    \n" + //
          "T2012-09-23 12:33:58.343  WEB SERVER  GET  0  109358us    \n" + //
          "T2012-09-23 12:33:58.343  WEB CLUSTER  GET  0  112819us    \n" + //
          "", message.toString().replace("\r", ""));
  }
View Full Code Here

    } else {
      throw new RuntimeException("Error type in metric api, type: " + type);
    }

    MessageTree tree = Cat.getManager().getThreadLocalMessageTree();
    Message message = tree.getMessage();

    if (message instanceof Transaction) {
      ((DefaultTransaction) message).setTimestamp(time);
    }
    if (!isNetwork(group) && !isSystem(group)) {
View Full Code Here

    // don't process frontEnd domain
    if (Constants.FRONT_END.equals(domain)) {
      return;
    }
    EventReport report = m_reportManager.getHourlyReport(getStartTime(), domain, true);
    Message message = tree.getMessage();

    if (message instanceof Transaction) {
      processTransaction(report, tree, (Transaction) message);
    } else if (message instanceof Event) {
      processEvent(report, tree, (Event) message);
View Full Code Here

    }
  }

  @Override
  public void handle(Machine machine, MessageTree tree) {
    Message message = tree.getMessage();

     processLongUrl(machine, tree);
     processLongService(machine, tree);

    if (message instanceof Transaction) {
View Full Code Here

      updateEntry(tree, entry, (int) nomarizeDuration);
    }
  }

  private void processLongService(Machine machine, MessageTree tree) {
    Message message = tree.getMessage();

    if (message instanceof Transaction) {
      String messageType = message.getType();

      if ("Service".equals(messageType) || "PigeonService".equals(messageType)) {
        long duration = ((Transaction) message).getDurationInMillis();
        String domain = tree.getDomain();
        long nomarizeDuration = computeLongDuration(duration, domain, m_defaultLongServiceDuration,
              m_longServiceThresholds);

        if (nomarizeDuration > 0) {
          String type = ProblemType.LONG_SERVICE.getName();
          String status = message.getName();

          Entry entry = findOrCreateEntry(machine, type, status);
          updateEntry(tree, entry, (int) nomarizeDuration);
        }
      }
View Full Code Here

      updateEntry(tree, entry, (int) nomarizeDuration);
    }
  }

  private void processLongUrl(Machine machine, MessageTree tree) {
    Message message = tree.getMessage();

    if (message instanceof Transaction && "URL".equals(message.getType())) {

      long duration = ((Transaction) message).getDurationInMillis();
      String domain = tree.getDomain();

      long nomarizeDuration = computeLongDuration(duration, domain, m_defaultLongUrlDuration, m_longUrlThresholds);
      if (nomarizeDuration > 0) {
        String type = ProblemType.LONG_URL.getName();
        String status = message.getName();

        Entry entry = findOrCreateEntry(machine, type, status);
        updateEntry(tree, entry, (int) nomarizeDuration);
      }
    }
View Full Code Here

TOP

Related Classes of com.dianping.cat.message.Message

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.