Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
a13e9cc0
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,发现更多精彩内容 >>
提交
a13e9cc0
编写于
10月 24, 2014
作者:
J
jialinsun
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://github.com/dianping/cat
上级
add4d038
6c84f3e7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
103 addition
and
15 deletion
+103
-15
cat-home/src/main/java/com/dianping/cat/report/page/cache/CacheReport.java
.../java/com/dianping/cat/report/page/cache/CacheReport.java
+69
-13
cat-home/src/main/webapp/jsp/report/cache/cache.jsp
cat-home/src/main/webapp/jsp/report/cache/cache.jsp
+17
-1
cat-home/src/main/webapp/jsp/report/cache/cacheHistory.jsp
cat-home/src/main/webapp/jsp/report/cache/cacheHistory.jsp
+17
-1
未找到文件。
cat-home/src/main/java/com/dianping/cat/report/page/cache/CacheReport.java
浏览文件 @
a13e9cc0
...
...
@@ -9,6 +9,8 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Set
;
import
org.hsqldb.lib.StringUtil
;
import
com.dianping.cat.consumer.event.model.entity.EventName
;
import
com.dianping.cat.consumer.event.model.entity.EventType
;
import
com.dianping.cat.consumer.transaction.model.entity.TransactionName
;
...
...
@@ -37,8 +39,14 @@ public class CacheReport {
private
Map
<
String
,
CacheTypeItem
>
m_typeItems
=
new
HashMap
<
String
,
CacheTypeItem
>();
public
void
addNewNameItem
(
TransactionName
transactionName
,
EventName
eventName
)
{
String
key
=
transactionName
.
getId
();
CacheNameItem
item
=
m_nameItems
.
get
(
key
);
String
arrays
[]
=
transactionName
.
getId
().
split
(
":"
);
String
categroy
=
arrays
[
0
];
String
method
=
""
;
if
(
arrays
.
length
>
1
)
{
method
=
arrays
[
1
];
}
CacheNameItem
item
=
m_nameItems
.
get
(
categroy
);
CacheNameItem
all
=
m_nameItems
.
get
(
ALL
);
if
(
all
==
null
)
{
...
...
@@ -46,17 +54,14 @@ public class CacheReport {
all
.
setName
(
new
TransactionName
(
ALL
));
m_nameItems
.
put
(
ALL
,
all
);
}
all
.
add
(
transactionName
,
eventName
);
all
.
add
(
transactionName
,
eventName
,
method
);
if
(
item
==
null
)
{
item
=
new
CacheNameItem
();
item
.
setName
(
transactionName
);
item
.
setMissed
(
eventName
.
getTotalCount
());
item
.
setHited
(
1
-
(
double
)
eventName
.
getTotalCount
()
/
transactionName
.
getTotalCount
());
m_nameItems
.
put
(
key
,
item
);
}
else
{
throw
new
RuntimeException
(
"duplicate transaction name in cache report!"
);
item
.
setName
(
new
TransactionName
(
categroy
));
m_nameItems
.
put
(
categroy
,
item
);
}
item
.
add
(
transactionName
,
eventName
,
method
);
}
public
void
addNewTypeItem
(
TransactionType
transactionType
,
EventType
eventType
)
{
...
...
@@ -98,6 +103,16 @@ public class CacheReport {
return
result
;
}
public
List
<
String
>
getAllMethods
()
{
CacheNameItem
allItem
=
m_nameItems
.
get
(
ALL
);
if
(
allItem
!=
null
)
{
return
new
ArrayList
<
String
>(
allItem
.
getMethodCounts
().
keySet
());
}
else
{
return
new
ArrayList
<
String
>();
}
}
public
java
.
util
.
Date
getStartTime
()
{
return
m_startTime
;
}
...
...
@@ -145,15 +160,35 @@ public class CacheReport {
private
long
m_missed
;
private
long
m_getCount
;
private
TransactionName
m_name
;
public
void
add
(
TransactionName
transactionName
,
EventName
eventName
)
{
m_name
.
setTotalCount
(
m_name
.
getTotalCount
()
+
transactionName
.
getTotalCount
());
private
String
m_category
;
private
Map
<
String
,
Long
>
m_methodCounts
=
new
HashMap
<
String
,
Long
>();
public
void
add
(
TransactionName
transactionName
,
EventName
eventName
,
String
method
)
{
long
transactionTotalCount
=
transactionName
.
getTotalCount
();
m_name
.
setTotalCount
(
m_name
.
getTotalCount
()
+
transactionTotalCount
);
m_name
.
setSum
(
m_name
.
getSum
()
+
transactionName
.
getSum
());
m_name
.
setAvg
((
double
)
m_name
.
getSum
()
/
m_name
.
getTotalCount
());
m_name
.
setTps
(
m_name
.
getTps
()
+
transactionName
.
getTps
());
m_missed
=
m_missed
+
eventName
.
getTotalCount
();
m_hited
=
1
-
(
double
)
m_missed
/
m_name
.
getTotalCount
();
if
(!
StringUtil
.
isEmpty
(
method
))
{
Long
value
=
m_methodCounts
.
get
(
method
);
if
(
value
==
null
)
{
value
=
0L
;
}
m_methodCounts
.
put
(
method
,
value
+
transactionTotalCount
);
if
(
"get"
.
equals
(
method
))
{
m_missed
=
m_missed
+
eventName
.
getTotalCount
();
m_getCount
=
m_getCount
+
transactionTotalCount
;
m_hited
=
1
-
(
double
)
m_missed
/
m_getCount
;
}
}
}
public
double
getHited
()
{
...
...
@@ -168,6 +203,24 @@ public class CacheReport {
return
m_name
;
}
public
String
getCategory
()
{
return
m_category
;
}
public
Map
<
String
,
Long
>
getMethodCounts
()
{
return
m_methodCounts
;
}
public
long
getMethodCount
(
String
method
)
{
Long
count
=
m_methodCounts
.
get
(
method
);
if
(
count
==
null
)
{
return
0L
;
}
else
{
return
count
;
}
}
public
void
setHited
(
double
hited
)
{
m_hited
=
hited
;
}
...
...
@@ -207,6 +260,9 @@ public class CacheReport {
return
(
int
)
(
o2
.
getName
().
getAvg
()
*
1000
-
o1
.
getName
().
getAvg
()
*
1000
);
}
else
if
(
m_sort
.
equals
(
"name"
))
{
return
o1
.
getName
().
getId
().
compareTo
(
o2
.
getName
().
getId
());
}
else
if
(
m_sort
.
startsWith
(
"method:"
))
{
String
method
=
m_sort
.
substring
(
7
);
return
(
int
)
(
o2
.
getMethodCount
(
method
)
-
o1
.
getMethodCount
(
method
));
}
return
0
;
}
...
...
cat-home/src/main/webapp/jsp/report/cache/cache.jsp
浏览文件 @
a13e9cc0
...
...
@@ -4,6 +4,7 @@
<%@ taglib
prefix=
"w"
uri=
"http://www.unidal.org/web/core"
%>
<%@ taglib
prefix=
"c"
uri=
"http://java.sun.com/jsp/jstl/core"
%>
<%@ taglib
prefix=
"res"
uri=
"http://www.unidal.org/webres"
%>
<%@ taglib
prefix=
"fn"
uri=
"http://java.sun.com/jsp/jstl/functions"
%>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<jsp:useBean
id=
"ctx"
type=
"com.dianping.cat.report.page.cache.Context"
scope=
"request"
/>
...
...
@@ -85,8 +86,9 @@
<div
class=
"row-fluid"
>
<div
class=
"span7"
>
<table
class=
"data"
>
<c:set
var=
"methods"
value=
"
${
model
.
report
.
allMethods
}
"
/>
<tr>
<th
class=
"left"
colspan=
'
6
'
><input
type=
"text"
<th
class=
"left"
colspan=
'
${fn:length(methods) + 6}
'
><input
type=
"text"
name=
"queryname"
id=
"queryname"
size=
"40"
value=
"${model.queryName}"
>
<input
id=
"queryname"
style=
"WIDTH: 60px"
...
...
@@ -111,6 +113,10 @@
</th>
<th><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=total&queryname=${model.queryName}"
>
Total
</a></th>
<c:forEach
var=
"method"
items=
"
${
methods
}
"
>
<th><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=method:${method}&queryname=${model.queryName}"
>
${method}
</a></th>
</c:forEach>
<th><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=missed&queryname=${model.queryName}"
>
Missed
</a></th>
<th><a
...
...
@@ -127,6 +133,16 @@
<td
style=
"text-align: left; word-wrap: break-word; word-break: break-all;"
>
${w:shorten(e.id, 80)}
</td>
<td>
${w:format(e.totalCount,'#,###,###,###,##0')}
</td>
<c:forEach
var=
"method"
items=
"
${
methods
}
"
>
<c:choose>
<c:when
test=
"
${
empty
item
.
methodCounts
[
method
]
}
"
>
<td>
0
</td>
</c:when>
<c:otherwise>
<td>
${w:format(item.methodCounts[method],'#,###,###,###,##0')}
</td>
</c:otherwise>
</c:choose>
</c:forEach>
<td>
${item.missed}
</td>
<td>
${w:format(item.hited,'0.0000%')}
</td>
<td>
${w:format(e.avg,'0.0')}
</td>
...
...
cat-home/src/main/webapp/jsp/report/cache/cacheHistory.jsp
浏览文件 @
a13e9cc0
...
...
@@ -4,6 +4,7 @@
<%@ taglib
prefix=
"w"
uri=
"http://www.unidal.org/web/core"
%>
<%@ taglib
prefix=
"c"
uri=
"http://java.sun.com/jsp/jstl/core"
%>
<%@ taglib
prefix=
"res"
uri=
"http://www.unidal.org/webres"
%>
<%@ taglib
prefix=
"fn"
uri=
"http://java.sun.com/jsp/jstl/functions"
%>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<jsp:useBean
id=
"ctx"
type=
"com.dianping.cat.report.page.cache.Context"
scope=
"request"
/>
...
...
@@ -76,8 +77,9 @@
<div
class=
"row-fluid"
>
<div
class=
"span7"
>
<table>
<c:set
var=
"methods"
value=
"
${
model
.
report
.
allMethods
}
"
/>
<tr>
<th
class=
"left"
colspan=
'
6
'
><input
type=
"text"
<th
class=
"left"
colspan=
'
${fn:length(methods) + 6}
'
><input
type=
"text"
name=
"queryname"
id=
"queryname"
size=
"40"
value=
"${model.queryName}"
>
<input
id=
"queryname"
style=
"WIDTH: 60px"
...
...
@@ -105,6 +107,10 @@
</th>
<th><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}${model.customDate}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=total&queryname=${model.queryName}"
>
Total
</a></th>
<c:forEach
var=
"method"
items=
"
${
methods
}
"
>
<th><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}${model.customDate}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=method:${method}&queryname=${model.queryName}"
>
${method}
</a></th>
</c:forEach>
<th><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}${model.customDate}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=missed&queryname=${model.queryName}"
>
Missed
</a></th>
<th><a
...
...
@@ -122,6 +128,16 @@
style=
"text-align: left; word-wrap: break-word; word-break: break-all;"
>
${w:shorten(e.id, 80)}
</td>
<td>
${w:format(e.totalCount,'#,###,###,###,##0')}
</td>
<c:forEach
var=
"method"
items=
"
${
methods
}
"
>
<c:choose>
<c:when
test=
"
${
empty
item
.
methodCounts
[
method
]
}
"
>
<td>
0
</td>
</c:when>
<c:otherwise>
<td>
${w:format(item.methodCounts[method],'#,###,###,###,##0')}
</td>
</c:otherwise>
</c:choose>
</c:forEach>
<td>
${item.missed}
</td>
<td>
${w:format(item.hited,'0.0000%')}
</td>
<td>
${w:format(e.avg,'0.0')}
</td>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录