Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
0afaa089
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,发现更多精彩内容 >>
提交
0afaa089
编写于
3月 05, 2012
作者:
F
Frankie Wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
small change
上级
a1db878c
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
100 addition
and
57 deletion
+100
-57
cat-home/src/main/java/com/dianping/cat/report/graph/AbstractGraphPayload.java
...a/com/dianping/cat/report/graph/AbstractGraphPayload.java
+15
-0
cat-home/src/main/java/com/dianping/cat/report/graph/DefaultGraphBuilder.java
...va/com/dianping/cat/report/graph/DefaultGraphBuilder.java
+12
-7
cat-home/src/main/java/com/dianping/cat/report/graph/GraphPayload.java
...main/java/com/dianping/cat/report/graph/GraphPayload.java
+6
-0
cat-home/src/main/java/com/dianping/cat/report/page/transaction/Handler.java
...ava/com/dianping/cat/report/page/transaction/Handler.java
+43
-22
cat-home/src/main/webapp/css/transaction.css
cat-home/src/main/webapp/css/transaction.css
+0
-4
cat-home/src/main/webapp/js/transaction.js
cat-home/src/main/webapp/js/transaction.js
+15
-9
cat-home/src/main/webapp/jsp/report/transaction.jsp
cat-home/src/main/webapp/jsp/report/transaction.jsp
+1
-1
cat-home/src/main/webapp/jsp/report/transaction_graph.jsp
cat-home/src/main/webapp/jsp/report/transaction_graph.jsp
+1
-1
cat-home/src/main/webapp/jsp/report/transaction_graphs.jsp
cat-home/src/main/webapp/jsp/report/transaction_graphs.jsp
+7
-13
未找到文件。
cat-home/src/main/java/com/dianping/cat/report/graph/AbstractGraphPayload.java
浏览文件 @
0afaa089
...
...
@@ -86,6 +86,16 @@ public abstract class AbstractGraphPayload implements GraphPayload {
return
40
;
}
@Override
public
int
getOffsetX
()
{
return
0
;
}
@Override
public
int
getOffsetY
()
{
return
0
;
}
@Override
public
int
getRows
()
{
return
5
;
...
...
@@ -119,5 +129,10 @@ public abstract class AbstractGraphPayload implements GraphPayload {
return
getValues
().
length
>=
16
;
}
@Override
public
boolean
isStandalone
()
{
return
true
;
}
protected
abstract
double
[]
loadValues
();
}
cat-home/src/main/java/com/dianping/cat/report/graph/DefaultGraphBuilder.java
浏览文件 @
0afaa089
...
...
@@ -135,6 +135,8 @@ public class DefaultGraphBuilder implements GraphBuilder {
}
protected
void
buildHeader
(
GraphPayload
payload
,
XmlBuilder
b
,
int
maxValue
)
{
int
offsetX
=
payload
.
getOffsetX
();
int
offsetY
=
payload
.
getOffsetY
();
int
height
=
payload
.
getHeight
();
int
width
=
payload
.
getWidth
();
int
top
=
payload
.
getMarginTop
();
...
...
@@ -142,9 +144,12 @@ public class DefaultGraphBuilder implements GraphBuilder {
int
bottom
=
payload
.
getMarginBottom
();
int
right
=
payload
.
getMarginRight
();
if
(
payload
.
isStandalone
())
{
b
.
add
(
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\r\n"
);
b
.
tag1
(
"svg"
,
"width"
,
payload
.
getDisplayWidth
(),
"height"
,
payload
.
getDisplayHeight
(),
"viewBox"
,
"0,0,"
+
width
+
","
+
height
,
"xmlns"
,
"http://www.w3.org/2000/svg"
);
}
b
.
tag1
(
"svg"
,
"x"
,
offsetX
,
"y"
,
offsetY
,
"width"
,
payload
.
getDisplayWidth
(),
"height"
,
payload
.
getDisplayHeight
(),
"viewBox"
,
"0,0,"
+
width
+
","
+
height
,
"xmlns"
,
"http://www.w3.org/2000/svg"
);
String
title
=
payload
.
getTitle
();
...
...
@@ -217,9 +222,9 @@ public class DefaultGraphBuilder implements GraphBuilder {
if
(
rotated
)
{
String
transform
=
"rotate(90,"
+
x
+
","
+
y
+
")"
;
b
.
tagWithText
(
"text"
,
label
,
"x"
,
x
,
"y"
,
y
,
"transform"
,
transform
);
b
.
tagWithText
(
"text"
,
label
,
"x"
,
x
,
"y"
,
y
,
"
font-size"
,
"14"
,
"
transform"
,
transform
);
}
else
{
b
.
tagWithText
(
"text"
,
label
,
"x"
,
x
,
"y"
,
y
);
b
.
tagWithText
(
"text"
,
label
,
"x"
,
x
,
"y"
,
y
,
"font-size"
,
"14"
);
}
if
(
skipped
)
{
...
...
@@ -248,14 +253,14 @@ public class DefaultGraphBuilder implements GraphBuilder {
int
x
=
left
-
12
;
int
y
=
top
+
4
+
ystep
*
i
;
b
.
tagWithText
(
"text"
,
maxValue
-
maxValue
/
rows
*
i
,
"x"
,
x
,
"y"
,
y
);
b
.
tagWithText
(
"text"
,
maxValue
-
maxValue
/
rows
*
i
,
"x"
,
x
,
"y"
,
y
,
"font-size"
,
"14"
);
}
}
else
{
for
(
int
i
=
0
;
i
<
rows
;
i
++)
{
int
x
=
left
-
9
;
int
y
=
top
+
4
+
ystep
*
i
;
b
.
tagWithText
(
"text"
,
maxValue
-
maxValue
/
rows
*
i
,
"x"
,
x
,
"y"
,
y
);
b
.
tagWithText
(
"text"
,
maxValue
-
maxValue
/
rows
*
i
,
"x"
,
x
,
"y"
,
y
,
"font-size"
,
"14"
);
}
}
...
...
cat-home/src/main/java/com/dianping/cat/report/graph/GraphPayload.java
浏览文件 @
0afaa089
...
...
@@ -27,6 +27,10 @@ public interface GraphPayload {
public
int
getMarginTop
();
public
int
getOffsetX
();
public
int
getOffsetY
();
public
int
getRows
();
public
String
getTitle
();
...
...
@@ -38,4 +42,6 @@ public interface GraphPayload {
public
boolean
isAxisXLabelRotated
();
public
boolean
isAxisXLabelSkipped
();
public
boolean
isStandalone
();
}
cat-home/src/main/java/com/dianping/cat/report/page/transaction/Handler.java
浏览文件 @
0afaa089
...
...
@@ -148,8 +148,12 @@ public class Handler implements PageHandler<Context>, Initializable {
}
abstract
class
AbstractPayload
extends
AbstractGraphPayload
{
public
AbstractPayload
(
String
title
,
String
axisXLabel
,
String
axisYLabel
)
{
private
final
TransactionName
m_name
;
public
AbstractPayload
(
String
title
,
String
axisXLabel
,
String
axisYLabel
,
TransactionName
name
)
{
super
(
title
,
axisXLabel
,
axisYLabel
);
m_name
=
name
;
}
@Override
...
...
@@ -167,27 +171,41 @@ public class Handler implements PageHandler<Context>, Initializable {
return
(
int
)
(
super
.
getDisplayWidth
()
*
0.7
);
}
protected
TransactionName
getTransactionName
()
{
return
m_name
;
}
@Override
public
int
getWidth
()
{
return
super
.
getWidth
()
+
120
;
}
@Override
public
boolean
isStandalone
()
{
return
false
;
}
final
class
AverageTimePayload
extends
AbstractPayload
{
private
final
TransactionName
m_name
;
@Override
public
String
getIdPrefix
()
{
return
m_name
.
getId
()
+
"-"
+
super
.
getIdPrefix
();
}
}
final
class
AverageTimePayload
extends
AbstractPayload
{
public
AverageTimePayload
(
String
title
,
String
axisXLabel
,
String
axisYLabel
,
TransactionName
name
)
{
super
(
title
,
axisXLabel
,
axisYLabel
);
super
(
title
,
axisXLabel
,
axisYLabel
,
name
);
}
m_name
=
name
;
@Override
public
int
getOffsetY
()
{
return
getDisplayHeight
()
+
20
;
}
@Override
protected
double
[]
loadValues
()
{
double
[]
values
=
new
double
[
12
];
for
(
Range
range
:
m_name
.
getRanges
())
{
for
(
Range
range
:
getTransactionName
()
.
getRanges
())
{
int
value
=
range
.
getValue
();
int
k
=
value
/
5
;
...
...
@@ -199,12 +217,8 @@ public class Handler implements PageHandler<Context>, Initializable {
}
final
class
DurationPayload
extends
AbstractPayload
{
private
final
TransactionName
m_name
;
public
DurationPayload
(
String
title
,
String
axisXLabel
,
String
axisYLabel
,
TransactionName
name
)
{
super
(
title
,
axisXLabel
,
axisYLabel
);
m_name
=
name
;
super
(
title
,
axisXLabel
,
axisYLabel
,
name
);
}
@Override
...
...
@@ -236,7 +250,7 @@ public class Handler implements PageHandler<Context>, Initializable {
protected
double
[]
loadValues
()
{
double
[]
values
=
new
double
[
17
];
for
(
Duration
duration
:
m_name
.
getDurations
())
{
for
(
Duration
duration
:
getTransactionName
()
.
getDurations
())
{
int
d
=
duration
.
getValue
();
Integer
k
=
m_map
.
get
(
d
);
...
...
@@ -250,19 +264,25 @@ public class Handler implements PageHandler<Context>, Initializable {
}
final
class
FailurePayload
extends
AbstractPayload
{
private
final
TransactionName
m_name
;
public
FailurePayload
(
String
title
,
String
axisXLabel
,
String
axisYLabel
,
TransactionName
name
)
{
super
(
title
,
axisXLabel
,
axisYLabel
);
super
(
title
,
axisXLabel
,
axisYLabel
,
name
);
}
m_name
=
name
;
@Override
public
int
getOffsetX
()
{
return
getDisplayWidth
();
}
@Override
public
int
getOffsetY
()
{
return
getDisplayHeight
()
+
20
;
}
@Override
protected
double
[]
loadValues
()
{
double
[]
values
=
new
double
[
12
];
for
(
Range
range
:
m_name
.
getRanges
())
{
for
(
Range
range
:
getTransactionName
()
.
getRanges
())
{
int
value
=
range
.
getValue
();
int
k
=
value
/
5
;
...
...
@@ -274,19 +294,20 @@ public class Handler implements PageHandler<Context>, Initializable {
}
final
class
HitPayload
extends
AbstractPayload
{
private
final
TransactionName
m_name
;
public
HitPayload
(
String
title
,
String
axisXLabel
,
String
axisYLabel
,
TransactionName
name
)
{
super
(
title
,
axisXLabel
,
axisYLabel
);
super
(
title
,
axisXLabel
,
axisYLabel
,
name
);
}
m_name
=
name
;
@Override
public
int
getOffsetX
()
{
return
getDisplayWidth
();
}
@Override
protected
double
[]
loadValues
()
{
double
[]
values
=
new
double
[
12
];
for
(
Range
range
:
m_name
.
getRanges
())
{
for
(
Range
range
:
getTransactionName
()
.
getRanges
())
{
int
value
=
range
.
getValue
();
int
k
=
value
/
5
;
...
...
cat-home/src/main/webapp/css/transaction.css
浏览文件 @
0afaa089
...
...
@@ -43,7 +43,3 @@ tr.link td {
.error
{
color
:
red
;
}
.graphs
{
height
:
1px
;
}
\ No newline at end of file
cat-home/src/main/webapp/js/transaction.js
浏览文件 @
0afaa089
...
...
@@ -5,6 +5,9 @@ function showGraphs(anchor, id, domain, type, name) {
if
(
text
==
'
[:: show ::]
'
)
{
anchor
.
innerHTML
=
'
[:: hide ::]
'
;
if
(
cell
.
nodeName
==
'
IMG
'
)
{
// <img src='...'/>
cell
.
src
=
"
?op=graphs&domain=
"
+
domain
+
"
&type=
"
+
type
+
"
&name=
"
+
name
;
}
else
{
// <div>...</div>
$
.
ajax
({
type
:
"
get
"
,
url
:
"
?op=graphs&domain=
"
+
domain
+
"
&type=
"
+
type
+
"
&name=
"
+
name
,
...
...
@@ -12,10 +15,13 @@ function showGraphs(anchor, id, domain, type, name) {
cell
.
innerHTML
=
data
;
}
});
}
cell
.
style
.
display
=
'
block
'
;
cell
.
parentNode
.
style
.
display
=
'
block
'
;
}
else
{
anchor
.
innerHTML
=
'
[:: show ::]
'
;
cell
.
style
.
display
=
'
none
'
;
cell
.
parentNode
.
style
.
display
=
'
none
'
;
}
...
...
cat-home/src/main/webapp/jsp/report/transaction.jsp
浏览文件 @
0afaa089
...
...
@@ -45,7 +45,7 @@
<td><a
href=
"${model.logViewBaseUri}/${empty e.failMessageUrl ? e.successMessageUrl : e.failMessageUrl}"
>
Log View
</a></td>
<td>
${w:format(e.min,'0')}/${w:format(e.max,'0')}/${w:format(e.avg,'0.0')}/${w:format(e.std,'0.0')}
</td>
</tr>
<tr
class=
"graphs"
><td
colspan=
"6"
><div
id=
"${status.index}"
></div></td></tr>
<tr
class=
"graphs"
><td
colspan=
"6"
><div
id=
"${status.index}"
style=
"display:none"
></div></td></tr>
</c:forEach>
</c:otherwise>
</c:choose>
...
...
cat-home/src/main/webapp/jsp/report/transaction_graph.jsp
浏览文件 @
0afaa089
<%@ page
contentType=
"image/svg+xml; charset=utf-8"
%>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
width=
"600"
height=
"300"
xmlns=
"http://www.w3.org/2000/svg"
>
<svg
version=
"1.1"
width=
"600"
height=
"300"
xmlns=
"http://www.w3.org/2000/svg"
>
<title>
Duration
</title>
<g
id=
"coordinate"
stroke=
"#003f7f"
fill=
"white"
>
<path
id=
"xy"
d=
"M90,200 h480 m-480,0 v-150"
/>
...
...
cat-home/src/main/webapp/jsp/report/transaction_graphs.jsp
浏览文件 @
0afaa089
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<jsp:useBean
id=
"ctx"
type=
"com.dianping.cat.report.page.transaction.Context"
scope=
"request"
/>
<jsp:useBean
id=
"payload"
type=
"com.dianping.cat.report.page.transaction.Payload"
scope=
"request"
/>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<jsp:useBean
id=
"model"
type=
"com.dianping.cat.report.page.transaction.Model"
scope=
"request"
/>
<table>
<tr>
<td>
${model.graph1}
</td>
<td>
${model.graph2}
</td>
</tr>
<tr>
<td>
${model.graph3}
</td>
<td>
${model.graph4}
</td>
</tr>
</table>
<svg
version=
"1.1"
width=
"980"
height=
"380"
xmlns=
"http://www.w3.org/2000/svg"
>
${model.graph1}
${model.graph2}
${model.graph3}
${model.graph4}
</svg>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录