Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
60ffb8c7
C
cat
项目概览
梦中观雨
/
cat
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
cat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
60ffb8c7
编写于
4月 10, 2012
作者:
Y
You Yong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify some small bug
上级
9b08ac4b
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
66 addition
and
11 deletion
+66
-11
cat-consumer/src/main/java/com/dianping/cat/consumer/ip/IpAnalyzer.java
...rc/main/java/com/dianping/cat/consumer/ip/IpAnalyzer.java
+6
-1
cat-core/src/main/java/com/dianping/cat/servlet/CatFilter.java
...ore/src/main/java/com/dianping/cat/servlet/CatFilter.java
+1
-1
cat-home/src/main/java/com/dianping/cat/helper/MapUtils.java
cat-home/src/main/java/com/dianping/cat/helper/MapUtils.java
+35
-0
cat-home/src/main/java/com/dianping/cat/report/page/ip/Handler.java
...rc/main/java/com/dianping/cat/report/page/ip/Handler.java
+6
-2
cat-home/src/main/java/com/dianping/cat/report/page/problem/ProblemStatistics.java
...m/dianping/cat/report/page/problem/ProblemStatistics.java
+10
-1
cat-home/src/main/webapp/jsp/report/event.jsp
cat-home/src/main/webapp/jsp/report/event.jsp
+1
-3
cat-home/src/main/webapp/jsp/report/ip.jsp
cat-home/src/main/webapp/jsp/report/ip.jsp
+2
-1
cat-home/src/main/webapp/jsp/report/problemGroup.jsp
cat-home/src/main/webapp/jsp/report/problemGroup.jsp
+2
-0
cat-home/src/main/webapp/jsp/report/problemThread.jsp
cat-home/src/main/webapp/jsp/report/problemThread.jsp
+2
-0
cat-home/src/main/webapp/jsp/report/transaction.jsp
cat-home/src/main/webapp/jsp/report/transaction.jsp
+1
-2
未找到文件。
cat-consumer/src/main/java/com/dianping/cat/consumer/ip/IpAnalyzer.java
浏览文件 @
60ffb8c7
...
@@ -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 RemoteI
p
=<ip>&...
// URL:ClientInfo RemoteI
P
=<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
;
...
...
cat-core/src/main/java/com/dianping/cat/servlet/CatFilter.java
浏览文件 @
60ffb8c7
...
@@ -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
(
"RemoteI
p
="
).
append
(
ip
);
sb
.
append
(
"RemoteI
P
="
).
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"
));
...
...
cat-home/src/main/java/com/dianping/cat/helper/MapUtils.java
0 → 100644
浏览文件 @
60ffb8c7
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;
// }
}
cat-home/src/main/java/com/dianping/cat/report/page/ip/Handler.java
浏览文件 @
60ffb8c7
...
@@ -124,8 +124,12 @@ public class Handler implements PageHandler<Context> {
...
@@ -124,8 +124,12 @@ public class Handler implements PageHandler<Context> {
return
m2
.
getLastFifteen
()
-
m1
.
getLastFifteen
();
// desc order
return
m2
.
getLastFifteen
()
-
m1
.
getLastFifteen
();
// desc order
}
}
});
});
return
displayModels
;
if
(
displayModels
.
size
()
>
100
)
{
return
displayModels
.
subList
(
0
,
100
);
}
else
{
return
displayModels
;
}
}
}
static
class
DisplayModelBuilder
extends
BaseVisitor
{
static
class
DisplayModelBuilder
extends
BaseVisitor
{
...
...
cat-home/src/main/java/com/dianping/cat/report/page/problem/ProblemStatistics.java
浏览文件 @
60ffb8c7
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
)
{
...
...
cat-home/src/main/webapp/jsp/report/event.jsp
浏览文件 @
60ffb8c7
...
@@ -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
cat-home/src/main/webapp/jsp/report/ip.jsp
浏览文件 @
60ffb8c7
...
@@ -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>
...
...
cat-home/src/main/webapp/jsp/report/problemGroup.jsp
浏览文件 @
60ffb8c7
...
@@ -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>
...
...
cat-home/src/main/webapp/jsp/report/problemThread.jsp
浏览文件 @
60ffb8c7
...
@@ -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>
...
...
cat-home/src/main/webapp/jsp/report/transaction.jsp
浏览文件 @
60ffb8c7
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录