Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
ca441a1d
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,发现更多精彩内容 >>
提交
ca441a1d
编写于
2月 06, 2012
作者:
F
Frankie Wu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
ssh://192.168.8.22:58422/cat
上级
f54cb495
231559af
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
125 addition
and
74 deletion
+125
-74
cat-consumer/src/main/java/com/dianping/cat/consumer/transaction/TransactionReportAnalyzer.java
...g/cat/consumer/transaction/TransactionReportAnalyzer.java
+46
-40
cat-home/src/main/java/com/dianping/cat/report/page/transaction/Handler.java
...ava/com/dianping/cat/report/page/transaction/Handler.java
+9
-3
cat-home/src/main/java/com/dianping/cat/report/page/transaction/Model.java
.../java/com/dianping/cat/report/page/transaction/Model.java
+10
-0
cat-home/src/main/webapp/js/transaction.js
cat-home/src/main/webapp/js/transaction.js
+59
-31
cat-home/src/main/webapp/jsp/report/transaction.jsp
cat-home/src/main/webapp/jsp/report/transaction.jsp
+1
-0
未找到文件。
cat-consumer/src/main/java/com/dianping/cat/consumer/transaction/TransactionReportAnalyzer.java
浏览文件 @
ca441a1d
...
...
@@ -63,49 +63,55 @@ public class TransactionReportAnalyzer extends AbstractMessageAnalyzer<Transacti
if
(
report
==
null
)
{
return
report
;
}
for
(
TransactionType
type
:
report
.
getTypes
().
values
())
{
long
typeCount
=
0
;
long
typeFailCount
=
0
;
double
typeSum
=
0
;
double
typeSum2
=
0
;
Collection
<
TransactionName
>
names
=
type
.
getNames
().
values
();
for
(
TransactionName
name
:
names
)
{
long
count
=
name
.
getTotalCount
();
double
sum
=
name
.
getSum
();
double
ave
=
sum
/
count
;
double
sum2
=
name
.
getSum2
();
double
std
=
std
(
count
,
ave
,
sum2
);
long
failCount
=
name
.
getFailCount
();
double
failPercent
=
100.0
*
failCount
/
count
;
name
.
setFailPercent
(
failPercent
);
name
.
setAvg
(
ave
);
name
.
setStd
(
std
);
typeCount
+=
count
;
typeSum
+=
sum
;
typeSum2
+=
sum2
;
typeFailCount
+=
failCount
;
if
(
type
.
getSuccessMessageUrl
()
==
null
&&
name
.
getSuccessMessageUrl
()
!=
null
)
{
type
.
setSuccessMessageUrl
(
name
.
getSuccessMessageUrl
());
}
if
(
type
.
getFailMessageUrl
()
==
null
&&
name
.
getFailMessageUrl
()
!=
null
)
{
type
.
setFailMessageUrl
(
name
.
getFailMessageUrl
());
}
type
.
setMax
(
Math
.
max
(
name
.
getMax
(),
type
.
getMax
()));
type
.
setMin
(
Math
.
min
(
name
.
getMin
(),
type
.
getMin
()));
}
type
.
setTotalCount
(
typeCount
);
type
.
setFailCount
(
typeFailCount
);
type
.
setSum
(
typeSum
);
type
.
setSum2
(
typeSum2
);
double
typeAvg
=
typeSum
/
typeCount
;
type
.
setAvg
(
typeAvg
);
type
.
setFailPercent
(
100.0
*
typeFailCount
/
typeCount
);
type
.
setStd
(
std
(
typeCount
,
typeAvg
,
typeSum2
));
doOneType
(
type
);
}
return
report
;
}
/**
* @param type
*/
public
void
doOneType
(
TransactionType
type
)
{
long
typeCount
=
0
;
long
typeFailCount
=
0
;
double
typeSum
=
0
;
double
typeSum2
=
0
;
Collection
<
TransactionName
>
names
=
type
.
getNames
().
values
();
for
(
TransactionName
name
:
names
)
{
long
count
=
name
.
getTotalCount
();
double
sum
=
name
.
getSum
();
double
ave
=
sum
/
count
;
double
sum2
=
name
.
getSum2
();
double
std
=
std
(
count
,
ave
,
sum2
);
long
failCount
=
name
.
getFailCount
();
double
failPercent
=
100.0
*
failCount
/
count
;
name
.
setFailPercent
(
failPercent
);
name
.
setAvg
(
ave
);
name
.
setStd
(
std
);
typeCount
+=
count
;
typeSum
+=
sum
;
typeSum2
+=
sum2
;
typeFailCount
+=
failCount
;
if
(
type
.
getSuccessMessageUrl
()
==
null
&&
name
.
getSuccessMessageUrl
()
!=
null
)
{
type
.
setSuccessMessageUrl
(
name
.
getSuccessMessageUrl
());
}
if
(
type
.
getFailMessageUrl
()
==
null
&&
name
.
getFailMessageUrl
()
!=
null
)
{
type
.
setFailMessageUrl
(
name
.
getFailMessageUrl
());
}
type
.
setMax
(
Math
.
max
(
name
.
getMax
(),
type
.
getMax
()));
type
.
setMin
(
Math
.
min
(
name
.
getMin
(),
type
.
getMin
()));
}
type
.
setTotalCount
(
typeCount
);
type
.
setFailCount
(
typeFailCount
);
type
.
setSum
(
typeSum
);
type
.
setSum2
(
typeSum2
);
double
typeAvg
=
typeSum
/
typeCount
;
type
.
setAvg
(
typeAvg
);
type
.
setFailPercent
(
100.0
*
typeFailCount
/
typeCount
);
type
.
setStd
(
std
(
typeCount
,
typeAvg
,
typeSum2
));
}
@Override
public
void
enableLogging
(
Logger
logger
)
{
m_logger
=
logger
;
...
...
@@ -187,12 +193,12 @@ public class TransactionReportAnalyzer extends AbstractMessageAnalyzer<Transacti
if
(
tree
!=
null
)
{
if
(
t
.
isSuccess
())
{
if
(
name
.
getSuccessMessageUrl
()
==
null
)
{
String
url
=
this
.
messageStorage
.
store
(
tree
);
String
url
=
this
.
messageStorage
.
store
(
tree
);
// store first success
name
.
setSuccessMessageUrl
(
url
);
}
}
else
{
String
url
=
this
.
messageStorage
.
store
(
tree
);
// store all errors
if
(
name
.
getFailMessageUrl
()
==
null
)
{
String
url
=
this
.
messageStorage
.
store
(
tree
);
name
.
setFailMessageUrl
(
url
);
}
}
...
...
cat-home/src/main/java/com/dianping/cat/report/page/transaction/Handler.java
浏览文件 @
ca441a1d
...
...
@@ -14,7 +14,12 @@ import com.site.web.mvc.PageHandler;
import
com.site.web.mvc.annotation.InboundActionMeta
;
import
com.site.web.mvc.annotation.OutboundActionMeta
;
import
com.site.web.mvc.annotation.PayloadMeta
;
import
com.site.web.mvc.payload.ParameterProvider
;
/**
* @author sean.wang
* @since Feb 6, 2012
*/
public
class
Handler
implements
PageHandler
<
Context
>
{
@Inject
private
JspViewer
m_jspViewer
;
...
...
@@ -37,11 +42,12 @@ public class Handler implements PageHandler<Context> {
model
.
setAction
(
Action
.
VIEW
);
model
.
setPage
(
ReportPage
.
TRANSACTION
);
TransactionReportAnalyzer
analyzer
=
(
TransactionReportAnalyzer
)
m_consumer
.
getCurrentAnalyzer
(
"transaction"
);
TransactionReportAnalyzer
analyzer
=
(
TransactionReportAnalyzer
)
m_consumer
.
getCurrentAnalyzer
(
"transaction"
);
if
(
analyzer
!=
null
)
{
model
.
setReport
(
analyzer
.
generate
(
ctx
.
getRequestContext
().
getParameterProvider
().
getParameter
(
"domain"
)));
ParameterProvider
provider
=
ctx
.
getRequestContext
().
getParameterProvider
();
model
.
setReport
(
analyzer
.
generate
(
provider
.
getParameter
(
"domain"
)));
model
.
setType
(
provider
.
getParameter
(
"type"
));
}
else
{
model
.
setReport
(
new
TransactionReport
(
"none"
));
}
...
...
cat-home/src/main/java/com/dianping/cat/report/page/transaction/Model.java
浏览文件 @
ca441a1d
...
...
@@ -7,6 +7,8 @@ import com.site.web.mvc.ViewModel;
public
class
Model
extends
ViewModel
<
ReportPage
,
Action
,
Context
>
{
private
TransactionReport
m_report
;
private
String
type
;
public
Model
(
Context
ctx
)
{
super
(
ctx
);
...
...
@@ -28,4 +30,12 @@ public class Model extends ViewModel<ReportPage, Action, Context> {
public
void
setReport
(
TransactionReport
report
)
{
m_report
=
report
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
}
cat-home/src/main/webapp/js/transaction.js
浏览文件 @
ca441a1d
var
tabledata
=
[];
$
(
function
(){
var
types
=
data
[
"
types
"
];
for
(
i
in
types
)
{
var
type
=
types
[
i
];
var
sampleurl
=
type
.
failMessageUrl
!=
null
?
"
<a href=
\"
m/
"
+
type
.
failMessageUrl
+
"
\"
>fail</a>
"
:
"
<a href=
\"
m/
"
+
type
.
successMessageUrl
+
"
\"
>success</a>
"
;
var
stat
=
""
+
type
.
min
+
"
/
"
+
type
.
max
+
"
/
"
+
type
.
avg
+
"
/
"
+
type
.
std
;
tabledata
.
push
({
"
type
"
:
type
.
id
,
"
total
"
:
type
.
totalCount
,
"
fail
"
:
type
.
failCount
,
"
failPercent
"
:
type
.
failPercent
,
"
sample
"
:
sampleurl
,
"
stat
"
:
stat
});
}
var
types
=
data
[
"
types
"
];
var
nowdomain
=
data
[
"
domain
"
];
if
(
nowtype
!=
""
)
{
var
names
=
types
[
nowtype
][
"
names
"
];
for
(
i
in
names
)
{
var
name
=
names
[
i
];
var
sampleurl
=
name
.
failMessageUrl
!=
null
?
"
<a href=
\"
m/
"
+
name
.
failMessageUrl
+
"
\"
>fail</a>
"
:
"
<a href=
\"
m/
"
+
name
.
successMessageUrl
+
"
\"
>success</a>
"
;
var
stat
=
""
+
name
.
min
+
"
/
"
+
name
.
max
+
"
/
"
+
name
.
avg
+
"
/
"
+
name
.
std
;
tabledata
.
push
({
"
name
"
:
name
.
id
,
"
total
"
:
name
.
totalCount
,
"
fail
"
:
name
.
failCount
,
"
failPercent
"
:
name
.
failPercent
,
"
sample
"
:
sampleurl
,
"
stat
"
:
stat
});
}
}
else
{
for
(
i
in
types
)
{
var
type
=
types
[
i
];
var
typeurl
=
"
<a href=
\"
t?domain=
"
+
nowdomain
+
"
&type=
"
+
type
.
id
+
"
\"
>
"
+
type
.
id
+
"
</a>
"
;
var
sampleurl
=
type
.
failMessageUrl
!=
null
?
"
<a href=
\"
m/
"
+
type
.
failMessageUrl
+
"
\"
>fail</a>
"
:
"
<a href=
\"
m/
"
+
type
.
successMessageUrl
+
"
\"
>success</a>
"
;
var
stat
=
""
+
type
.
min
+
"
/
"
+
type
.
max
+
"
/
"
+
type
.
avg
+
"
/
"
+
type
.
std
;
tabledata
.
push
({
"
type
"
:
typeurl
,
"
total
"
:
type
.
totalCount
,
"
fail
"
:
type
.
failCount
,
"
failPercent
"
:
type
.
failPercent
,
"
sample
"
:
sampleurl
,
"
stat
"
:
stat
});
}
}
}
);
...
...
@@ -20,37 +32,53 @@ domainLink = function(domain, now){
$
(
function
()
{
domainlinks
=
'
Domains:
'
;
nowdomain
=
data
[
"
domain
"
];
var
domainlinks
=
'
Domains:
'
;
var
nowdomain
=
data
[
"
domain
"
];
$
.
each
(
data
.
domains
,
function
(
i
,
t
){
domainlinks
+=
domainLink
(
t
,
nowdomain
)});
$
(
"
#domainlist
"
).
html
(
domainlinks
);
$
(
"
#reporttitle
"
).
html
(
"
Transaction Report - Domain:
"
+
nowdomain
);
var
grid
=
$
(
"
#gridtable
"
);
var
grid
=
$
(
"
#gridtable
"
);
var
colnames
;
var
colmodels
;
if
(
nowtype
==
""
)
{
colnames
=
[
'
Type
'
,
'
Total Count
'
,
'
Fail Count
'
,
'
Failure%
'
,
'
Sample Link
'
,
'
Min/Max/Avg/Std(ms)
'
];
colmodels
=
[
{
name
:
'
type
'
,
index
:
'
type
'
,
align
:
'
center
'
},
{
name
:
'
total
'
,
index
:
'
total
'
,
sorttype
:
"
int
"
,
align
:
'
center
'
},
{
name
:
'
fail
'
,
index
:
'
fail
'
,
sorttype
:
"
int
"
,
align
:
'
center
'
},
{
name
:
'
failPercent
'
,
index
:
'
failPercent
'
,
sorttype
:
"
float
"
,
align
:
'
center
'
},
{
name
:
'
sample
'
,
index
:
'
sample
'
,
sortable
:
false
,
align
:
'
center
'
},
{
name
:
'
stat
'
,
sortable
:
false
,
align
:
'
center
'
,
width
:
200
}
];
}
else
{
colnames
=
[
'
Name
'
,
'
Total Count
'
,
'
Fail Count
'
,
'
Failure%
'
,
'
Sample Link
'
,
'
Min/Max/Avg/Std(ms)
'
];
colmodels
=
[
{
name
:
'
name
'
,
index
:
'
name
'
,
align
:
'
center
'
},
{
name
:
'
total
'
,
index
:
'
total
'
,
sorttype
:
"
int
"
,
align
:
'
center
'
},
{
name
:
'
fail
'
,
index
:
'
fail
'
,
sorttype
:
"
int
"
,
align
:
'
center
'
},
{
name
:
'
failPercent
'
,
index
:
'
failPercent
'
,
sorttype
:
"
float
"
,
align
:
'
center
'
},
{
name
:
'
sample
'
,
index
:
'
sample
'
,
sortable
:
false
,
align
:
'
center
'
},
{
name
:
'
stat
'
,
sortable
:
false
,
align
:
'
center
'
,
width
:
200
}
];
}
grid
.
jqGrid
({
defaults
:
{
"
defaults
"
:
{
//shrinkToFit:true,
//forceFit:true,
},
datatype
:
"
local
"
,
colNames
:[
'
Type
'
,
'
Total Count
'
,
'
Fail Count
'
,
'
Failure%
'
,
'
Sample Link
'
,
'
Min/Max/Avg/Std(ms)
'
],
colModel
:[
{
name
:
'
type
'
,
index
:
'
type
'
,
align
:
'
center
'
},
{
name
:
'
total
'
,
index
:
'
total
'
,
sorttype
:
"
int
"
,
align
:
'
center
'
},
{
name
:
'
fail
'
,
index
:
'
fail
'
,
sorttype
:
"
int
"
,
align
:
'
center
'
},
{
name
:
'
failPercent
'
,
index
:
'
failPercent
'
,
sorttype
:
"
float
"
,
align
:
'
center
'
},
{
name
:
'
sample
'
,
index
:
'
sample
'
,
sortable
:
false
,
align
:
'
center
'
},
{
name
:
'
stat
'
,
sortable
:
false
,
align
:
'
center
'
,
width
:
200
}
],
sortname
:
'
type
'
,
sortorder
:
'
asc
'
,
caption
:
""
,
height
:
'
100%
'
,
autowidth
:
true
,
loadComplete
:
function
()
{
},
"
datatype
"
:
"
local
"
,
"
colNames
"
:
colnames
,
"
colModel
"
:
colmodels
,
"
sortname
"
:
'
type
'
,
"
sortorder
"
:
'
asc
'
,
"
caption
"
:
""
,
"
height
"
:
'
100%
'
,
"
autowidth
"
:
true
,
"
loadComplete
"
:
function
()
{
grid
.
setGridHeight
(
'
auto
'
);
//grid.setGridWidth('auto');
}
}).
navGrid
(
'
#pager2
'
,{
edit
:
false
,
add
:
false
,
del
:
false
});
//grid.setGridWidth('auto');
}
}).
navGrid
(
'
#pager2
'
,{
edit
:
false
,
add
:
false
,
del
:
false
});
for
(
var
i
=
0
;
i
<=
tabledata
.
length
;
i
++
)
{
...
...
cat-home/src/main/webapp/jsp/report/transaction.jsp
浏览文件 @
ca441a1d
...
...
@@ -23,6 +23,7 @@
<script
type=
"text/javascript"
>
var
data
=
$
{
model
.
reportInJson
};
var
nowtype
=
"
${model.type}
"
;
</script>
<table
width=
"100%"
border=
"0"
cellpadding=
"6"
cellspacing=
"0"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录