提交 ae35957d 编写于 作者: U unknown

modify the page at home

上级 ba5b2f81
...@@ -111,23 +111,33 @@ public class HtmlMessageCodec implements MessageCodec, Initializable { ...@@ -111,23 +111,33 @@ public class HtmlMessageCodec implements MessageCodec, Initializable {
protected int encodeHeader(MessageTree tree, ChannelBuffer buf) { protected int encodeHeader(MessageTree tree, ChannelBuffer buf) {
BufferHelper helper = m_bufferHelper; BufferHelper helper = m_bufferHelper;
int count = 0; // int count = 0;
count += helper.tr1(buf,"header"); // count += helper.tr1(buf,"header");
count += helper.td(buf, ID); // count += helper.td(buf, ID);
count += helper.td(buf, tree.getDomain()); // count += helper.td(buf, tree.getDomain());
count += helper.td(buf, tree.getHostName()); // count += helper.td(buf, tree.getHostName());
count += helper.td(buf, tree.getIpAddress()); // count += helper.td(buf, tree.getIpAddress());
count += helper.td(buf, tree.getThreadGroupName()); // count += helper.td(buf, tree.getThreadGroupName());
count += helper.td(buf, tree.getThreadId()); // count += helper.td(buf, tree.getThreadId());
count += helper.td(buf, tree.getThreadName()); // count += helper.td(buf, tree.getThreadName());
count += helper.td(buf, tree.getMessageId()); // count += helper.td(buf, tree.getMessageId());
count += helper.td(buf, tree.getParentMessageId()); // count += helper.td(buf, tree.getParentMessageId());
count += helper.td(buf, tree.getRootMessageId()); // count += helper.td(buf, tree.getRootMessageId());
count += helper.td(buf, tree.getSessionToken()); // count += helper.td(buf, tree.getSessionToken());
count += helper.tr2(buf); // count += helper.tr2(buf);
count += helper.crlf(buf); // count += helper.crlf(buf);
StringBuilder sb = new StringBuilder();
sb.append("<tr class=\"header\" ><td colspan=5>");
sb.append(ID).append(" ").append(tree.getDomain()).append(" ");
sb.append(tree.getHostName()).append(" ").append(tree.getIpAddress()).append(" ");
sb.append(tree.getThreadGroupName()).append(" ").append(tree.getThreadId()).append(" ");
sb.append(tree.getThreadName()).append(" ").append(tree.getMessageId()).append(" ");
sb.append(tree.getParentMessageId()).append(" ").append(tree.getRootMessageId()).append(" ");
sb.append(tree.getSessionToken()).append(" ");
sb.append("</td></tr>");
int count = helper.write(buf,sb.toString());
return count; return count;
} }
......
...@@ -33,24 +33,27 @@ public class GroupLevelInfo { ...@@ -33,24 +33,27 @@ public class GroupLevelInfo {
} }
private String getShowDetailByMinte(int minute) { private String getShowDetailByMinte(int minute) {
Map<String, String> params = new LinkedHashMap<String, String>();
String baseUrl = "/cat/r/p?op=detail";
params.put("domain", m_model.getDomain());
params.put("ip", m_model.getIpAddress());
params.put("date", m_model.getDate());
params.put("minute", Integer.toString(minute));
StringBuilder sb = new StringBuilder().append("<td>"); StringBuilder sb = new StringBuilder().append("<td>");
String minuteStr = Integer.toString(minute);
if (minute < 10) { if (minute < 10) {
sb.append("0"); minuteStr ="0" +minute;
} }
sb.append(minute).append("</td>"); sb.append(ProblemReportHelper.creatLinkString(baseUrl, "minute", params, minuteStr));
sb.append("</td>");
for (java.util.Map.Entry<String, GroupStatistics> statistics : m_groupStatistics.entrySet()) { for (java.util.Map.Entry<String, GroupStatistics> statistics : m_groupStatistics.entrySet()) {
sb.append("<td>"); sb.append("<td>");
params.put("group", statistics.getKey());
GroupStatistics value = statistics.getValue(); GroupStatistics value = statistics.getValue();
for (String temp : value.getStatistics().get(minute)) { for (String temp : value.getStatistics().get(minute)) {
Map<String, String> params = new LinkedHashMap<String, String>(); String url = ProblemReportHelper.creatLinkString(baseUrl, temp, params,"");
String baseUrl = "/cat/r/p?op=detail";
params.put("group", statistics.getKey());
params.put("domain", m_model.getDomain());
params.put("ip", m_model.getIpAddress());
params.put("date", m_model.getDate());
params.put("minute", Integer.toString(minute));
String url = ProblemReportHelper.creatLinkString(baseUrl, temp, params);
sb.append(url); sb.append(url);
} }
sb.append("</td>"); sb.append("</td>");
......
...@@ -152,7 +152,10 @@ public class Handler implements PageHandler<Context> { ...@@ -152,7 +152,10 @@ public class Handler implements PageHandler<Context> {
String ip = getIpAddress(report, payload); String ip = getIpAddress(report, payload);
if (period.isCurrent() || period.isFuture()) { if (period.isCurrent() || period.isFuture()) {
model.setLastMinute(getLastMinute(report, ip)); Calendar cal = Calendar.getInstance();
int minute = cal.get(Calendar.MINUTE);
//model.setLastMinute(getLastMinute(report, ip));
model.setLastMinute(minute);
} else { } else {
model.setLastMinute(59); model.setLastMinute(59);
} }
......
...@@ -28,7 +28,7 @@ public class ProblemStatistics { ...@@ -28,7 +28,7 @@ public class ProblemStatistics {
m_groupName = model.getGroupName(); m_groupName = model.getGroupName();
m_threadId = model.getThreadId(); m_threadId = model.getThreadId();
if (isEmpty(m_threadId) && isEmpty(m_groupName)) { if (isEmpty(m_threadId) && isEmpty(m_groupName)) {
// Min Level // Min Level
Map<String, JavaThread> threads = machine.getThreads(); Map<String, JavaThread> threads = machine.getThreads();
...@@ -41,7 +41,7 @@ public class ProblemStatistics { ...@@ -41,7 +41,7 @@ public class ProblemStatistics {
statisticsEntries(entries); statisticsEntries(entries);
} }
} else if (isEmpty(m_groupName) && !isEmpty(m_threadId)) { } else if (!isEmpty(m_groupName) && isEmpty(m_threadId)) {
Map<String, JavaThread> threads = machine.getThreads(); Map<String, JavaThread> threads = machine.getThreads();
for (JavaThread thread : threads.values()) { for (JavaThread thread : threads.values()) {
if (thread.getGroupName().equals(m_groupName)) { if (thread.getGroupName().equals(m_groupName)) {
...@@ -54,7 +54,7 @@ public class ProblemStatistics { ...@@ -54,7 +54,7 @@ public class ProblemStatistics {
} }
} }
} else { } else if (!isEmpty(m_groupName) && !isEmpty(m_threadId)) {
// Thread Level // Thread Level
JavaThread thread = machine.getThreads().get(model.getThreadId()); JavaThread thread = machine.getThreads().get(model.getThreadId());
if (thread == null) { if (thread == null) {
...@@ -66,8 +66,10 @@ public class ProblemStatistics { ...@@ -66,8 +66,10 @@ public class ProblemStatistics {
} }
List<Entry> entries = segment.getEntries(); List<Entry> entries = segment.getEntries();
statisticsEntries(entries); statisticsEntries(entries);
} else{
throw new RuntimeException("The url is error, it should contains thread group name at least!");
} }
return this; return this;
} }
......
...@@ -60,12 +60,21 @@ public class ThreadLevelInfo { ...@@ -60,12 +60,21 @@ public class ThreadLevelInfo {
} }
private String getShowDetailByMinte(int minute) { private String getShowDetailByMinte(int minute) {
Map<String, String> params = new LinkedHashMap<String, String>();
String baseUrl = "/cat/r/p?op=detail";
params.put("domain", m_model.getDomain());
params.put("ip", m_model.getIpAddress());
params.put("date", m_model.getDate());
params.put("minute", Integer.toString(minute));
StringBuilder sb = new StringBuilder().append("<td>"); StringBuilder sb = new StringBuilder().append("<td>");
String minuteStr = Integer.toString(minute);
if (minute < 10) { if (minute < 10) {
sb.append("0"); minuteStr ="0" +minute;
} }
sb.append(minute).append("</td>"); sb.append(ProblemReportHelper.creatLinkString(baseUrl, "minute", params, minuteStr));
sb.append("</td>");
for (java.util.Map.Entry<String, GroupStatistics> statistics : m_groupStatistics.entrySet()) { for (java.util.Map.Entry<String, GroupStatistics> statistics : m_groupStatistics.entrySet()) {
GroupStatistics value = statistics.getValue(); GroupStatistics value = statistics.getValue();
String groupName = statistics.getKey(); String groupName = statistics.getKey();
...@@ -77,17 +86,11 @@ public class ThreadLevelInfo { ...@@ -77,17 +86,11 @@ public class ThreadLevelInfo {
HashSet<String> errors = theadStatistics.getStatistics().get(minute); HashSet<String> errors = theadStatistics.getStatistics().get(minute);
sb.append("<td>"); sb.append("<td>");
for (String error : errors) { for (String error : errors) {
Map<String, String> params = new LinkedHashMap<String, String>();
String baseUrl = "/cat/r/p?op=detail";
params.put("group", statistics.getKey()); params.put("group", statistics.getKey());
if (groupName.equals(m_groupName)) { if (groupName.equals(m_groupName)) {
params.put("thread", thread); params.put("thread", thread);
} }
params.put("domain", m_model.getDomain()); String url = ProblemReportHelper.creatLinkString(baseUrl, error, params,"");
params.put("ip", m_model.getIpAddress());
params.put("date", m_model.getDate());
params.put("minute", Integer.toString(minute));
String url = ProblemReportHelper.creatLinkString(baseUrl, error, params);
sb.append(url); sb.append(url);
} }
sb.append("</td>"); sb.append("</td>");
......
...@@ -10,7 +10,7 @@ import com.dianping.cat.consumer.problem.model.entity.Segment; ...@@ -10,7 +10,7 @@ import com.dianping.cat.consumer.problem.model.entity.Segment;
/* used by problem.jsp */ /* used by problem.jsp */
public class ProblemReportHelper { public class ProblemReportHelper {
public static String showLegends(JavaThread thread, int minute, String domain, String ipAddress, long date) { public static String showLegends(JavaThread thread, int minute, String domain, String ipAddress, long date) {
Segment segment = thread.findSegment(minute); Segment segment = thread.findSegment(minute);
...@@ -42,22 +42,30 @@ public class ProblemReportHelper { ...@@ -42,22 +42,30 @@ public class ProblemReportHelper {
sb.append("&date=").append(date); sb.append("&date=").append(date);
sb.append("&minute=").append(minute); sb.append("&minute=").append(minute);
sb.append("\" class=\"").append(name).append("\">&nbsp;&nbsp;</a>"); sb.append("\" class=\"").append(name).append("\">&nbsp;&nbsp;</a>");
//sb.append("<a href=\"/cat/r/m/").append(messageId).append("/logview.html\" class=\""); // sb.append("<a href=\"/cat/r/m/").append(messageId).append("/logview.html\" class=\"");
//sb.append(name); // sb.append(name);
//sb.append("\">&nbsp;&nbsp;</a>"); // sb.append("\">&nbsp;&nbsp;</a>");
} }
} }
return sb.toString(); return sb.toString();
} }
public static String creatLinkString(String baseUrl, String classStyle, Map<String, String> params) { public static String creatLinkString(String baseUrl, String classStyle, Map<String, String> params, String text) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("<a href=\"").append(baseUrl); sb.append("<a ");
sb.append("href=\"").append(baseUrl);
for (java.util.Map.Entry<String, String> param : params.entrySet()) { for (java.util.Map.Entry<String, String> param : params.entrySet()) {
sb.append("&").append(param.getKey()).append("=").append(param.getValue()); sb.append("&").append(param.getKey()).append("=").append(param.getValue());
} }
sb.append("\" class=\"").append(classStyle).append("\">&nbsp;&nbsp;</a>"); sb.append("\" class=\"").append(classStyle).append("\"");
sb.append(" onclick=\"return show(this);\"" ).append(" >");
if (text.trim().length() == 0) {
sb.append("&nbsp;&nbsp");
} else {
sb.append(text);
}
sb.append("</a>");
return sb.toString(); return sb.toString();
} }
......
...@@ -51,13 +51,6 @@ ...@@ -51,13 +51,6 @@
<tag-class>org.unidal.webres.taglib.basic.UseCssTagHandler</tag-class> <tag-class>org.unidal.webres.taglib.basic.UseCssTagHandler</tag-class>
<body-content>JSP</body-content> <body-content>JSP</body-content>
<attribute> <attribute>
<description><![CDATA[Set the css value with EL or a css ref.]]></description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description><![CDATA[Identify whether the link URL is secure or not.]]></description> <description><![CDATA[Identify whether the link URL is secure or not.]]></description>
<name>secure</name> <name>secure</name>
<required>false</required> <required>false</required>
...@@ -79,6 +72,13 @@ ...@@ -79,6 +72,13 @@
<type>java.lang.String</type> <type>java.lang.String</type>
</attribute> </attribute>
<attribute> <attribute>
<description><![CDATA[Set the css value with EL or a css ref.]]></description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description><![CDATA[Target placement for this css resource to render]]></description> <description><![CDATA[Target placement for this css resource to render]]></description>
<name>target</name> <name>target</name>
<required>false</required> <required>false</required>
...@@ -114,18 +114,18 @@ ...@@ -114,18 +114,18 @@
<tag-class>org.unidal.webres.taglib.basic.SetTagHandler</tag-class> <tag-class>org.unidal.webres.taglib.basic.SetTagHandler</tag-class>
<body-content>JSP</body-content> <body-content>JSP</body-content>
<attribute> <attribute>
<description><![CDATA[The value]]></description> <description><![CDATA[The name.]]></description>
<name>value</name> <name>id</name>
<required>true</required> <required>true</required>
<rtexprvalue>true</rtexprvalue> <rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type> <type>java.lang.String</type>
</attribute> </attribute>
<attribute> <attribute>
<description><![CDATA[The name.]]></description> <description><![CDATA[The value]]></description>
<name>id</name> <name>value</name>
<required>true</required> <required>true</required>
<rtexprvalue>true</rtexprvalue> <rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type> <type>java.lang.Object</type>
</attribute> </attribute>
<dynamic-attributes>false</dynamic-attributes> <dynamic-attributes>false</dynamic-attributes>
</tag> </tag>
...@@ -135,13 +135,6 @@ ...@@ -135,13 +135,6 @@
<tag-class>org.unidal.webres.taglib.basic.UseJsTagHandler</tag-class> <tag-class>org.unidal.webres.taglib.basic.UseJsTagHandler</tag-class>
<body-content>JSP</body-content> <body-content>JSP</body-content>
<attribute> <attribute>
<description><![CDATA[Set the js value with EL or a js ref.]]></description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description><![CDATA[Identify whether the link URL is secure or not.]]></description> <description><![CDATA[Identify whether the link URL is secure or not.]]></description>
<name>secure</name> <name>secure</name>
<required>false</required> <required>false</required>
...@@ -163,6 +156,13 @@ ...@@ -163,6 +156,13 @@
<type>java.lang.String</type> <type>java.lang.String</type>
</attribute> </attribute>
<attribute> <attribute>
<description><![CDATA[Set the js value with EL or a js ref.]]></description>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description><![CDATA[Target placement for this js resource to render]]></description> <description><![CDATA[Target placement for this js resource to render]]></description>
<name>target</name> <name>target</name>
<required>false</required> <required>false</required>
...@@ -177,13 +177,6 @@ ...@@ -177,13 +177,6 @@
<tag-class>org.unidal.webres.taglib.basic.LinkTagHandler</tag-class> <tag-class>org.unidal.webres.taglib.basic.LinkTagHandler</tag-class>
<body-content>JSP</body-content> <body-content>JSP</body-content>
<attribute> <attribute>
<description><![CDATA[The value for link, could be a expression or a link ref.]]></description>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description><![CDATA[Identify whether the link URL is secure or not.]]></description> <description><![CDATA[Identify whether the link URL is secure or not.]]></description>
<name>secure</name> <name>secure</name>
<required>false</required> <required>false</required>
...@@ -197,6 +190,13 @@ ...@@ -197,6 +190,13 @@
<rtexprvalue>true</rtexprvalue> <rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type> <type>java.lang.String</type>
</attribute> </attribute>
<attribute>
<description><![CDATA[The value for link, could be a expression or a link ref.]]></description>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<dynamic-attributes>true</dynamic-attributes> <dynamic-attributes>true</dynamic-attributes>
</tag> </tag>
<tag> <tag>
...@@ -205,13 +205,6 @@ ...@@ -205,13 +205,6 @@
<tag-class>org.unidal.webres.taglib.basic.ImageTagHandler</tag-class> <tag-class>org.unidal.webres.taglib.basic.ImageTagHandler</tag-class>
<body-content>JSP</body-content> <body-content>JSP</body-content>
<attribute> <attribute>
<description><![CDATA[The value for image, could be a expression or a image path.]]></description>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description><![CDATA[Identify whether the image URL is secure or not.]]></description> <description><![CDATA[Identify whether the image URL is secure or not.]]></description>
<name>secure</name> <name>secure</name>
<required>false</required> <required>false</required>
...@@ -232,6 +225,13 @@ ...@@ -232,6 +225,13 @@
<rtexprvalue>true</rtexprvalue> <rtexprvalue>true</rtexprvalue>
<type>java.lang.String</type> <type>java.lang.String</type>
</attribute> </attribute>
<attribute>
<description><![CDATA[The value for image, could be a expression or a image path.]]></description>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>java.lang.Object</type>
</attribute>
<dynamic-attributes>true</dynamic-attributes> <dynamic-attributes>true</dynamic-attributes>
</tag> </tag>
<tag> <tag>
......
...@@ -37,5 +37,6 @@ tr.link td { ...@@ -37,5 +37,6 @@ tr.link td {
.header{ .header{
display:hidden; font-size: small;
white-space: nowrap;
} }
\ No newline at end of file
function show(anchor) {
alert(anchor)
$.ajax({
type: "get",
url: anchor.href,
success : function(data, textStatus) {
alert(data);
}
});
}
\ No newline at end of file
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<res:useJs value="${res.js.local.problem_js}" target="head-js"/> <res:useJs value="${res.js.local.problem_js}" target="head-js"/>
<table class="problem"> <table class="problem">
<tr><th>Type</th><th>Count</th><th>Detail</th></tr> <tr><th>Type</th><th>Count</th><th>Detail</th></tr>
<c:forEach var="statistics" items="${model.statistics}"> <c:forEach var="statistics" items="${model.problemStatistics.status}">
<tr> <tr>
<td><a href="#" class="${statistics.value.type}" >&nbsp;&nbsp;</a>&nbsp;&nbsp;${statistics.value.type} <td><a href="#" class="${statistics.value.type}" >&nbsp;&nbsp;</a>&nbsp;&nbsp;${statistics.value.type}
</td> </td>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册