Package com.dianping.cat.message.internal

Examples of com.dianping.cat.message.internal.DefaultTransaction


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

  private Transaction newTransaction(String type, String name, long timestamp, String status, int duration, String data) {
    DefaultTransaction transaction = new DefaultTransaction(type, name, null);

    transaction.setStatus(status);
    transaction.addData(data);
    transaction.complete();
    transaction.setTimestamp(timestamp);
    transaction.setDurationInMillis(duration);
    return transaction;
  }
View Full Code Here


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

  private Transaction newTransaction(String type, String name, long timestamp, String status, int duration, String data) {
    DefaultTransaction transaction = new DefaultTransaction(type, name, null);

    transaction.setStatus(status);
    transaction.addData(data);
    transaction.complete();
    transaction.setTimestamp(timestamp);
    transaction.setDurationInMillis(duration);
    return transaction;
  }
View Full Code Here

    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

    trace.setTimestamp(timestamp);
    return trace;
  }

  private Transaction newTransaction(String type, String name, long timestamp, String status, int duration, String data) {
    DefaultTransaction transaction = new DefaultTransaction(type, name, null);

    transaction.setStatus(status);
    transaction.addData(data);
    transaction.complete();
    transaction.setTimestamp(timestamp);
    transaction.setDurationInMillis(duration);
    return transaction;
  }
View Full Code Here

    String type = helper.read(buf, TAB);
    String name = helper.read(buf, TAB);

    switch (identifier) {
    case 't':
      DefaultTransaction transaction = new DefaultTransaction(type, name, null);

      helper.read(buf, LF); // get rid of line feed
      transaction.setTimestamp(m_dateHelper.parse(timestamp));

      if (parent != null) {
        parent.addChild(transaction);
      }

      stack.push(parent);
      return transaction;
    case 'A':
      DefaultTransaction tran = new DefaultTransaction(type, name, null);
      String status = helper.read(buf, TAB);
      String duration = helper.read(buf, TAB);
      String data = helper.read(buf, TAB);

      helper.read(buf, LF); // get rid of line feed
      tran.setTimestamp(m_dateHelper.parse(timestamp));
      tran.setStatus(status);
      tran.addData(data);

      long d = Long.parseLong(duration.substring(0, duration.length() - 2));
      tran.setDurationInMicros(d);

      if (parent != null) {
        parent.addChild(tran);
        return parent;
      } else {
View Full Code Here

    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

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

            long t1 = toLong(list.get(index++));
            long t2 = toLong(list.get(index++));
            long t3 = toLong(list.get(index++));
            long t4 = toLong(list.get(index++));

            DefaultTransaction t = new DefaultTransaction(name, url, m_messageManager);

            t.addChild(newEvent(name + ".Status", status, null));
            t.addChild(newEvent("RemoteCall", upstreamUrl, childId));

            t.addData("_m", (t1 - t0) + "," + (t2 - t1) + "," + (t3 - t2) + "," + (t4 - t3));
            t.addData("in", requestHeaderLen);
            t.addData("out", responseHeaderLen + "," + responseBodyLen);
            t.addData("blocks", responseBodyBlocks);
            t.addData("url", upstreamUrl);

            if ("200".equals(status)) {
              t.setStatus(Message.SUCCESS);
            } else {
              t.setStatus(status);
            }

            t.setDurationInMillis(t4 - t0);
            t.setCompleted(true);
            tree.setMessage(t);
            step++;
          }

          break;
View Full Code Here

    String type = helper.read(ctx, TAB);
    String name = helper.read(ctx, TAB);

    switch (identifier) {
    case 't':
      DefaultTransaction transaction = new DefaultTransaction(type, name, null);

      helper.read(ctx, LF); // get rid of line feed
      transaction.setTimestamp(m_dateHelper.parse(timestamp));

      if (parent != null) {
        parent.addChild(transaction);
      }

      stack.push(parent);
      return transaction;
    case 'A':
      DefaultTransaction tran = new DefaultTransaction(type, name, null);
      String status = helper.read(ctx, TAB);
      String duration = helper.read(ctx, TAB);
      String data = helper.read(ctx, TAB);

      helper.read(ctx, LF); // get rid of line feed
      tran.setTimestamp(m_dateHelper.parse(timestamp));
      tran.setStatus(status);
      tran.addData(data);

      long d = Long.parseLong(duration.substring(0, duration.length() - 2));
      tran.setDurationInMicros(d);

      if (parent != null) {
        parent.addChild(tran);
        return parent;
      } else {
View Full Code Here

    tree.setDomain("cat");
    tree.setHostName("group001");
    tree.setIpAddress("192.168.1.1");

    DefaultTransaction t = new DefaultTransaction("A", "n" + i % 2, null);
    DefaultTransaction t2 = new DefaultTransaction("A-1", "n" + i % 3, null);

    if (i % 2 == 0) {
      t2.setStatus("ERROR");
    } else {
      t2.setStatus(Message.SUCCESS);
    }

    t2.complete();
    t2.setDurationInMillis(i);

    t.addChild(t2);

    if (i % 2 == 0) {
      t.setStatus("ERROR");
    } else {
      t.setStatus(Message.SUCCESS);
    }

    t.complete();
    t.setDurationInMillis(i * 2);
    long timestamp = 1385467200000L;

    t.setTimestamp(timestamp + 1000);
    t2.setTimestamp(timestamp + 2000);
    tree.setMessage(t);
    tree.setMessageId("Cat-0a010680-384852-" + i);

    return tree;
  }
View Full Code Here

TOP

Related Classes of com.dianping.cat.message.internal.DefaultTransaction

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.