Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
80d8dc2f
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,发现更多精彩内容 >>
提交
80d8dc2f
编写于
8月 11, 2013
作者:
Y
yong.you
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add the bug page
上级
6f6c2343
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
457 addition
and
41 deletion
+457
-41
cat-home/src/main/java/com/dianping/cat/report/page/bug/Handler.java
...c/main/java/com/dianping/cat/report/page/bug/Handler.java
+197
-8
cat-home/src/main/java/com/dianping/cat/report/page/bug/Model.java
...src/main/java/com/dianping/cat/report/page/bug/Model.java
+29
-5
cat-home/src/main/java/com/dianping/cat/report/task/bug/BugReportBuilder.java
...va/com/dianping/cat/report/task/bug/BugReportBuilder.java
+19
-0
cat-home/src/main/java/com/dianping/cat/report/task/bug/BugReportMerger.java
...ava/com/dianping/cat/report/task/bug/BugReportMerger.java
+2
-2
cat-home/src/main/java/com/dianping/cat/report/task/bug/ProblemReportVisitor.java
...om/dianping/cat/report/task/bug/ProblemReportVisitor.java
+1
-1
cat-home/src/main/java/com/dianping/cat/report/view/NavigationBar.java
...main/java/com/dianping/cat/report/view/NavigationBar.java
+2
-0
cat-home/src/main/java/com/dianping/cat/system/config/BugConfigManager.java
...java/com/dianping/cat/system/config/BugConfigManager.java
+6
-6
cat-home/src/main/resources/META-INF/plexus/components.xml
cat-home/src/main/resources/META-INF/plexus/components.xml
+16
-10
cat-home/src/main/resources/META-INF/wizard/webapp/wizard.xml
...home/src/main/resources/META-INF/wizard/webapp/wizard.xml
+1
-1
cat-home/src/main/resources/config/default-bug-config.xml
cat-home/src/main/resources/config/default-bug-config.xml
+1
-1
cat-home/src/main/webapp/jsp/report/bug.jsp
cat-home/src/main/webapp/jsp/report/bug.jsp
+0
-5
cat-home/src/main/webapp/jsp/report/bug/bug.jsp
cat-home/src/main/webapp/jsp/report/bug/bug.jsp
+35
-0
cat-home/src/main/webapp/jsp/report/bug/bugHistory.jsp
cat-home/src/main/webapp/jsp/report/bug/bugHistory.jsp
+47
-0
cat-home/src/main/webapp/jsp/report/bug/detail.jsp
cat-home/src/main/webapp/jsp/report/bug/detail.jsp
+51
-0
cat-home/src/test/java/com/dianping/cat/report/analyzer/ExceptionAnalyzer.java
...a/com/dianping/cat/report/analyzer/ExceptionAnalyzer.java
+2
-2
cat-home/src/test/resources/com/dianping/cat/report/page/bug/testbug.xml
...st/resources/com/dianping/cat/report/page/bug/testbug.xml
+48
-0
未找到文件。
cat-home/src/main/java/com/dianping/cat/report/page/bug/Handler.java
浏览文件 @
80d8dc2f
package
com.dianping.cat.report.page.bug
;
import
java.io.IOException
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
javax.servlet.ServletException
;
import
com.dianping.cat.consumer.advanced.ProductLineConfigManager
;
import
com.dianping.cat.helper.CatString
;
import
com.dianping.cat.helper.TimeUtil
;
import
com.dianping.cat.home.bug.entity.BugReport
;
import
com.dianping.cat.report.ReportPage
;
import
com.dianping.cat.report.service.ReportService
;
import
org.unidal.dal.jdbc.DalException
;
import
org.unidal.lookup.annotation.Inject
;
import
org.unidal.web.mvc.PageHandler
;
import
org.unidal.web.mvc.annotation.InboundActionMeta
;
import
org.unidal.web.mvc.annotation.OutboundActionMeta
;
import
org.unidal.web.mvc.annotation.PayloadMeta
;
import
com.dianping.cat.core.dal.Project
;
import
com.dianping.cat.core.dal.ProjectDao
;
import
com.dianping.cat.core.dal.ProjectEntity
;
import
com.dianping.cat.helper.CatString
;
import
com.dianping.cat.helper.MapUtils
;
import
com.dianping.cat.helper.TimeUtil
;
import
com.dianping.cat.home.bug.entity.BugReport
;
import
com.dianping.cat.home.bug.entity.Domain
;
import
com.dianping.cat.home.bug.entity.ExceptionItem
;
import
com.dianping.cat.home.bug.transform.BaseVisitor
;
import
com.dianping.cat.report.ReportPage
;
import
com.dianping.cat.report.page.PayloadNormalizer
;
import
com.dianping.cat.report.service.ReportService
;
import
com.dianping.cat.system.config.BugConfigManager
;
public
class
Handler
implements
PageHandler
<
Context
>
{
@Inject
private
JspViewer
m_jspViewer
;
...
...
@@ -26,7 +40,23 @@ public class Handler implements PageHandler<Context> {
private
ReportService
m_reportService
;
@Inject
private
ProductLineConfigManager
m_configManager
;
private
ProjectDao
m_projectDao
;
@Inject
private
BugConfigManager
m_bugConfigManager
;
@Inject
private
PayloadNormalizer
m_normalizePayload
;
public
Project
findByDomain
(
String
domain
)
{
try
{
return
m_projectDao
.
findByDomain
(
domain
,
ProjectEntity
.
READSET_FULL
);
}
catch
(
DalException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
@Override
@PayloadMeta
(
Payload
.
class
)
...
...
@@ -39,11 +69,29 @@ public class Handler implements PageHandler<Context> {
@OutboundActionMeta
(
name
=
"bug"
)
public
void
handleOutbound
(
Context
ctx
)
throws
ServletException
,
IOException
{
Model
model
=
new
Model
(
ctx
);
Payload
payload
=
ctx
.
getPayload
();
m_normalizePayload
.
normalize
(
model
,
payload
);
BugReport
bugReport
=
queryBugReport
(
payload
);
BugReportVisitor
visitor
=
new
BugReportVisitor
();
visitor
.
visitBugReport
(
bugReport
);
Map
<
String
,
ErrorStatis
>
errors
=
visitor
.
getErrors
();
sortErrorStatis
(
errors
);
model
.
setBugReport
(
bugReport
);
model
.
setErrorStatis
(
errors
);
model
.
setAction
(
payload
.
getAction
());
model
.
setPage
(
ReportPage
.
BUG
);
m_jspViewer
.
view
(
ctx
,
model
);
}
private
boolean
isBug
(
String
domain
,
String
exception
)
{
Set
<
String
>
bugConfig
=
m_bugConfigManager
.
queryBugConfigsByDomain
(
domain
);
return
bugConfig
.
contains
(
exception
);
}
private
BugReport
queryBugReport
(
Payload
payload
)
{
Date
start
=
null
;
Date
end
=
null
;
...
...
@@ -57,4 +105,145 @@ public class Handler implements PageHandler<Context> {
return
m_reportService
.
queryBugReport
(
CatString
.
CAT
,
start
,
end
);
}
private
void
sortErrorStatis
(
Map
<
String
,
ErrorStatis
>
errors
)
{
errors
=
MapUtils
.
sortMap
(
errors
,
new
Comparator
<
java
.
util
.
Map
.
Entry
<
String
,
ErrorStatis
>>()
{
@Override
public
int
compare
(
java
.
util
.
Map
.
Entry
<
String
,
ErrorStatis
>
o1
,
java
.
util
.
Map
.
Entry
<
String
,
ErrorStatis
>
o2
)
{
String
department1
=
o1
.
getValue
().
getDepartment
();
String
department2
=
o2
.
getValue
().
getDepartment
();
String
productLine1
=
o1
.
getValue
().
getProductLine
();
String
productLine2
=
o2
.
getValue
().
getProductLine
();
if
(
department1
.
equals
(
department2
))
{
return
productLine1
.
compareTo
(
productLine2
);
}
return
department1
.
compareTo
(
department2
);
}
});
for
(
ErrorStatis
temp
:
errors
.
values
())
{
Comparator
<
java
.
util
.
Map
.
Entry
<
String
,
ExceptionItem
>>
compator
=
new
Comparator
<
java
.
util
.
Map
.
Entry
<
String
,
ExceptionItem
>>()
{
@Override
public
int
compare
(
java
.
util
.
Map
.
Entry
<
String
,
ExceptionItem
>
o1
,
java
.
util
.
Map
.
Entry
<
String
,
ExceptionItem
>
o2
)
{
return
o2
.
getValue
().
getCount
()
-
o1
.
getValue
().
getCount
();
}
};
Map
<
String
,
ExceptionItem
>
bugs
=
temp
.
getBugs
();
Map
<
String
,
ExceptionItem
>
exceptions
=
temp
.
getExceptions
();
temp
.
setBugs
(
MapUtils
.
sortMap
(
bugs
,
compator
));
temp
.
setExceptions
(
MapUtils
.
sortMap
(
exceptions
,
compator
));
}
}
public
class
BugReportVisitor
extends
BaseVisitor
{
private
String
m_domain
;
private
Map
<
String
,
ErrorStatis
>
m_errors
=
new
HashMap
<
String
,
ErrorStatis
>();
public
ErrorStatis
findOrCreateErrorStatis
(
String
productLine
)
{
ErrorStatis
statis
=
m_errors
.
get
(
productLine
);
if
(
statis
==
null
)
{
statis
=
new
ErrorStatis
();
m_errors
.
put
(
productLine
,
statis
);
}
return
statis
;
}
public
Map
<
String
,
ErrorStatis
>
getErrors
()
{
return
m_errors
;
}
@Override
public
void
visitDomain
(
Domain
domain
)
{
m_domain
=
domain
.
getId
();
super
.
visitDomain
(
domain
);
}
@Override
public
void
visitExceptionItem
(
ExceptionItem
exceptionItem
)
{
String
exception
=
exceptionItem
.
getId
();
int
count
=
exceptionItem
.
getCount
();
Project
project
=
findByDomain
(
m_domain
);
if
(
project
!=
null
)
{
String
productLine
=
project
.
getProjectLine
();
ErrorStatis
statis
=
findOrCreateErrorStatis
(
productLine
);
statis
.
setDepartment
(
project
.
getDepartment
());
statis
.
setProductLine
(
project
.
getProjectLine
());
Map
<
String
,
ExceptionItem
>
exceptions
=
null
;
if
(
isBug
(
m_domain
,
exception
))
{
exceptions
=
statis
.
getBugs
();
}
else
{
exceptions
=
statis
.
getExceptions
();
}
ExceptionItem
item
=
exceptions
.
get
(
exception
);
if
(
item
==
null
)
{
item
=
new
ExceptionItem
(
exception
);
item
.
setCount
(
count
);
item
.
getMessages
().
addAll
(
exceptionItem
.
getMessages
());
exceptions
.
put
(
exception
,
item
);
}
else
{
List
<
String
>
messages
=
item
.
getMessages
();
item
.
setCount
(
item
.
getCount
()
+
count
);
messages
.
addAll
(
exceptionItem
.
getMessages
());
if
(
messages
.
size
()
>
10
)
{
messages
=
messages
.
subList
(
0
,
10
);
}
}
}
}
}
public
static
class
ErrorStatis
{
private
String
m_productLine
;
private
String
m_department
;
private
Map
<
String
,
ExceptionItem
>
m_bugs
=
new
HashMap
<
String
,
ExceptionItem
>();
private
Map
<
String
,
ExceptionItem
>
m_exceptions
=
new
HashMap
<
String
,
ExceptionItem
>();
public
Map
<
String
,
ExceptionItem
>
getBugs
()
{
return
m_bugs
;
}
public
String
getDepartment
()
{
return
m_department
;
}
public
Map
<
String
,
ExceptionItem
>
getExceptions
()
{
return
m_exceptions
;
}
public
String
getProductLine
()
{
return
m_productLine
;
}
public
void
setBugs
(
Map
<
String
,
ExceptionItem
>
bugs
)
{
m_bugs
=
bugs
;
}
public
void
setDepartment
(
String
department
)
{
m_department
=
department
;
}
public
void
setExceptions
(
Map
<
String
,
ExceptionItem
>
exceptions
)
{
m_exceptions
=
exceptions
;
}
public
void
setProductLine
(
String
productLine
)
{
m_productLine
=
productLine
;
}
}
}
cat-home/src/main/java/com/dianping/cat/report/page/bug/Model.java
浏览文件 @
80d8dc2f
...
...
@@ -2,11 +2,35 @@ package com.dianping.cat.report.page.bug;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Map
;
import
com.dianping.cat.helper.CatString
;
import
com.dianping.cat.home.bug.entity.BugReport
;
import
com.dianping.cat.report.page.AbstractReportModel
;
import
com.dianping.cat.report.page.bug.Handler.ErrorStatis
;
public
class
Model
extends
AbstractReportModel
<
Action
,
Context
>
{
private
BugReport
m_bugReport
;
private
Map
<
String
,
ErrorStatis
>
m_errorStatis
;
public
BugReport
getBugReport
()
{
return
m_bugReport
;
}
public
void
setBugReport
(
BugReport
bugReport
)
{
m_bugReport
=
bugReport
;
}
public
Map
<
String
,
ErrorStatis
>
getErrorStatis
()
{
return
m_errorStatis
;
}
public
void
setErrorStatis
(
Map
<
String
,
ErrorStatis
>
errorStatis
)
{
m_errorStatis
=
errorStatis
;
}
public
class
Model
extends
AbstractReportModel
<
Action
,
Context
>
{
public
Model
(
Context
ctx
)
{
super
(
ctx
);
}
...
...
@@ -17,12 +41,12 @@ public class Model extends AbstractReportModel<Action, Context> {
}
@Override
public
String
getDomain
()
{
return
CatString
.
CAT
;
}
public
String
getDomain
()
{
return
CatString
.
CAT
;
}
@Override
public
Collection
<
String
>
getDomains
()
{
public
Collection
<
String
>
getDomains
()
{
return
new
ArrayList
<
String
>();
}
}
cat-home/src/main/java/com/dianping/cat/report/task/bug/BugReportBuilder.java
浏览文件 @
80d8dc2f
package
com.dianping.cat.report.task.bug
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Set
;
...
...
@@ -15,6 +16,7 @@ import com.dianping.cat.core.dal.WeeklyReport;
import
com.dianping.cat.helper.CatString
;
import
com.dianping.cat.helper.TimeUtil
;
import
com.dianping.cat.home.bug.entity.BugReport
;
import
com.dianping.cat.home.bug.entity.Domain
;
import
com.dianping.cat.report.service.ReportService
;
import
com.dianping.cat.report.task.TaskHelper
;
import
com.dianping.cat.report.task.spi.ReportTaskBuilder
;
...
...
@@ -50,6 +52,11 @@ public class BugReportBuilder implements ReportTaskBuilder {
ProblemReport
problemReport
=
m_reportService
.
queryProblemReport
(
domainName
,
start
,
end
);
visitor
.
visitProblemReport
(
problemReport
);
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyyMMddHH"
);
for
(
Domain
d
:
bugReport
.
getDomains
().
values
())
{
d
.
setProblemUrl
(
String
.
format
(
"http://%s/cat/r/p?domain=%s&date=%s"
,
getDomainName
(),
d
.
getId
(),
sdf
.
format
(
start
)));
}
HourlyReport
report
=
new
HourlyReport
();
report
.
setContent
(
bugReport
.
toString
());
...
...
@@ -129,4 +136,16 @@ public class BugReportBuilder implements ReportTaskBuilder {
return
bugReport
;
}
private
String
getDomainName
()
{
String
ip
=
NetworkInterfaceManager
.
INSTANCE
.
getLocalHostAddress
();
if
(
"10.1.6.128"
.
equals
(
ip
))
{
return
"cat.dianpingoa.com"
;
}
else
if
(
"192.168.7.70"
.
equals
(
ip
))
{
return
"cat.qa.dianpingoa.com"
;
}
else
{
return
ip
+
":2281"
;
}
}
}
cat-home/src/main/java/com/dianping/cat/report/task/bug/BugReportMerger.java
浏览文件 @
80d8dc2f
...
...
@@ -23,6 +23,7 @@ public class BugReportMerger extends DefaultMerger {
@Override
protected
void
mergeDomain
(
Domain
old
,
Domain
domain
)
{
old
.
setProblemUrl
(
domain
.
getProblemUrl
());
super
.
mergeDomain
(
old
,
domain
);
}
...
...
@@ -32,11 +33,10 @@ public class BugReportMerger extends DefaultMerger {
old
.
getMessages
().
addAll
(
exceptionItem
.
getMessages
());
List
<
String
>
oldMessages
=
old
.
getMessages
();
if
(
oldMessages
.
size
()
>
10
)
{
oldMessages
=
oldMessages
.
subList
(
0
,
10
);
}
}
}
cat-home/src/main/java/com/dianping/cat/report/task/bug/ProblemReportVisitor.java
浏览文件 @
80d8dc2f
...
...
@@ -28,7 +28,7 @@ public class ProblemReportVisitor extends BaseVisitor {
Domain
domainInfo
=
m_report
.
findOrCreateDomain
(
m_currentDomain
);
ExceptionItem
target
=
domainInfo
.
findOrCreateExceptionItem
(
m_exception
);
List
<
String
>
oldMessages
=
target
.
getMessages
();
target
.
setCount
(
target
.
getCount
()
+
count
);
oldMessages
.
addAll
(
messages
);
if
(
oldMessages
.
size
()
>
10
)
{
...
...
cat-home/src/main/java/com/dianping/cat/report/view/NavigationBar.java
浏览文件 @
80d8dc2f
...
...
@@ -46,6 +46,8 @@ public class NavigationBar {
ReportPage
.
DEPENDENCY
,
ReportPage
.
STATE
,
ReportPage
.
BUG
,
ReportPage
.
LOGVIEW
,
...
...
cat-home/src/main/java/com/dianping/cat/system/config/BugConfigManager.java
浏览文件 @
80d8dc2f
package
com.dianping.cat.system.config
;
import
java.util.
ArrayLis
t
;
import
java.util.
Lis
t
;
import
java.util.
HashSe
t
;
import
java.util.
Se
t
;
import
org.codehaus.plexus.logging.LogEnabled
;
import
org.codehaus.plexus.logging.Logger
;
...
...
@@ -32,21 +32,21 @@ public class BugConfigManager implements Initializable, LogEnabled {
private
static
final
String
CONFIG_NAME
=
"bugConfig"
;
public
Lis
t
<
String
>
queryBugConfigsByDomain
(
String
domain
)
{
public
Se
t
<
String
>
queryBugConfigsByDomain
(
String
domain
)
{
Domain
config
=
m_bugConfig
.
findDomain
(
domain
);
if
(
config
==
null
)
{
return
m_bugConfig
.
getExceptions
(
);
return
new
HashSet
<
String
>(
m_bugConfig
.
getExceptions
()
);
}
else
{
if
(
config
.
getAdditivity
()
==
true
)
{
List
<
String
>
result
=
new
ArrayLis
t
<
String
>();
Set
<
String
>
result
=
new
HashSe
t
<
String
>();
result
.
addAll
(
m_bugConfig
.
getExceptions
());
result
.
addAll
(
config
.
getExceptions
());
return
result
;
}
else
{
return
config
.
getExceptions
(
);
return
new
HashSet
<
String
>(
config
.
getExceptions
()
);
}
}
}
...
...
cat-home/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
80d8dc2f
...
...
@@ -2495,7 +2495,13 @@
<role>
com.dianping.cat.report.service.ReportService
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.advanced.ProductLineConfigManager
</role>
<role>
com.dianping.cat.core.dal.ProjectDao
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.system.config.BugConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.report.page.PayloadNormalizer
</role>
</requirement>
</requirements>
</component>
...
...
@@ -2508,6 +2514,15 @@
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.system.config.BugConfigManager
</role>
<implementation>
com.dianping.cat.system.config.BugConfigManager
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.core.config.ConfigDao
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.system.SystemModule
</role>
<implementation>
com.dianping.cat.system.SystemModule
</implementation>
...
...
@@ -2775,15 +2790,6 @@
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.system.config.BugConfigManager
</role>
<implementation>
com.dianping.cat.system.config.BugConfigManager
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.core.config.ConfigDao
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.system.page.abtest.Handler
</role>
<implementation>
com.dianping.cat.system.page.abtest.Handler
</implementation>
...
...
cat-home/src/main/resources/META-INF/wizard/webapp/wizard.xml
浏览文件 @
80d8dc2f
...
...
@@ -56,7 +56,7 @@
<page
name=
"externalError"
title=
"externalError"
path=
"externalError"
template=
"default"
>
<description>
ExternalError
</description>
</page>
<page
name=
"bug"
title=
"Bug"
path=
"bug"
template=
"default"
>
<page
name=
"bug"
title=
"Bug"
path=
"bug"
view=
"/jsp/report/bug/bug.jsp"
template=
"default"
>
<description>
Bug
</description>
</page>
</module>
...
...
cat-home/src/main/resources/config/default-bug-config.xml
浏览文件 @
80d8dc2f
<?xml version="1.0" encoding="utf-8"?>
<bug-config>
<exception>
om.dianping.dpsf.exception.NetTimeoutException
</exception>
<exception>
c
om.dianping.dpsf.exception.NetTimeoutException
</exception>
<exception>
com.dianping.dpsf.exception.DPSFTimeoutException
</exception>
<exception>
org.apache.http.conn.HttpHostConnectException
</exception>
<exception>
net.spy.memcached.internal.CheckedOperationTimeoutException
</exception>
...
...
cat-home/src/main/webapp/jsp/report/bug.jsp
已删除
100644 → 0
浏览文件 @
6f6c2343
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<jsp:useBean
id=
"ctx"
type=
"com.dianping.cat.report.page.bug.Context"
scope=
"request"
/>
<jsp:useBean
id=
"payload"
type=
"com.dianping.cat.report.page.bug.Payload"
scope=
"request"
/>
<jsp:useBean
id=
"model"
type=
"com.dianping.cat.report.page.bug.Model"
scope=
"request"
/>
View of bug page under report
\ No newline at end of file
cat-home/src/main/webapp/jsp/report/bug/bug.jsp
0 → 100644
浏览文件 @
80d8dc2f
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<%@ taglib
prefix=
"a"
uri=
"/WEB-INF/app.tld"
%>
<%@ 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"
%>
<jsp:useBean
id=
"ctx"
type=
"com.dianping.cat.report.page.bug.Context"
scope=
"request"
/>
<jsp:useBean
id=
"payload"
type=
"com.dianping.cat.report.page.bug.Payload"
scope=
"request"
/>
<jsp:useBean
id=
"model"
type=
"com.dianping.cat.report.page.bug.Model"
scope=
"request"
/>
<a:body>
<res:useCss
value=
'
${
res
.
css
.
local
.
table_css
}
'
target=
"head-css"
/>
<res:useJs
value=
"
${
res
.
js
.
local
[
'bootstrap.min.js'
]
}
"
target=
"head-js"
/>
<div
class=
"report"
>
<table
class=
"header"
>
<tr>
<td
class=
"title"
>
From ${w:format(model.bugReport.startTime,'yyyy-MM-dd HH:mm:ss')} to ${w:format(model.bugReport.endTime,'yyyy-MM-dd HH:mm:ss')}
</td>
<td
class=
"switch"
><a
href=
"?op=history"
>
Switch To History Mode
</a>
</td>
<td
class=
"nav"
>
<c:forEach
var=
"nav"
items=
"
${
model
.
navs
}
"
>
[
<a
href=
"${model.baseUri}?date=${model.date}&step=${nav.hours}&${navUrlPrefix}"
>
${nav.title}
</a>
]
</c:forEach>
[
<a
href=
"${model.baseUri}?${navUrlPrefix}"
>
now
</a>
]
</td>
</tr>
</table>
<%@ include
file=
"detail.jsp"
%>
<table
class=
"footer"
>
<tr>
<td>
[ end ]
</td>
</tr>
</table>
</div>
</a:body>
cat-home/src/main/webapp/jsp/report/bug/bugHistory.jsp
0 → 100644
浏览文件 @
80d8dc2f
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<%@ taglib
prefix=
"a"
uri=
"/WEB-INF/app.tld"
%>
<%@ 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"
%>
<jsp:useBean
id=
"ctx"
type=
"com.dianping.cat.report.page.bug.Context"
scope=
"request"
/>
<jsp:useBean
id=
"payload"
type=
"com.dianping.cat.report.page.bug.Payload"
scope=
"request"
/>
<jsp:useBean
id=
"model"
type=
"com.dianping.cat.report.page.bug.Model"
scope=
"request"
/>
<a:body>
<res:useCss
value=
'
${
res
.
css
.
local
.
table_css
}
'
target=
"head-css"
/>
<res:useJs
value=
"
${
res
.
js
.
local
[
'bootstrap.min.js'
]
}
"
target=
"head-js"
/>
<div
class=
"report"
>
<table
class=
"header"
>
<tr>
<td
class=
"title"
>
Bug Report
</td>
<td
class=
"switch"
><a
href=
"?domain=${model.domain}"
>
Switch To Hourly Mode
</a>
</td>
<td
class=
"nav"
>
<c:forEach
var=
"nav"
items=
"
${
model
.
historyNavs
}
"
>
<c:choose>
<c:when
test=
"
${
nav
.
title
eq
model
.
reportType
}
"
>
[
<a
href=
"?op=history&domain=${model.domain}&ip=${model.ipAddress}&date=${model.date}&reportType=${nav.title}"
class=
"current"
>
${nav.title}
</a>
]
</c:when>
<c:otherwise>
[
<a
href=
"?op=history&domain=${model.domain}&ip=${model.ipAddress}&date=${model.date}&reportType=${nav.title}"
>
${nav.title}
</a>
]
</c:otherwise>
</c:choose>
</c:forEach>
[
<a
href=
"?op=history&domain=${model.domain}&ip=${model.ipAddress}&date=${model.date}&reportType=${model.reportType}&step=-1"
>
${model.currentNav.last}
</a>
]
[
<a
href=
"?op=history&domain=${model.domain}&ip=${model.ipAddress}&date=${model.date}&reportType=${model.reportType}&step=1"
>
${model.currentNav.next}
</a>
]
[
<a
href=
"?op=history&domain=${model.domain}&ip=${model.ipAddress}&reportType=${model.reportType}&nav=next"
>
now
</a>
]
</td>
</tr>
</table>
<%@ include
file=
"detail.jsp"
%>
<table
class=
"footer"
>
<tr>
<td>
[ end ]
</td>
</tr>
</table>
</div>
</a:body>
cat-home/src/main/webapp/jsp/report/bug/detail.jsp
0 → 100644
浏览文件 @
80d8dc2f
<%@ page
session=
"false"
language=
"java"
pageEncoding=
"UTF-8"
%>
<div
class=
"text-right"
>
<a
class=
"btn btn-small btn-danger"
href=
"/cat/s/config?op=bugConfigUpdate"
>
异常规范配置
</a>
</div>
<table
class=
"table table-striped table-bordered table-condensed"
>
<tr>
<th
width=
"10%"
>
部门
</th>
<th
width=
"10%"
>
产品线
</th>
<th
width=
"10%"
>
异常类型
</th>
<th
width=
"60%"
>
异常名称
</th>
<th
width=
"10%"
>
异常数量
</th>
</tr>
<c:forEach
var=
"item"
items=
"
${
model
.
errorStatis
}
"
>
<c:set
var=
"statis"
value=
"
${
item
.
value
}
"
/>
<c:forEach
var=
"bug"
items=
"
${
statis
.
bugs
}
"
varStatus=
"status"
>
<c:if
test=
"
${
status
.
index
==
0
}
"
>
<tr>
<td
rowspan=
"${w:size(statis.bugs)}"
><span>
${statis.department}
</span></td>
<td
rowspan=
"${w:size(statis.bugs)}"
><span>
${statis.productLine}
</span></td>
<td
rowspan=
"${w:size(statis.bugs)}"
>
项目Bug
</td>
<td>
${bug.value.id}
</td>
<td>
${bug.value.count}
</td>
</c:if>
</tr>
<c:if
test=
"
${
status
.
index
>
0
}
"
>
<tr>
<td>
${bug.value.id}
</td>
<td>
${bug.value.count}
</td>
</tr>
</c:if>
</c:forEach>
<c:forEach
var=
"exception"
items=
"
${
statis
.
exceptions
}
"
varStatus=
"status"
>
<c:if
test=
"
${
status
.
index
==
0
}
"
>
<tr>
<td
rowspan=
"${w:size(statis.exceptions)}"
><span>
${statis.department}
</span></td>
<td
rowspan=
"${w:size(statis.exceptions)}"
><span>
${statis.productLine}
</span></td>
<td
rowspan=
"${w:size(statis.bugs)}"
>
其他异常
</td>
<td>
${exception.value.id}
</td>
<td>
${exception.value.count}
</td>
</c:if>
</tr>
<c:if
test=
"
${
status
.
index
>
0
}
"
>
<tr>
<td>
${exception.value.id}
</td>
<td>
${exception.value.count}
</td>
</tr>
</c:if>
</c:forEach>
</c:forEach>
</table>
\ No newline at end of file
cat-home/src/test/java/com/dianping/cat/report/analyzer/ExceptionAnalyzer.java
浏览文件 @
80d8dc2f
...
...
@@ -10,6 +10,7 @@ import org.junit.Test;
import
org.unidal.dal.jdbc.DalException
;
import
org.unidal.lookup.ComponentTestCase
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.consumer.problem.model.entity.Duration
;
import
com.dianping.cat.consumer.problem.model.entity.Entry
;
import
com.dianping.cat.consumer.problem.model.entity.Machine
;
...
...
@@ -80,7 +81,7 @@ public class ExceptionAnalyzer extends ComponentTestCase {
try
{
return
m_projectDao
.
findByDomain
(
domain
,
ProjectEntity
.
READSET_FULL
);
}
catch
(
DalException
e
)
{
e
.
printStackTrace
(
);
Cat
.
logError
(
e
);
}
return
null
;
}
...
...
@@ -115,7 +116,6 @@ public class ExceptionAnalyzer extends ComponentTestCase {
public
void
setErrors
(
Map
<
String
,
Integer
>
errors
)
{
m_errors
=
errors
;
}
}
public
class
Visitor
extends
BaseVisitor
{
...
...
cat-home/src/test/resources/com/dianping/cat/report/page/bug/testbug.xml
0 → 100644
浏览文件 @
80d8dc2f
<?xml version="1.0" encoding="utf-8"?>
<bug-report
startTime=
"2012-05-16 16:00:00"
domain=
"All"
endTime=
"2012-05-16 16:59:59"
>
<domain
id=
"Cat"
>
<problem-url>
http://cat.dianpingoa.com/cat/r/p
</problem-url>
<exception-item
id=
"NPE"
count=
"123"
>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
</exception-item><exception-item
id=
"NPE2"
count=
"1233"
>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
</exception-item>
<exception-item
id=
"com.dianping.dpsf.exception.DPSFTimeoutException"
count=
"123"
>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
</exception-item>
<exception-item
id=
"java.net.ConnectException"
count=
"1235"
>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
</exception-item>
</domain>
<domain
id=
"UserWeb"
>
<problem-url>
http://cat.dianpingoa.com/cat/r/p
</problem-url>
<exception-item
id=
"NPE"
count=
"123"
>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
</exception-item><exception-item
id=
"NPE2"
count=
"1233"
>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
</exception-item>
<exception-item
id=
"com.dianping.dpsf.exception.DPSFTimeoutException"
count=
"123"
>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
</exception-item>
<exception-item
id=
"java.net.ConnectException"
count=
"1235"
>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
<message>
http://cat.dianpingoa.com/cat/r/ShopServer
</message>
</exception-item>
</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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录