(20);
public String format(long timestamp) {
SimpleDateFormat format = m_queue.poll();
if (format == null) {
- format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+ format = new SimpleDateFormat(DATE_PATTERN);
}
try {
@@ -342,7 +345,7 @@ public class HtmlMessageCodec implements MessageCodec {
SimpleDateFormat format = m_queue.poll();
if (format == null) {
- format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.sss");
+ format = new SimpleDateFormat(DATE_PATTERN);
}
try {
diff --git a/cat-core/src/main/java/com/dianping/cat/message/spi/codec/PlainTextMessageCodec.java b/cat-core/src/main/java/com/dianping/cat/message/spi/codec/PlainTextMessageCodec.java
index aeade0972a9807a6de95d45fcc84a35160770e5f..0017604b0f102e16145d4668d2ae268e8c66a98d 100644
--- a/cat-core/src/main/java/com/dianping/cat/message/spi/codec/PlainTextMessageCodec.java
+++ b/cat-core/src/main/java/com/dianping/cat/message/spi/codec/PlainTextMessageCodec.java
@@ -53,6 +53,7 @@ public class PlainTextMessageCodec implements MessageCodec {
String hostName = helper.read(buf, TAB);
String ipAddress = helper.read(buf, TAB);
String threadId = helper.read(buf, TAB);
+ String threadName = helper.read(buf, TAB);
String messageId = helper.read(buf, TAB);
String requestToken = helper.read(buf, TAB);
String sessionToken = helper.read(buf, LF);
@@ -62,6 +63,7 @@ public class PlainTextMessageCodec implements MessageCodec {
tree.setHostName(hostName);
tree.setIpAddress(ipAddress);
tree.setThreadId(threadId);
+ tree.setThreadName(threadName);
tree.setMessageId(messageId);
tree.setRequestToken(requestToken);
tree.setSessionToken(sessionToken);
@@ -208,6 +210,8 @@ public class PlainTextMessageCodec implements MessageCodec {
count += helper.write(buf, TAB);
count += helper.write(buf, tree.getThreadId());
count += helper.write(buf, TAB);
+ count += helper.write(buf, tree.getThreadName());
+ count += helper.write(buf, TAB);
count += helper.write(buf, tree.getMessageId());
count += helper.write(buf, TAB);
count += helper.write(buf, tree.getRequestToken());
diff --git a/cat-core/src/main/java/com/dianping/cat/message/spi/internal/DefaultMessageTree.java b/cat-core/src/main/java/com/dianping/cat/message/spi/internal/DefaultMessageTree.java
index 8e112119855f74acf0528a3266818bdea53c9c8d..808425b6912042602104dceaeb7ff2f090c4007a 100644
--- a/cat-core/src/main/java/com/dianping/cat/message/spi/internal/DefaultMessageTree.java
+++ b/cat-core/src/main/java/com/dianping/cat/message/spi/internal/DefaultMessageTree.java
@@ -24,6 +24,8 @@ public class DefaultMessageTree implements MessageTree {
private String m_threadId;
+ private String m_threadName;
+
private Message m_message;
@Override
@@ -66,6 +68,10 @@ public class DefaultMessageTree implements MessageTree {
return m_threadId;
}
+ public String getThreadName() {
+ return m_threadName;
+ }
+
@Override
public void setDomain(String domain) {
m_domain = domain;
@@ -106,6 +112,10 @@ public class DefaultMessageTree implements MessageTree {
m_threadId = threadId;
}
+ public void setThreadName(String threadName) {
+ m_threadName = threadName;
+ }
+
@Override
public String toString() {
PlainTextMessageCodec codec = new PlainTextMessageCodec();
diff --git a/cat-core/src/test/java/com/dianping/cat/message/spi/codec/HtmlMessageCodecTest.java b/cat-core/src/test/java/com/dianping/cat/message/spi/codec/HtmlMessageCodecTest.java
index bc0c34d398b5b0ee150ff28bb2a295c6fa94867b..f3bb8e1e02b2e40432604181a837877ac0a42d44 100644
--- a/cat-core/src/test/java/com/dianping/cat/message/spi/codec/HtmlMessageCodecTest.java
+++ b/cat-core/src/test/java/com/dianping/cat/message/spi/codec/HtmlMessageCodecTest.java
@@ -69,6 +69,7 @@ public class HtmlMessageCodecTest {
tree.setRequestToken("requestToken");
tree.setSessionToken("sessionToken");
tree.setThreadId("threadId");
+ tree.setThreadName("threadName");
return tree;
}
@@ -90,7 +91,7 @@ public class HtmlMessageCodecTest {
Event event = newEvent("type", "name", timestamp, "0", "here is the data.");
check(event,
- "E2012-01-02 15:33:41.987 | type | name | 0 | here is the data. |
\r\n");
+ "E15:33:41.987 | type | name | 0 | here is the data. |
\r\n");
}
@Test
@@ -102,7 +103,7 @@ public class HtmlMessageCodecTest {
Event event = newEvent("Exception", Exception.class.getName(), timestamp, "ERROR", trace);
check(event,
- "E2012-01-02 15:33:41.987 | Exception | java.lang.Exception | ERROR | java.lang.Exception\n "
+ " |
E15:33:41.987 | Exception | java.lang.Exception | ERROR | 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 "
+ " |
\r\n");
@@ -114,7 +115,7 @@ public class HtmlMessageCodecTest {
Heartbeat heartbeat = newHeartbeat("type", "name", timestamp, "0", "here is the data.");
check(heartbeat,
- "H2012-01-02 15:33:41.987 | type | name | 0 | here is the data. |
\r\n");
+ "H15:33:41.987 | type | name | 0 | here is the data. |
\r\n");
}
@Test
@@ -123,14 +124,14 @@ public class HtmlMessageCodecTest {
DefaultMessageTree tree = newMessageTree();
long timestamp = 1325489621987L;
String expected1 = "\r\n"
- + "HT1 | domain | hostName | ipAddress | threadId | messageId | requestToken | sessionToken |
\r\n"
+ + "HT1 | domain | hostName | ipAddress | threadId | threadName | messageId | requestToken | sessionToken |
\r\n"
+ "
";
checkTree(tree, expected1);
String expected2 = "\r\n"
+ "HT1 | domain | hostName | ipAddress | threadId | messageId | requestToken | sessionToken |
\r\n"
- + "E2012-01-02 15:33:41.987 | type | name | 0 | here is the data. |
\r\n"
+ + "E15:33:41.987 | type | name | 0 | here is the data. |
\r\n"
+ "
";
tree.setMessage(newEvent("type", "name", timestamp, "0", "here is the data."));
@@ -151,15 +152,15 @@ public class HtmlMessageCodecTest {
root.addChild(newEvent("URL", "View", timestamp + 40, "0", "view=HTML"));
check(root,
- "t2012-01-02 15:33:41.987 | URL | Review | | |
\r\n"
- + " E2012-01-02 15:33:41.987 | URL | Payload | 0 | ip=127.0.0.1&ua=Mozilla 5.0...&refer=...&... |
\r\n"
- + " A2012-01-02 15:33:41.987 | Service | Auth | 0 | 20ms userId=1357&token=... |
\r\n"
- + " t2012-01-02 15:33:42.009 | Cache | findReviewByPK | | |
\r\n"
- + " E2012-01-02 15:33:42.009 | CacheHost | host-1 | 0 | ip=192.168.8.123 |
\r\n"
- + " T2012-01-02 15:33:42.010 | Cache | findReviewByPK | Missing | 1ms 2468 |
\r\n"
- + " A2012-01-02 15:33:42.012 | DAL | findReviewByPK | 0 | 5ms select title,content from Review where id = ? |
\r\n"
- + " E2012-01-02 15:33:42.027 | URL | View | 0 | view=HTML |
\r\n"
- + "T2012-01-02 15:33:42.087 | URL | Review | 0 | 100ms /review/2468 |
\r\n");
+ "t15:33:41.987 | URL | Review | | |
\r\n"
+ + " E15:33:41.987 | URL | Payload | 0 | ip=127.0.0.1&ua=Mozilla 5.0...&refer=...&... |
\r\n"
+ + " A15:33:41.987 | Service | Auth | 0 | 20ms userId=1357&token=... |
\r\n"
+ + " t15:33:42.009 | Cache | findReviewByPK | | |
\r\n"
+ + " E15:33:42.009 | CacheHost | host-1 | 0 | ip=192.168.8.123 |
\r\n"
+ + " T15:33:42.010 | Cache | findReviewByPK | Missing | 1ms 2468 |
\r\n"
+ + " A15:33:42.012 | DAL | findReviewByPK | 0 | 5ms select title,content from Review where id = ? |
\r\n"
+ + " E15:33:42.027 | URL | View | 0 | view=HTML |
\r\n"
+ + "T15:33:42.087 | URL | Review | 0 | 100ms /review/2468 |
\r\n");
}
@Test
@@ -168,6 +169,6 @@ public class HtmlMessageCodecTest {
Transaction transaction = newTransaction("type", "name", timestamp, "0", 10, "here is the data.");
check(transaction,
- "A2012-01-02 15:33:41.987 | type | name | 0 | 10ms here is the data. |
\r\n");
+ "A15:33:41.987 | type | name | 0 | 10ms here is the data. |
\r\n");
}
}
diff --git a/cat-core/src/test/java/com/dianping/cat/message/spi/codec/PlainTextMessageCodecTest.java b/cat-core/src/test/java/com/dianping/cat/message/spi/codec/PlainTextMessageCodecTest.java
index 2e8972ac5bd4a7fda47f10d23df0227fb10f9182..e283c7fdf0a5b8ba769148b85d5f8ded4db7214e 100644
--- a/cat-core/src/test/java/com/dianping/cat/message/spi/codec/PlainTextMessageCodecTest.java
+++ b/cat-core/src/test/java/com/dianping/cat/message/spi/codec/PlainTextMessageCodecTest.java
@@ -81,6 +81,7 @@ public class PlainTextMessageCodecTest {
tree.setRequestToken("requestToken");
tree.setSessionToken("sessionToken");
tree.setThreadId("threadId");
+ tree.setThreadName("threadName");
return tree;
}
@@ -127,7 +128,7 @@ public class PlainTextMessageCodecTest {
public void testMessageTree() {
DefaultMessageTree tree = newMessageTree();
long timestamp = 1325489621987L;
- String expected = "PT1\tdomain\thostName\tipAddress\tthreadId\tmessageId\trequestToken\tsessionToken\n";
+ String expected = "PT1\tdomain\thostName\tipAddress\tthreadId\tthreadName\tmessageId\trequestToken\tsessionToken\n";
checkTree(tree, expected);
diff --git a/cat-home/src/main/java/com/dianping/cat/report/page/transaction/Handler.java b/cat-home/src/main/java/com/dianping/cat/report/page/transaction/Handler.java
index b857f5ebc6c492e27641f838c003c670ac97117b..fd9b10834fe0f37d1d20564546002e00226b68ce 100644
--- a/cat-home/src/main/java/com/dianping/cat/report/page/transaction/Handler.java
+++ b/cat-home/src/main/java/com/dianping/cat/report/page/transaction/Handler.java
@@ -41,7 +41,7 @@ public class Handler implements PageHandler {
.getCurrentAnalyzer("transaction");
if (analyzer != null) {
- model.setReport(analyzer.generate());
+ model.setReport(analyzer.generate(ctx.getRequestContext().getParameterProvider().getParameter("domain")));
} else {
model.setReport(new TransactionReport("none"));
}
diff --git a/cat-home/src/main/webapp/WEB-INF/webres.tld b/cat-home/src/main/webapp/WEB-INF/webres.tld
index b5dec5423a5d57da77cda5c465fd7ecad91cf6d4..5c241b7116e428a2f6917b4f61d445e442d3cc19 100644
--- a/cat-home/src/main/webapp/WEB-INF/webres.tld
+++ b/cat-home/src/main/webapp/WEB-INF/webres.tld
@@ -51,6 +51,13 @@
com.ebay.webres.taglib.basic.UseCssTagHandler
JSP
+
+value
+false
+true
+java.lang.Object
+
+
secure
false
@@ -72,13 +79,6 @@
java.lang.String
-
-value
-false
-true
-java.lang.Object
-
-
target
false
@@ -114,18 +114,18 @@
com.ebay.webres.taglib.basic.SetTagHandler
JSP
-
-id
+
+value
true
true
-java.lang.String
+java.lang.Object
-
-value
+
+id
true
true
-java.lang.Object
+java.lang.String
false
@@ -135,6 +135,13 @@
com.ebay.webres.taglib.basic.UseJsTagHandler
JSP
+
+value
+false
+true
+java.lang.Object
+
+
secure
false
@@ -156,13 +163,6 @@
java.lang.String
-
-value
-false
-true
-java.lang.Object
-
-
target
false
@@ -177,6 +177,13 @@
com.ebay.webres.taglib.basic.LinkTagHandler
JSP
+
+value
+true
+true
+java.lang.Object
+
+
secure
false
@@ -190,13 +197,6 @@
true
java.lang.String
-
-
-value
-true
-true
-java.lang.Object
-
true
@@ -205,6 +205,13 @@
com.ebay.webres.taglib.basic.ImageTagHandler
JSP
+
+value
+true
+true
+java.lang.Object
+
+
secure
false
@@ -225,13 +232,6 @@
true
java.lang.String
-
-
-value
-true
-true
-java.lang.Object
-
true
diff --git a/cat-home/src/main/webapp/js/transaction.js b/cat-home/src/main/webapp/js/transaction.js
index 35e748c98d9fb74912d847f3a379db07bb4144d1..730c8e156dfe1e5ff904cb931da481c782bb6832 100644
--- a/cat-home/src/main/webapp/js/transaction.js
+++ b/cat-home/src/main/webapp/js/transaction.js
@@ -11,7 +11,10 @@ $(function(){
);
$(function()
- {
+ {
+ domainlinks = 'Domains ';
+ $.each(data.domains, function(i, t){domainlinks += "[ "+t+" ]"});
+ $("#domainlist").html(domainlinks);
$("#gridTable").jqGrid({
datatype: "local",
colNames:['Type', 'Total Count', 'Fail Count', 'Failure%', 'Sample Link', 'Min/Max/Avg/Std(ms)'],
@@ -25,7 +28,7 @@ $(function()
],
sortname:'type',
sortorder:'asc',
- caption: "Transaction Summary",
+ caption: "Domain " + data["domain"] + " Transaction Summary",
height: '100%',
autowidth: true,
loadComplete: function() {
diff --git a/cat-home/src/main/webapp/jsp/report/transaction.jsp b/cat-home/src/main/webapp/jsp/report/transaction.jsp
index ad3ce4dbb8197119af38ee4ff87abc6933657735..f6d06a940df298f0f1b12ce6634f9c3238f9e7e4 100644
--- a/cat-home/src/main/webapp/jsp/report/transaction.jsp
+++ b/cat-home/src/main/webapp/jsp/report/transaction.jsp
@@ -1,28 +1,41 @@
-<%@ page contentType="text/html; charset=utf-8" %>
+<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="a" uri="/WEB-INF/app.tld"%>
<%@ taglib prefix="res" uri="http://www.ebay.com/webres"%>
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
+
+
+
+
+
-
-
-
-
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 28d289d37a04740fd871c04b3be614352703672a..946ae5c00566baf4a87fde8389c39a5edd4ebb12 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,14 +16,14 @@
- com.dianping.cat
- cat-core
- 0.1.0
+ com.dianping.cat
+ cat-core
+ 0.1.0
- com.dianping.cat
- cat-consumer
- 0.1.0
+ com.dianping.cat
+ cat-consumer
+ 0.1.0
com.site.common
@@ -90,11 +90,11 @@
jsp-api
2.1
-
- mysql
- mysql-connector-java
- 5.1.12
-
+
+ mysql
+ mysql-connector-java
+ 5.1.12
+
org.jboss.netty
netty