提交 fa66068a 编写于 作者: Y youyong205

modify the transaction view

上级 1b90ec5a
package com.dianping.cat.report.page.event;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
......@@ -82,7 +83,11 @@ public class DisplayTypes {
}
public String getType() {
return m_type;
try {
return URLEncoder.encode(m_type, "utf-8");
} catch (Exception e) {
return m_type;
}
}
}
}
package com.dianping.cat.report.page.transaction;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
......@@ -117,7 +118,11 @@ public class DisplayTypes {
}
public String getType() {
return m_type;
try {
return URLEncoder.encode(m_type, "utf-8");
} catch (Exception e) {
return m_type;
}
}
}
}
......@@ -56,7 +56,7 @@ public class Payload extends AbstractReportPayload<Action> {
public String getType() {
return m_type;
}
public boolean isXml() {
return m_xml;
}
......
......@@ -79,7 +79,7 @@
<c:set var="lastIndex" value="${status.index}"/>
<tr class=" right">
<td class="left"><a href="?op=graphs&domain=${report.domain}&date=${model.date}&ip=${model.ipAddress}&type=${item.type}" class="graph_link" data-status="${status.index}">[:: show ::]</a>
&nbsp;&nbsp;<a href="?domain=${report.domain}&date=${model.date}&ip=${model.ipAddress}&type=${item.type}">${item.type}</a></td>
&nbsp;&nbsp;<a href="?domain=${report.domain}&date=${model.date}&ip=${model.ipAddress}&type=${item.type}"> ${item.detail.id}</a></td>
<td>${w:format(e.totalCount,'#,###,###,###,##0')}</td>
<td>${w:format(e.failCount,'#,###,###,###,##0')}</td>
<td>&nbsp;${w:format(e.failPercent/100,'0.0000%')}</td>
......
......@@ -105,7 +105,7 @@
href="?op=groupGraphs&domain=${report.domain}&date=${model.date}&group=${payload.group}&type=${item.type}"
class="graph_link" data-status="${status.index}">[:: show ::]</a>
&nbsp;&nbsp;<a
href="?op=groupReport&domain=${report.domain}&date=${model.date}&group=${payload.group}&type=${item.type}">${item.type}</a></td>
href="?op=groupReport&domain=${report.domain}&date=${model.date}&group=${payload.group}&type=${item.type}">${item.detail.id}</a></td>
<td>${w:format(e.totalCount,'#,###,###,###,##0')}</td>
<td>${w:format(e.failCount,'#,###,###,###,##0')}</td>
<td>&nbsp;${w:format(e.failPercent/100,'0.0000%')}</td>
......
......@@ -78,7 +78,7 @@
<tr class=" right">
<td style="text-align: left">
<a href="?op=historyGraph&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&reportType=${model.reportType}&type=${item.type}${model.customDate}" class="history_graph_link" data-status="${status.index}">[:: show ::]</a>
&nbsp;&nbsp;&nbsp;<a href="?op=history&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&reportType=${model.reportType}&type=${item.type}${model.customDate}">${item.type}</a></td>
&nbsp;&nbsp;&nbsp;<a href="?op=history&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&reportType=${model.reportType}&type=${item.type}${model.customDate}">${item.detail.id}</a></td>
<td>${w:format(e.totalCount,'#,###,###,###,##0')}</td>
<td>${e.failCount}</td>
<td>${w:format(e.failPercent/100,'0.0000%')}</td>
......
package com.dianping.cat.demo;
import java.io.InputStream;
import org.junit.Test;
......@@ -15,82 +14,91 @@ import com.dianping.cat.message.spi.MessageTree;
import com.dianping.cat.message.spi.internal.DefaultMessageTree;
public class TestCode {
@Test
public void testTime() throws Exception{
long time =System.currentTimeMillis()-TimeHelper.ONE_MINUTE*5;
String format ="http://localhost:2281/cat/r/monitor?timestamp=%s&group=db-%s&domain=test&key=myKey2&op=count";
for(int i=0;i<1000;i++){
for(int j=0;j<5;j++){
String url = String.format(format, time,"database"+j);
public void testEncode() throws Exception {
for (int i = 0; i < 100; i++) {
Transaction t = Cat.newTransaction("1#1", "1#1");
t.complete();
}
Thread.sleep(1000);
}
@Test
public void testTime() throws Exception {
long time = System.currentTimeMillis() - TimeHelper.ONE_MINUTE * 5;
String format = "http://localhost:2281/cat/r/monitor?timestamp=%s&group=db-%s&domain=test&key=myKey2&op=count";
for (int i = 0; i < 1000; i++) {
for (int j = 0; j < 5; j++) {
String url = String.format(format, time, "database" + j);
InputStream in = Urls.forIO().readTimeout(1000).connectTimeout(1000).openStream(url);
Files.forIO().readFrom(in, "utf-8");
}
}
}
@Test
public void testEvent() throws Exception{
for(int i=0;i<100;i++){
Event event = Cat.newEvent("fff", String.valueOf(i));
event.setStatus(Event.SUCCESS);
event.complete();
public void testEvent() throws Exception {
for (int i = 0; i < 100; i++) {
Event event = Cat.newEvent("fff", String.valueOf(i));
event.setStatus(Event.SUCCESS);
event.complete();
}
Thread.sleep(1000*1000);
Thread.sleep(1000 * 1000);
}
public void logError(Throwable able){
Transaction t = Cat.newTransaction("Neocortex", "Error");
Cat.logError(able);
MessageTree tree = Cat.getManager().getThreadLocalMessageTree();
public void logError(Throwable able) {
Transaction t = Cat.newTransaction("Neocortex", "Error");
((DefaultMessageTree) tree).setDomain("NeoCortex");
t.complete();
}
Cat.logError(able);
@Test
public void test1() throws InterruptedException {
for (int i = 0; i < 1000; i++) {
test();
}
MessageTree tree = Cat.getManager().getThreadLocalMessageTree();
Thread.sleep(1000 * 10);
}
((DefaultMessageTree) tree).setDomain("NeoCortex");
t.complete();
}
public void test() throws InterruptedException {
Transaction t = Cat.newTransaction("Neocortex", "function1");
try {
int a = functionA();
@Test
public void test1() throws InterruptedException {
for (int i = 0; i < 1000; i++) {
test();
}
if (a < 0) {
Cat.logError(new RuntimeException("sdsf"));
}
Thread.sleep(1000 * 10);
}
MessageTree tree = Cat.getManager().getThreadLocalMessageTree();
public void test() throws InterruptedException {
Transaction t = Cat.newTransaction("Neocortex", "function1");
try {
int a = functionA();
((DefaultMessageTree) tree).setDomain("NeoCortex");
t.setStatus(Transaction.SUCCESS);
} catch (Exception e) {
if (a < 0) {
Cat.logError(new RuntimeException("sdsf"));
}
Cat.logError(e);
t.setStatus(e);
MessageTree tree = Cat.getManager().getThreadLocalMessageTree();
} finally {
t.complete();
}
((DefaultMessageTree) tree).setDomain("NeoCortex");
t.setStatus(Transaction.SUCCESS);
} catch (Exception e) {
Cat.logError(e);
t.setStatus(e);
}
} finally {
t.complete();
}
private int functionA() {
}
return (int) (Math.random() * 100) - 50;
}
private int functionA() {
return (int) (Math.random() * 100) - 50;
}
}
......@@ -4,14 +4,22 @@ import org.junit.Test;
import org.unidal.lookup.ComponentTestCase;
import com.dianping.cat.report.task.alert.heartbeat.HeartbeatAlert;
import com.dianping.cat.report.task.alert.transaction.TransactionAlert;
public class HeartbeatAlertTest extends ComponentTestCase {
public class AlertTest extends ComponentTestCase {
@Test
public void test() {
public void testHeartbeat() {
HeartbeatAlert alert = lookup(HeartbeatAlert.class);
alert.run();
}
@Test
public void testTransaction() {
TransactionAlert alert = lookup(TransactionAlert.class);
alert.run();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册