Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
7f56aaf6
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,发现更多精彩内容 >>
提交
7f56aaf6
编写于
8月 06, 2013
作者:
F
Frankie Wu
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #119 from youyong205/biz
add bug report
上级
6c4561d5
208fc7f5
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
147 addition
and
28 deletion
+147
-28
cat-home/pom.xml
cat-home/pom.xml
+3
-1
cat-home/src/main/java/com/dianping/cat/report/page/metric/MetricDisplay.java
...va/com/dianping/cat/report/page/metric/MetricDisplay.java
+18
-18
cat-home/src/main/resources/META-INF/dal/model/bug-codegen.xml
...ome/src/main/resources/META-INF/dal/model/bug-codegen.xml
+22
-0
cat-home/src/main/resources/META-INF/dal/model/bug-config-codegen.xml
.../main/resources/META-INF/dal/model/bug-config-codegen.xml
+16
-0
cat-home/src/main/resources/META-INF/dal/model/bug-config-manifest.xml
...main/resources/META-INF/dal/model/bug-config-manifest.xml
+6
-0
cat-home/src/main/resources/META-INF/dal/model/bug-config-model.xml
...rc/main/resources/META-INF/dal/model/bug-config-model.xml
+4
-0
cat-home/src/main/resources/META-INF/dal/model/bug-manifest.xml
...me/src/main/resources/META-INF/dal/model/bug-manifest.xml
+6
-0
cat-home/src/main/resources/META-INF/dal/model/bug-model.xml
cat-home/src/main/resources/META-INF/dal/model/bug-model.xml
+4
-0
cat-home/src/main/resources/META-INF/wizard/model/wizard.xml
cat-home/src/main/resources/META-INF/wizard/model/wizard.xml
+6
-0
cat-home/src/main/resources/config/default-exception-threshold-config.xml
...n/resources/config/default-exception-threshold-config.xml
+1
-0
cat-home/src/main/webapp/jsp/report/dependency/dependencyDashboard.jsp
...main/webapp/jsp/report/dependency/dependencyDashboard.jsp
+3
-3
cat-home/src/test/java/com/dianping/cat/demo/TestBusinessMessage.java
.../test/java/com/dianping/cat/demo/TestBusinessMessage.java
+18
-3
cat-home/src/test/java/com/dianping/cat/demo/TestSendMessage.java
.../src/test/java/com/dianping/cat/demo/TestSendMessage.java
+14
-3
cat-home/src/test/resources/com/dianping/cat/report/page/bug/bug-config.xml
...resources/com/dianping/cat/report/page/bug/bug-config.xml
+12
-0
cat-home/src/test/resources/com/dianping/cat/report/page/bug/bug.xml
...c/test/resources/com/dianping/cat/report/page/bug/bug.xml
+14
-0
未找到文件。
cat-home/pom.xml
浏览文件 @
7f56aaf6
...
...
@@ -184,7 +184,9 @@
${basedir}/src/main/resources/META-INF/dal/model/topology-graph-config-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/info-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/exception-threshold-config-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/threshold-template-manifest.xml,
</manifest>
${basedir}/src/main/resources/META-INF/dal/model/threshold-template-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/bug-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/bug-config-manifest.xml,
</manifest>
</configuration>
</execution>
<execution>
...
...
cat-home/src/main/java/com/dianping/cat/report/page/metric/MetricDisplay.java
浏览文件 @
7f56aaf6
...
...
@@ -48,7 +48,7 @@ public class MetricDisplay extends BaseVisitor{
private
static
final
String
AVG
=
MetricType
.
AVG
.
name
();
private
static
final
int
INTERVAL
=
1
0
;
private
static
final
int
INTERVAL
=
1
;
private
static
final
int
HOUR
=
24
;
...
...
@@ -224,7 +224,7 @@ public class MetricDisplay extends BaseVisitor{
if
(
day
==
null
)
{
continue
;
}
value
[
i
]
=
avgOfArray
(
day
,
j
)
;
value
[
i
]
=
day
[
j
]
;
}
lineChart
.
addSubTitle
(
"Baseline"
);
lineChart
.
addValue
(
value
);
...
...
@@ -249,7 +249,7 @@ public class MetricDisplay extends BaseVisitor{
resultMap
.
put
(
subTitle
,
newValue
);
}
for
(
int
j
=
0
;
j
<
MINUTE
/
INTERVAL
;
j
++)
{
newValue
[
index
*
6
+
j
]
=
avgOfArray
(
value
,
j
*
INTERVAL
)
;
newValue
[
index
*
MINUTE
/
INTERVAL
+
j
]
=
value
[
j
*
INTERVAL
]
;
}
i
++;
}
...
...
@@ -262,21 +262,21 @@ public class MetricDisplay extends BaseVisitor{
}
}
private
double
avgOfArray
(
double
[]
values
,
int
j
){
double
result
=
0
;
int
size
=
0
;
for
(
int
i
=
j
;
i
<
j
+
INTERVAL
;
i
++){
if
(
values
[
i
]
>=
0
){
result
+=
values
[
i
];
size
++;
}
}
if
(
size
==
0
){
return
result
;
}
else
{
return
result
/
size
;
}
}
//
private double avgOfArray(double[]values, int j){
//
double result = 0;
//
int size = 0;
//
for(int i = j; i < j+INTERVAL; i++){
//
if(values[i] >= 0){
//
result +=values[i];
//
size ++;
//
}
//
}
//
if(size == 0){
//
return result;
//
} else{
//
return result /size;
//
}
//
}
public
void
setBaselineService
(
BaselineService
baselineService
)
{
m_baselineService
=
baselineService
;
...
...
cat-home/src/main/resources/META-INF/dal/model/bug-codegen.xml
0 → 100644
浏览文件 @
7f56aaf6
<?xml version="1.0" encoding="UTF-8"?>
<model>
<entity
name=
"bug-report"
root=
"true"
>
<attribute
name=
"startTime"
value-type=
"Date"
format=
"yyyy-MM-dd HH:mm:ss"
/>
<attribute
name=
"endTime"
value-type=
"Date"
format=
"yyyy-MM-dd HH:mm:ss"
/>
<entity-ref
name=
"domain"
type=
"list"
names=
"domains"
/>
</entity>
<entity
name=
"domain"
>
<attribute
name=
"id"
value-type=
"String"
/>
<element
name=
"excpetion"
value-type=
"String"
/>
<entity-ref
name=
"exception"
/>
</entity>
<entity
name=
"exception"
>
<attribute
name=
"id"
value-type=
"String"
/>
<attribute
name=
"count"
value-type=
"int"
/>
<entity-ref
name=
"message"
type=
"list"
names=
"messages"
/>
</entity>
<entity
name=
"message"
>
<attribute
name=
"id"
value-type=
"String"
/>
</entity>
</model>
cat-home/src/main/resources/META-INF/dal/model/bug-config-codegen.xml
0 → 100644
浏览文件 @
7f56aaf6
<?xml version="1.0" encoding="UTF-8"?>
<model>
<entity
name=
"bug-config"
root=
"true"
>
<entity-ref
name=
"exception"
type=
"list"
names=
"exceptions"
/>
<entity-ref
name=
"domain"
/>
</entity>
<entity
name=
"exception"
>
<attribute
name=
"id"
value-type=
"String"
/>
</entity>
<entity
name=
"domain"
>
<attribute
name=
"id"
value-type=
"String"
/>
<attribute
name=
"additivity"
value-type=
"boolean"
/>
<entity-ref
name=
"exception"
type=
"list"
names=
"exceptions"
/>
</entity>
</model>
cat-home/src/main/resources/META-INF/dal/model/bug-config-manifest.xml
0 → 100644
浏览文件 @
7f56aaf6
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<file
path=
"bug-config-codegen.xml"
/>
<file
path=
"bug-config-model.xml"
/>
</manifest>
cat-home/src/main/resources/META-INF/dal/model/bug-config-model.xml
0 → 100644
浏览文件 @
7f56aaf6
<?xml version="1.0" encoding="UTF-8"?>
<model
model-package=
"com.dianping.cat.home.bug.config"
enable-merger=
"true"
enable-sax-parser=
"true"
enable-base-visitor=
"true"
>
</model>
cat-home/src/main/resources/META-INF/dal/model/bug-manifest.xml
0 → 100644
浏览文件 @
7f56aaf6
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<file
path=
"bug-codegen.xml"
/>
<file
path=
"bug-model.xml"
/>
</manifest>
cat-home/src/main/resources/META-INF/dal/model/bug-model.xml
0 → 100644
浏览文件 @
7f56aaf6
<?xml version="1.0" encoding="UTF-8"?>
<model
model-package=
"com.dianping.cat.home.bug"
enable-merger=
"true"
enable-sax-parser=
"true"
enable-base-visitor=
"true"
>
</model>
cat-home/src/main/resources/META-INF/wizard/model/wizard.xml
浏览文件 @
7f56aaf6
...
...
@@ -12,4 +12,10 @@
<model
package=
"com.dianping.cat.home.exception-threshold"
name=
"exception-threshold-config"
>
<sample-model>
src/test/resources/com/dianping/cat/report/page/dependency/exception-threshold-config.xml
</sample-model>
</model>
<model
package=
"com.dianping.cat.home.bug"
name=
"bug"
>
<sample-model>
src/test/resources/com/dianping/cat/report/page/bug/bug.xml
</sample-model>
</model>
<model
package=
"com.dianping.cat.home.bug.config"
name=
"bug-config"
>
<sample-model>
src/test/resources/com/dianping/cat/report/page/bug/bug-config.xml
</sample-model>
</model>
</wizard>
cat-home/src/main/resources/config/default-exception-threshold-config.xml
浏览文件 @
7f56aaf6
...
...
@@ -7,3 +7,4 @@
<domain-config
id =
"Cat"
></domain-config>
</exception-threshold-config>
cat-home/src/main/webapp/jsp/report/dependency/dependencyDashboard.jsp
浏览文件 @
7f56aaf6
...
...
@@ -119,10 +119,10 @@
col
:
3
,
colInside
:
5
,
//模块距上沿距离
paddingUp
:
0
,
paddingUp
:
1
0
,
//小方块间的间隔比率
blockPaddingRatio
:
0.
5
,
leftTitlePaddingRatio
:
0.5
,
blockPaddingRatio
:
0.
2
,
leftTitlePaddingRatio
:
0.
0
5
,
showLeft
:
true
,
showUp
:
false
});
...
...
cat-home/src/test/java/com/dianping/cat/demo/TestBusinessMessage.java
浏览文件 @
7f56aaf6
...
...
@@ -6,6 +6,7 @@ import com.dianping.cat.Cat;
import
com.dianping.cat.message.Event
;
import
com.dianping.cat.message.Transaction
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.internal.DefaultMessageTree
;
public
class
TestBusinessMessage
{
private
static
final
String
TuanGou
=
"TuanGouWeb"
;
...
...
@@ -63,7 +64,6 @@ public class TestBusinessMessage {
t
.
complete
();
}
Thread
.
sleep
(
1000
);
}
}
...
...
@@ -98,4 +98,19 @@ public class TestBusinessMessage {
}
}
@Test
public
void
test3
()
throws
InterruptedException
{
for
(
int
i
=
0
;
i
<
500
;
i
++)
{
Transaction
t
=
Cat
.
newTransaction
(
"test"
,
"test"
);
Cat
.
logMetricForCount
(
"MemberCardSuccess"
);
Cat
.
logMetricForCount
(
"MemberCardFail"
,
2
);
MessageTree
tree
=
Cat
.
getManager
().
getThreadLocalMessageTree
();
((
DefaultMessageTree
)
tree
).
setDomain
(
"MobileMembercardMainApiWeb"
);
t
.
complete
();
}
Thread
.
sleep
(
100000
);
}
}
cat-home/src/test/java/com/dianping/cat/demo/TestSendMessage.java
浏览文件 @
7f56aaf6
...
...
@@ -11,11 +11,22 @@ public class TestSendMessage {
@Test
public
void
sendException
()
throws
Exception
{
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
Cat
.
getProducer
().
logError
(
new
OutOfMemoryError
());
Cat
.
getProducer
().
logError
(
new
NullPointerException
());
Transaction
t
=
Cat
.
newTransaction
(
"Midas"
,
"XXName"
);
try
{
//your bussiness code
//for see the message on cat in problem report
t
.
setStatus
(
"Fail"
);
}
catch
(
Exception
e
){
t
.
setStatus
(
Transaction
.
SUCCESS
);
Cat
.
logError
(
e
);
throw
e
;
}
finally
{
t
.
complete
();
}
Thread
.
sleep
(
1000
);
}
Thread
.
sleep
(
10000
);
}
@Test
...
...
cat-home/src/test/resources/com/dianping/cat/report/page/bug/bug-config.xml
0 → 100644
浏览文件 @
7f56aaf6
<?xml version="1.0" encoding="utf-8"?>
<bug-config>
<exception
id=
"NetTimexception"
/>
<exception
id=
"NetTimexception2"
/>
<exception
id=
"exception"
/>
<exception
id=
"exception"
/>
<domain
id=
"Cat"
additivity=
"false"
>
<exception
id=
"exception"
/>
<exception
id=
"exception"
/>
<exception
id=
"exception"
/>
</domain>
</bug-config>
\ No newline at end of file
cat-home/src/test/resources/com/dianping/cat/report/page/bug/bug.xml
0 → 100644
浏览文件 @
7f56aaf6
<?xml version="1.0" encoding="utf-8"?>
<bug-report
startTime=
"2012-05-16 16:00:00"
endTime=
"2012-05-16 16:59:59"
>
<domain
id=
"Cat"
>
<exception
id=
"NPE"
count=
"123"
>
<message
id=
"http://cat.dianpingoa.com/cat/r/ShopServer"
></message>
<message
id=
"http://cat.dianpingoa.com/cat/r/ShopServer"
></message>
<message
id=
"http://cat.dianpingoa.com/cat/r/ShopServer"
></message>
</exception>
<excpetion></excpetion>
</domain>
<domain>
</domain>
</bug-report>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录