提交 60ffb8c7 编写于 作者: Y You Yong

modify some small bug

上级 9b08ac4b
...@@ -87,7 +87,7 @@ public class IpAnalyzer extends AbstractMessageAnalyzer<IpReport> implements Log ...@@ -87,7 +87,7 @@ public class IpAnalyzer extends AbstractMessageAnalyzer<IpReport> implements Log
for (Message child : children) { for (Message child : children) {
if (child instanceof Event && child.getType().equals("URL") && child.getName().equals("ClientInfo")) { if (child instanceof Event && child.getType().equals("URL") && child.getName().equals("ClientInfo")) {
// URL:ClientInfo RemoteIp=<ip>&... // URL:ClientInfo RemoteIP=<ip>&...
String data = child.getData().toString(); String data = child.getData().toString();
int off = data.indexOf(TOKEN); int off = data.indexOf(TOKEN);
...@@ -97,6 +97,11 @@ public class IpAnalyzer extends AbstractMessageAnalyzer<IpReport> implements Log ...@@ -97,6 +97,11 @@ public class IpAnalyzer extends AbstractMessageAnalyzer<IpReport> implements Log
if (pos > 0) { if (pos > 0) {
return data.substring(off + TOKEN.length(), pos); return data.substring(off + TOKEN.length(), pos);
} }
} else {
//TODO remove it after mobileApi upgrade
off = data.indexOf("RemoteIp=");
int pos = data.indexOf("VirtualIP=");
return data.substring(off + "RemoteIp=".length(), pos);
} }
break; break;
......
...@@ -87,7 +87,7 @@ public class CatFilter implements Filter { ...@@ -87,7 +87,7 @@ public class CatFilter implements Filter {
ip = ips[ips.length - 1].trim(); ip = ips[ips.length - 1].trim();
} }
sb.append("RemoteIp=").append(ip); sb.append("RemoteIP=").append(ip);
sb.append("&VirtualIP=").append(req.getRemoteAddr()); sb.append("&VirtualIP=").append(req.getRemoteAddr());
sb.append("&Server=").append(req.getServerName()); sb.append("&Server=").append(req.getServerName());
sb.append("&Referer=").append(req.getHeader("referer")); sb.append("&Referer=").append(req.getHeader("referer"));
......
package com.dianping.cat.helper;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
public class MapUtils {
public static <K, V> Map<K, V> sortMap(Map<K, V> map, Comparator<Entry<K, V>> compator) {
Map<K, V> result = new LinkedHashMap<K, V>();
List<Entry<K, V>> entries = new ArrayList<Entry<K, V>>(map.entrySet());
Collections.sort(entries,compator);
for(Entry<K,V> entry:entries){
result.put(entry.getKey(), entry.getValue());
}
return result;
}
// public <T,S> List<String> sort(T model, String xpath, Comparator<S> comparator) {
// TransactionReport report = null;
// List<String> keys = sort(report, "/transaction-report/type[@name='URL']/name", new Comparator<TransactionName>() {
// @Override
// public int compare(TransactionName n1, TransactionName n2) {
// return 0;
// }
// });
//
// return null;
// }
}
...@@ -125,8 +125,12 @@ public class Handler implements PageHandler<Context> { ...@@ -125,8 +125,12 @@ public class Handler implements PageHandler<Context> {
} }
}); });
if (displayModels.size() > 100) {
return displayModels.subList(0, 100);
} else {
return displayModels; return displayModels;
} }
}
static class DisplayModelBuilder extends BaseVisitor { static class DisplayModelBuilder extends BaseVisitor {
private int m_minute; private int m_minute;
......
package com.dianping.cat.report.page.problem; package com.dianping.cat.report.page.problem;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -11,6 +12,7 @@ import com.dianping.cat.consumer.problem.model.entity.JavaThread; ...@@ -11,6 +12,7 @@ import com.dianping.cat.consumer.problem.model.entity.JavaThread;
import com.dianping.cat.consumer.problem.model.entity.Machine; import com.dianping.cat.consumer.problem.model.entity.Machine;
import com.dianping.cat.consumer.problem.model.entity.ProblemReport; import com.dianping.cat.consumer.problem.model.entity.ProblemReport;
import com.dianping.cat.consumer.problem.model.entity.Segment; import com.dianping.cat.consumer.problem.model.entity.Segment;
import com.dianping.cat.helper.MapUtils;
public class ProblemStatistics { public class ProblemStatistics {
...@@ -186,7 +188,14 @@ public class ProblemStatistics { ...@@ -186,7 +188,14 @@ public class ProblemStatistics {
} }
public Map<String, StatusStatistics> getStatus() { public Map<String, StatusStatistics> getStatus() {
return m_status; Map<String,StatusStatistics> result = MapUtils.sortMap(m_status, new Comparator<java.util.Map.Entry<String, StatusStatistics>>() {
@Override
public int compare(java.util.Map.Entry<String, StatusStatistics> o1,
java.util.Map.Entry<String, StatusStatistics> o2) {
return o2.getValue().getCount()-o1.getValue().getCount();
}
});
return result;
} }
public void setStatus(Map<String, StatusStatistics> status) { public void setStatus(Map<String, StatusStatistics> status) {
......
...@@ -66,8 +66,6 @@ ...@@ -66,8 +66,6 @@
</table> </table>
<font color="white">${lastIndex+1}</font> <font color="white">${lastIndex+1}</font>
<res:useJs value="${res.js.local.event_js}" target="bottom-js" />
</jsp:body> </jsp:body>
</a:report> </a:report>
<res:useJs value="${res.js.local.event_js}" target="bottom-js" />
\ No newline at end of file
...@@ -16,9 +16,10 @@ ...@@ -16,9 +16,10 @@
<res:useCss value='${res.css.local.ip_css}' target="head-css"/> <res:useCss value='${res.css.local.ip_css}' target="head-css"/>
<table class="ip-table"> <table class="ip-table">
<tr><th>IP</th><th>last 1 min</th><th>last 5 mins</th><th>last 15 mins</th></tr> <tr><th>No.</th><th>IP</th><th>last 1 min</th><th>last 5 mins</th><th>last 15 mins</th></tr>
<c:forEach var="m" items="${model.displayModels}" varStatus="status"> <c:forEach var="m" items="${model.displayModels}" varStatus="status">
<tr class="${status.index mod 2 != 0 ? 'odd' : 'even'}"> <tr class="${status.index mod 2 != 0 ? 'odd' : 'even'}">
<td>${status.index+1}</td>
<td>${m.address}</td> <td>${m.address}</td>
<td>${m.lastOne}</td> <td>${m.lastOne}</td>
<td>${m.lastFive}</td> <td>${m.lastFive}</td>
......
...@@ -42,7 +42,9 @@ ...@@ -42,7 +42,9 @@
</tr> </tr>
</table> </table>
<br>
<%@ include file="problemTable.jsp" %> <%@ include file="problemTable.jsp" %>
<br>
<table class="problem"> <table class="problem">
<tr> <tr>
......
...@@ -37,7 +37,9 @@ ...@@ -37,7 +37,9 @@
</tr> </tr>
</table> </table>
<br>
<%@ include file="problemTable.jsp" %> <%@ include file="problemTable.jsp" %>
<br>
<table class="problem"> <table class="problem">
<tr><td title="time\group">T\G</td> <tr><td title="time\group">T\G</td>
......
...@@ -66,8 +66,7 @@ ...@@ -66,8 +66,7 @@
</table> </table>
<font color="white">${lastIndex+1}</font> <font color="white">${lastIndex+1}</font>
<res:useJs value="${res.js.local.transaction_js}" target="bottom-js" />
</jsp:body> </jsp:body>
</a:report> </a:report>
<res:useJs value="${res.js.local.transaction_js}" target="bottom-js" />
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册