Package com.dianping.cat.message

Examples of com.dianping.cat.message.Event


  }

  @Test
  public void sendEvent() throws Exception {
    for (int i = 0; i < 100; i++) {
      Event t = Cat.getProducer().newEvent("Test", "Test");

      t.addData("key and value");
      t.complete();
    }
    Thread.sleep(1000);
  }
View Full Code Here


  }

  @Test
  public void testEvent() {
    long timestamp = 1325489621987L;
    Event event = newEvent("type", "name", timestamp, "0", "here is the data.");

    check(event, "E2012-01-02 15:33:41.987\ttype\tname\t0\there is the data.\t\n");
  }
View Full Code Here

  @Test
  public void testEventForRawData() {
    long timestamp = 1325489621987L;
    String trace = "java.lang.Exception\n\tat com.dianping.cat.message.spi.codec.PlainTextMessageCodecTest.testEventForException(PlainTextMessageCodecTest.java:112)\n";
    Event event = newEvent("Exception", Exception.class.getName(), timestamp, "ERROR", trace);

    check(event,
          "E2012-01-02 15:33:41.987\tException\tjava.lang.Exception\tERROR\t" + //
                "java.lang.Exception\\n\\tat com.dianping.cat.message.spi.codec.PlainTextMessageCodecTest.testEventForException(PlainTextMessageCodecTest.java:112)\\n\t\n");
  }
View Full Code Here

    long current = System.currentTimeMillis();

    long size = 10000000000l;
    for (int i = 0; i < size; i++) {
      Event event = new DefaultEvent("Exception", "name" + i % 100);
      tree.setMessage(event);
      analyzer.process(tree);

      Event event2 = new DefaultEvent("Error", "name" + i % 100);
      tree.setMessage(event2);
      analyzer.process(tree);

      Event event3 = new DefaultEvent("Call", "name" + i % 100);
      tree.setMessage(event3);
      analyzer.process(tree);
    }
    System.out.println(analyzer.getReport("cat"));
    System.out.println("Cost " + (System.currentTimeMillis() - current)
View Full Code Here

    logEvent(type, name, Message.SUCCESS, null);
  }

  @Override
  public void logEvent(String type, String name, String status, String nameValuePairs) {
    Event event = newEvent(type, name);

    if (nameValuePairs != null && nameValuePairs.length() > 0) {
      event.addData(nameValuePairs);
    }

    event.setStatus(status);
    event.complete();
  }
View Full Code Here

    public boolean getSecure() {
      return m_cookie.getSecure();
    }

    public String getValue() {
      Event event = Cat.newEvent(Cat.getManager().getDomain() + ":ReadCookie", m_cookie.getName());

      event.setStatus(Event.SUCCESS);
      event.complete();
      return m_cookie.getValue();
    }
View Full Code Here

      super(response);
    }

    @Override
    public void addCookie(Cookie cookie) {
      Event event = Cat.newEvent(Cat.getManager().getDomain() + ":SetCookie", cookie.getName());

      event.setStatus(Event.SUCCESS);
      event.addData("domain", cookie.getDomain());
      event.addData("path", cookie.getPath());
      event.addData("maxAge", cookie.getMaxAge());
      event.complete();
      super.addCookie(cookie);
    }
View Full Code Here

      super.addCookie(cookie);
    }

    @Override
    public void addHeader(String name, String value) {
      Event event = Cat.newEvent(Cat.getManager().getDomain() + ":SetHead", name);

      event.setStatus(Event.SUCCESS);
      event.addData("value", value);
      event.complete();
      super.addHeader(name, value);
    }
View Full Code Here

  }

  @Test
  public void testEvent() throws Exception {
    long timestamp = 1325489621987L;
    Event event = newEvent("type", "name", timestamp, "0", "here is the data.");

    MessageTree tree = new DefaultMessageTree();
    tree.setMessage(event);
    check(tree, event,
          "<tr><td>E15:33:41.987</td><td>type</td><td>name</td><td>&nbsp;</td><td>here is the data.</td></tr>\r\n");
View Full Code Here

  public void testEventForRawData() throws Exception {
    long timestamp = 1325489621987L;
    String trace = "java.lang.Exception\n"
          + "\tat com.dianping.cat.message.spi.codec.PlainTextMessageCodecTest.testEventForException(PlainTextMessageCodecTest.java:112)\n"
          + "\tat com.dianping.cat.message.spi.codec.PlainTextMessageCodecTest.testEventForException(PlainTextMessageCodecTest.java:108)\n";
    Event event = newEvent("Exception", Exception.class.getName(), timestamp, "ERROR", trace);

    MessageTree tree = new DefaultMessageTree();
    tree.setMessage(event);
    check(tree,
          event,
View Full Code Here

TOP

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

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.