Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
7d1378bc
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,发现更多精彩内容 >>
提交
7d1378bc
编写于
2月 03, 2012
作者:
F
Frankie Wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
uprev
上级
f21ceabd
变更
26
展开全部
隐藏空白更改
内联
并排
Showing
26 changed file
with
6453 addition
and
310 deletion
+6453
-310
cat-consumer/src/main/java/com/dianping/cat/consumer/configuration/ComponentsConfigurator.java
...ng/cat/consumer/configuration/ComponentsConfigurator.java
+2
-1
cat-consumer/src/main/java/com/dianping/cat/consumer/failure/FailureReportAnalyzer.java
.../dianping/cat/consumer/failure/FailureReportAnalyzer.java
+45
-25
cat-consumer/src/main/java/com/dianping/cat/consumer/ip/IpAnalyzer.java
...rc/main/java/com/dianping/cat/consumer/ip/IpAnalyzer.java
+0
-1
cat-consumer/src/main/java/com/dianping/cat/consumer/transaction/TransactionReportAnalyzer.java
...g/cat/consumer/transaction/TransactionReportAnalyzer.java
+22
-13
cat-consumer/src/main/resources/META-INF/dal/model/failure-report-codegen.xml
...n/resources/META-INF/dal/model/failure-report-codegen.xml
+1
-4
cat-consumer/src/main/resources/META-INF/dal/model/failure-report.xml
.../src/main/resources/META-INF/dal/model/failure-report.xml
+0
-3
cat-consumer/src/main/resources/META-INF/dal/model/transaction-report-codegen.xml
...sources/META-INF/dal/model/transaction-report-codegen.xml
+27
-25
cat-consumer/src/main/resources/META-INF/dal/model/transaction-report.xml
.../main/resources/META-INF/dal/model/transaction-report.xml
+0
-4
cat-consumer/src/main/resources/META-INF/plexus/components.xml
...onsumer/src/main/resources/META-INF/plexus/components.xml
+4
-0
cat-consumer/src/test/java/com/dianping/cat/consumer/ManyAnalyzerTest.java
...test/java/com/dianping/cat/consumer/ManyAnalyzerTest.java
+0
-15
cat-consumer/src/test/java/com/dianping/cat/consumer/OneAnalyzerTwoDurationTest.java
...com/dianping/cat/consumer/OneAnalyzerTwoDurationTest.java
+0
-5
cat-consumer/src/test/java/com/dianping/cat/consumer/failure/FailureAnalyzerStoreTest.java
...anping/cat/consumer/failure/FailureAnalyzerStoreTest.java
+10
-7
cat-consumer/src/test/java/com/dianping/cat/consumer/failure/FailureAnalyzerTest.java
...om/dianping/cat/consumer/failure/FailureAnalyzerTest.java
+26
-21
cat-consumer/src/test/java/com/dianping/cat/consumer/transaction/TransactionReportMessageAnalyzerTest.java
...mer/transaction/TransactionReportMessageAnalyzerTest.java
+15
-40
cat-consumer/src/test/resources/com/dianping/cat/consumer/failure/failure.json
.../resources/com/dianping/cat/consumer/failure/failure.json
+1
-8
cat-core/src/main/java/com/dianping/cat/message/spi/AbstractMessageAnalyzer.java
...com/dianping/cat/message/spi/AbstractMessageAnalyzer.java
+0
-2
cat-home/src/main/java/com/dianping/cat/report/page/failure/FailureData.java
...ava/com/dianping/cat/report/page/failure/FailureData.java
+69
-0
cat-home/src/main/java/com/dianping/cat/report/page/failure/Handler.java
...in/java/com/dianping/cat/report/page/failure/Handler.java
+145
-62
cat-home/src/main/java/com/dianping/cat/report/page/failure/Model.java
...main/java/com/dianping/cat/report/page/failure/Model.java
+62
-24
cat-home/src/main/java/com/dianping/cat/report/page/failure/Payload.java
...in/java/com/dianping/cat/report/page/failure/Payload.java
+10
-0
cat-home/src/main/java/com/dianping/cat/tool/DateUtil.java
cat-home/src/main/java/com/dianping/cat/tool/DateUtil.java
+15
-0
cat-home/src/main/webapp/css/failure.css
cat-home/src/main/webapp/css/failure.css
+9
-2
cat-home/src/main/webapp/js/failure.js
cat-home/src/main/webapp/js/failure.js
+13
-10
cat-home/src/main/webapp/js/mootools.js
cat-home/src/main/webapp/js/mootools.js
+5927
-0
cat-home/src/main/webapp/js/transaction.js
cat-home/src/main/webapp/js/transaction.js
+19
-15
cat-home/src/main/webapp/jsp/report/failure.jsp
cat-home/src/main/webapp/jsp/report/failure.jsp
+31
-23
未找到文件。
cat-consumer/src/main/java/com/dianping/cat/consumer/configuration/ComponentsConfigurator.java
浏览文件 @
7d1378bc
...
@@ -50,7 +50,8 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
...
@@ -50,7 +50,8 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
all
.
add
(
C
(
TransactionReportAnalyzer
.
class
).
is
(
PER_LOOKUP
)
//
all
.
add
(
C
(
TransactionReportAnalyzer
.
class
).
is
(
PER_LOOKUP
)
//
.
req
(
MessageManager
.
class
)
//
.
req
(
MessageManager
.
class
)
//
.
config
(
E
(
"reportPath"
).
value
(
"target/report/transaction/"
)));
.
config
(
E
(
"reportPath"
).
value
(
"target/report/transaction/"
))
.
req
(
MessageStorage
.
class
,
"html"
));
return
all
;
return
all
;
}
}
...
...
cat-consumer/src/main/java/com/dianping/cat/consumer/failure/FailureReportAnalyzer.java
浏览文件 @
7d1378bc
...
@@ -18,7 +18,6 @@ import com.dianping.cat.configuration.model.entity.Config;
...
@@ -18,7 +18,6 @@ import com.dianping.cat.configuration.model.entity.Config;
import
com.dianping.cat.configuration.model.entity.Property
;
import
com.dianping.cat.configuration.model.entity.Property
;
import
com.dianping.cat.consumer.failure.model.entity.Entry
;
import
com.dianping.cat.consumer.failure.model.entity.Entry
;
import
com.dianping.cat.consumer.failure.model.entity.FailureReport
;
import
com.dianping.cat.consumer.failure.model.entity.FailureReport
;
import
com.dianping.cat.consumer.failure.model.entity.Machines
;
import
com.dianping.cat.consumer.failure.model.entity.Segment
;
import
com.dianping.cat.consumer.failure.model.entity.Segment
;
import
com.dianping.cat.consumer.failure.model.entity.Threads
;
import
com.dianping.cat.consumer.failure.model.entity.Threads
;
import
com.dianping.cat.message.Event
;
import
com.dianping.cat.message.Event
;
...
@@ -45,6 +44,7 @@ public class FailureReportAnalyzer extends AbstractMessageAnalyzer<FailureReport
...
@@ -45,6 +44,7 @@ public class FailureReportAnalyzer extends AbstractMessageAnalyzer<FailureReport
@Inject
@Inject
private
MessageManager
m_manager
;
private
MessageManager
m_manager
;
// Key: the domain:host of the message. Sample: Review:192.168.1.1
private
Map
<
String
,
FailureReport
>
m_reports
=
new
HashMap
<
String
,
FailureReport
>();
private
Map
<
String
,
FailureReport
>
m_reports
=
new
HashMap
<
String
,
FailureReport
>();
private
long
m_startTime
;
private
long
m_startTime
;
...
@@ -65,8 +65,35 @@ public class FailureReportAnalyzer extends AbstractMessageAnalyzer<FailureReport
...
@@ -65,8 +65,35 @@ public class FailureReportAnalyzer extends AbstractMessageAnalyzer<FailureReport
m_duration
=
duration
;
m_duration
=
duration
;
}
}
private
FailureReport
getReportByDomain
(
String
domain
)
{
public
List
<
String
>
getAllDomains
()
{
FailureReport
report
=
m_reports
.
get
(
domain
);
Set
<
String
>
domainAndIps
=
m_reports
.
keySet
();
Set
<
String
>
result
=
new
HashSet
<
String
>();
if
(
domainAndIps
!=
null
)
{
for
(
String
domainAndIp
:
domainAndIps
)
{
result
.
add
(
domainAndIp
.
substring
(
0
,
domainAndIp
.
lastIndexOf
(
":"
)));
}
}
return
new
ArrayList
<
String
>(
result
);
}
public
List
<
String
>
getHostIpByDomain
(
String
domain
)
{
Set
<
String
>
domainAndIps
=
m_reports
.
keySet
();
Set
<
String
>
result
=
new
HashSet
<
String
>();
if
(
domainAndIps
!=
null
)
{
for
(
String
domainAndIp
:
domainAndIps
)
{
int
index
=
domainAndIp
.
lastIndexOf
(
":"
);
if
(
domainAndIp
.
substring
(
0
,
index
).
equals
(
domain
))
{
String
ip
=
domainAndIp
.
substring
(
index
+
1
);
result
.
add
(
ip
);
}
}
}
return
new
ArrayList
<
String
>(
result
);
}
private
FailureReport
getReportByDomainAndIp
(
String
domain
,
String
ip
)
{
String
domainAndIp
=
new
StringBuffer
().
append
(
domain
).
append
(
":"
).
append
(
ip
).
toString
();
FailureReport
report
=
m_reports
.
get
(
domainAndIp
);
if
(
report
!=
null
)
{
if
(
report
!=
null
)
{
return
report
;
return
report
;
}
}
...
@@ -75,9 +102,8 @@ public class FailureReportAnalyzer extends AbstractMessageAnalyzer<FailureReport
...
@@ -75,9 +102,8 @@ public class FailureReportAnalyzer extends AbstractMessageAnalyzer<FailureReport
addedReport
.
setStartTime
(
new
Date
(
m_startTime
));
addedReport
.
setStartTime
(
new
Date
(
m_startTime
));
addedReport
.
setEndTime
(
new
Date
(
m_startTime
+
m_duration
-
MINUTE
));
addedReport
.
setEndTime
(
new
Date
(
m_startTime
+
m_duration
-
MINUTE
));
addedReport
.
setDomain
(
domain
);
addedReport
.
setDomain
(
domain
);
addedReport
.
setMachines
(
new
Machines
());
addedReport
.
setThreads
(
new
Threads
());
addedReport
.
setThreads
(
new
Threads
());
m_reports
.
put
(
domain
,
addedReport
);
m_reports
.
put
(
domain
AndIp
,
addedReport
);
return
addedReport
;
return
addedReport
;
}
}
...
@@ -92,26 +118,18 @@ public class FailureReportAnalyzer extends AbstractMessageAnalyzer<FailureReport
...
@@ -92,26 +118,18 @@ public class FailureReportAnalyzer extends AbstractMessageAnalyzer<FailureReport
@Override
@Override
public
List
<
FailureReport
>
generate
()
{
public
List
<
FailureReport
>
generate
()
{
List
<
FailureReport
>
reports
=
new
ArrayList
<
FailureReport
>();
List
<
FailureReport
>
reports
=
new
ArrayList
<
FailureReport
>();
for
(
String
domain
:
m_reports
.
keySet
())
{
for
(
String
domainAndIp
:
m_reports
.
keySet
())
{
reports
.
add
(
generateByDomain
(
domain
));
String
[]
temp
=
domainAndIp
.
split
(
":"
);
reports
.
add
(
generateByDomainAndIp
(
temp
[
0
],
temp
[
1
]));
}
}
return
reports
;
return
reports
;
}
}
@Override
public
FailureReport
generate
(
String
domain
)
{
return
generateByDomain
(
domain
);
}
@Override
@Override
protected
void
store
(
List
<
FailureReport
>
reports
)
{
protected
void
store
(
List
<
FailureReport
>
reports
)
{
if
(
reports
!=
null
)
{
if
(
reports
!=
null
)
{
for
(
FailureReport
report
:
reports
)
{
for
(
FailureReport
report
:
reports
)
{
String
failureFileName
=
getFailureFileName
(
report
);
File
file
=
new
File
(
getFailureFilePath
(
report
));
String
htmlPath
=
new
StringBuilder
().
append
(
m_reportPath
).
append
(
failureFileName
).
append
(
".html"
)
.
toString
();
File
file
=
new
File
(
htmlPath
);
file
.
getParentFile
().
mkdirs
();
file
.
getParentFile
().
mkdirs
();
FailureReportStore
.
storeToHtml
(
file
,
report
);
FailureReportStore
.
storeToHtml
(
file
,
report
);
...
@@ -119,8 +137,8 @@ public class FailureReportAnalyzer extends AbstractMessageAnalyzer<FailureReport
...
@@ -119,8 +137,8 @@ public class FailureReportAnalyzer extends AbstractMessageAnalyzer<FailureReport
}
}
}
}
public
FailureReport
generateByDomain
(
String
domain
)
{
public
FailureReport
generateByDomain
AndIp
(
String
domain
,
String
ip
)
{
FailureReport
m_report
=
getReportByDomain
(
domain
);
FailureReport
m_report
=
getReportByDomain
AndIp
(
domain
,
ip
);
long
time
=
System
.
currentTimeMillis
();
long
time
=
System
.
currentTimeMillis
();
long
endTime
=
time
-
time
%
(
60
*
1000
);
long
endTime
=
time
-
time
%
(
60
*
1000
);
long
start
=
m_report
.
getStartTime
().
getTime
();
long
start
=
m_report
.
getStartTime
().
getTime
();
...
@@ -153,11 +171,13 @@ public class FailureReportAnalyzer extends AbstractMessageAnalyzer<FailureReport
...
@@ -153,11 +171,13 @@ public class FailureReportAnalyzer extends AbstractMessageAnalyzer<FailureReport
throw
new
RuntimeException
();
throw
new
RuntimeException
();
}
}
String
domain
=
tree
.
getDomain
();
String
domain
=
tree
.
getDomain
();
FailureReport
report
=
getReportByDomain
(
domain
);
String
ip
=
tree
.
getIpAddress
();
FailureReport
report
=
getReportByDomainAndIp
(
domain
,
ip
);
report
.
getMachines
().
addMachine
(
tree
.
getIpAddress
());
report
.
getThreads
().
addThread
(
tree
.
getThreadId
());
report
.
getThreads
().
addThread
(
tree
.
getThreadId
());
if
(
null
==
report
.
getMachine
())
{
report
.
setMachine
(
tree
.
getIpAddress
());
}
for
(
Handler
handler
:
m_handlers
)
{
for
(
Handler
handler
:
m_handlers
)
{
handler
.
handle
(
report
,
tree
);
handler
.
handle
(
report
,
tree
);
}
}
...
@@ -171,12 +191,12 @@ public class FailureReportAnalyzer extends AbstractMessageAnalyzer<FailureReport
...
@@ -171,12 +191,12 @@ public class FailureReportAnalyzer extends AbstractMessageAnalyzer<FailureReport
return
m_reportPath
;
return
m_reportPath
;
}
}
public
String
getFailureFile
Name
(
FailureReport
report
)
{
public
String
getFailureFile
Path
(
FailureReport
report
)
{
StringBuffer
result
=
new
StringBuffer
();
StringBuffer
result
=
new
StringBuffer
();
String
start
=
FILE_SDF
.
format
(
report
.
getStartTime
());
String
start
=
FILE_SDF
.
format
(
report
.
getStartTime
());
String
end
=
FILE_SDF
.
format
(
report
.
getEndTime
());
String
end
=
FILE_SDF
.
format
(
report
.
getEndTime
());
result
.
append
(
m_reportPath
).
append
(
report
.
getDomain
()).
append
(
report
.
getMachine
()).
append
(
"-"
).
append
(
start
)
result
.
append
(
report
.
getDomain
()).
append
(
"-"
).
append
(
start
).
append
(
"-"
).
append
(
end
);
.
append
(
"-"
).
append
(
end
).
append
(
".html"
);
return
result
.
toString
();
return
result
.
toString
();
}
}
...
...
cat-consumer/src/main/java/com/dianping/cat/consumer/ip/IpAnalyzer.java
浏览文件 @
7d1378bc
...
@@ -39,7 +39,6 @@ public class IpAnalyzer extends AbstractMessageAnalyzer<IpReport> {
...
@@ -39,7 +39,6 @@ public class IpAnalyzer extends AbstractMessageAnalyzer<IpReport> {
return
null
;
return
null
;
}
}
@Override
public
IpReport
generate
(
String
domain
)
{
public
IpReport
generate
(
String
domain
)
{
IpReport
report
=
null
;
IpReport
report
=
null
;
...
...
cat-consumer/src/main/java/com/dianping/cat/consumer/transaction/TransactionReportAnalyzer.java
浏览文件 @
7d1378bc
...
@@ -27,6 +27,7 @@ import com.dianping.cat.message.Message;
...
@@ -27,6 +27,7 @@ import com.dianping.cat.message.Message;
import
com.dianping.cat.message.Transaction
;
import
com.dianping.cat.message.Transaction
;
import
com.dianping.cat.message.spi.AbstractMessageAnalyzer
;
import
com.dianping.cat.message.spi.AbstractMessageAnalyzer
;
import
com.dianping.cat.message.spi.MessageManager
;
import
com.dianping.cat.message.spi.MessageManager
;
import
com.dianping.cat.message.spi.MessageStorage
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.site.helper.Files
;
import
com.site.helper.Files
;
import
com.site.lookup.annotation.Inject
;
import
com.site.lookup.annotation.Inject
;
...
@@ -40,7 +41,10 @@ public class TransactionReportAnalyzer extends AbstractMessageAnalyzer<Transacti
...
@@ -40,7 +41,10 @@ public class TransactionReportAnalyzer extends AbstractMessageAnalyzer<Transacti
private
final
static
SimpleDateFormat
FILE_SDF
=
new
SimpleDateFormat
(
"yyyyMMddHHmm"
);
private
final
static
SimpleDateFormat
FILE_SDF
=
new
SimpleDateFormat
(
"yyyyMMddHHmm"
);
@Inject
@Inject
private
MessageManager
m_manager
;
private
MessageManager
messageManager
;
@Inject
private
MessageStorage
messageStorage
;
private
Map
<
String
,
TransactionReport
>
m_reports
=
new
HashMap
<
String
,
TransactionReport
>();
private
Map
<
String
,
TransactionReport
>
m_reports
=
new
HashMap
<
String
,
TransactionReport
>();
...
@@ -81,11 +85,11 @@ public class TransactionReportAnalyzer extends AbstractMessageAnalyzer<Transacti
...
@@ -81,11 +85,11 @@ public class TransactionReportAnalyzer extends AbstractMessageAnalyzer<Transacti
typeSum
+=
sum
;
typeSum
+=
sum
;
typeSum2
+=
sum2
;
typeSum2
+=
sum2
;
typeFailCount
+=
failCount
;
typeFailCount
+=
failCount
;
if
(
name
.
getSuccessMessageId
()
!=
null
)
{
if
(
type
.
getSuccessMessageUrl
()
==
null
&&
name
.
getSuccessMessageUrl
()
!=
null
)
{
type
.
setSuccessMessage
Id
(
name
.
getSuccessMessageId
());
type
.
setSuccessMessage
Url
(
name
.
getSuccessMessageUrl
());
}
}
if
(
name
.
getFailMessageId
()
!=
null
)
{
if
(
type
.
getFailMessageUrl
()
==
null
&&
name
.
getFailMessageUrl
()
!=
null
)
{
type
.
setFailMessage
Id
(
name
.
getFailMessageId
());
type
.
setFailMessage
Url
(
name
.
getFailMessageUrl
());
}
}
type
.
setMax
(
Math
.
max
(
name
.
getMax
(),
type
.
getMax
()));
type
.
setMax
(
Math
.
max
(
name
.
getMax
(),
type
.
getMax
()));
type
.
setMin
(
Math
.
min
(
name
.
getMin
(),
type
.
getMin
()));
type
.
setMin
(
Math
.
min
(
name
.
getMin
(),
type
.
getMin
()));
...
@@ -116,7 +120,6 @@ public class TransactionReportAnalyzer extends AbstractMessageAnalyzer<Transacti
...
@@ -116,7 +120,6 @@ public class TransactionReportAnalyzer extends AbstractMessageAnalyzer<Transacti
return
reports
;
return
reports
;
}
}
@Override
public
TransactionReport
generate
(
String
domain
)
{
public
TransactionReport
generate
(
String
domain
)
{
ArrayList
<
String
>
domains
=
new
ArrayList
<
String
>(
this
.
m_reports
.
keySet
());
ArrayList
<
String
>
domains
=
new
ArrayList
<
String
>(
this
.
m_reports
.
keySet
());
if
(
domain
==
null
)
{
if
(
domain
==
null
)
{
...
@@ -140,7 +143,7 @@ public class TransactionReportAnalyzer extends AbstractMessageAnalyzer<Transacti
...
@@ -140,7 +143,7 @@ public class TransactionReportAnalyzer extends AbstractMessageAnalyzer<Transacti
@Override
@Override
public
void
initialize
()
throws
InitializationException
{
public
void
initialize
()
throws
InitializationException
{
Config
config
=
m
_m
anager
.
getClientConfig
();
Config
config
=
m
essageM
anager
.
getClientConfig
();
if
(
config
!=
null
)
{
if
(
config
!=
null
)
{
Property
property
=
config
.
findProperty
(
"transaction-base-dir"
);
Property
property
=
config
.
findProperty
(
"transaction-base-dir"
);
...
@@ -162,7 +165,7 @@ public class TransactionReportAnalyzer extends AbstractMessageAnalyzer<Transacti
...
@@ -162,7 +165,7 @@ public class TransactionReportAnalyzer extends AbstractMessageAnalyzer<Transacti
return
false
;
return
false
;
}
}
private
void
process
(
TransactionReport
report
,
Message
message
,
String
messageId
)
{
private
void
process
(
TransactionReport
report
,
Message
Tree
tree
,
Message
message
)
{
if
(
message
instanceof
Transaction
)
{
if
(
message
instanceof
Transaction
)
{
Transaction
t
=
(
Transaction
)
message
;
Transaction
t
=
(
Transaction
)
message
;
String
tType
=
t
.
getType
();
String
tType
=
t
.
getType
();
...
@@ -181,11 +184,17 @@ public class TransactionReportAnalyzer extends AbstractMessageAnalyzer<Transacti
...
@@ -181,11 +184,17 @@ public class TransactionReportAnalyzer extends AbstractMessageAnalyzer<Transacti
if
(!
t
.
isSuccess
())
{
if
(!
t
.
isSuccess
())
{
name
.
setFailCount
(
name
.
getFailCount
()
+
1
);
name
.
setFailCount
(
name
.
getFailCount
()
+
1
);
}
}
if
(
messageId
!=
null
)
{
if
(
tree
!=
null
)
{
if
(
t
.
isSuccess
())
{
if
(
t
.
isSuccess
())
{
name
.
setSuccessMessageId
(
messageId
);
if
(
name
.
getSuccessMessageUrl
()
==
null
)
{
String
url
=
this
.
messageStorage
.
store
(
tree
);
name
.
setSuccessMessageUrl
(
url
);
}
}
else
{
}
else
{
name
.
setFailMessageId
(
messageId
);
if
(
name
.
getFailMessageUrl
()
==
null
)
{
String
url
=
this
.
messageStorage
.
store
(
tree
);
name
.
setFailMessageUrl
(
url
);
}
}
}
}
}
long
duration
=
t
.
getDuration
();
long
duration
=
t
.
getDuration
();
...
@@ -198,7 +207,7 @@ public class TransactionReportAnalyzer extends AbstractMessageAnalyzer<Transacti
...
@@ -198,7 +207,7 @@ public class TransactionReportAnalyzer extends AbstractMessageAnalyzer<Transacti
}
}
List
<
Message
>
children
=
t
.
getChildren
();
List
<
Message
>
children
=
t
.
getChildren
();
for
(
Message
child
:
children
)
{
for
(
Message
child
:
children
)
{
process
(
report
,
child
,
null
);
process
(
report
,
tree
,
child
);
}
}
}
}
}
}
...
@@ -212,7 +221,7 @@ public class TransactionReportAnalyzer extends AbstractMessageAnalyzer<Transacti
...
@@ -212,7 +221,7 @@ public class TransactionReportAnalyzer extends AbstractMessageAnalyzer<Transacti
this
.
m_reports
.
put
(
domain
,
report
);
this
.
m_reports
.
put
(
domain
,
report
);
}
}
Message
message
=
tree
.
getMessage
();
Message
message
=
tree
.
getMessage
();
process
(
report
,
message
,
tree
.
getMessageId
()
);
process
(
report
,
tree
,
message
);
}
}
public
void
setAnalyzerInfo
(
long
startTime
,
long
duration
,
String
domain
,
long
extraTime
)
{
public
void
setAnalyzerInfo
(
long
startTime
,
long
duration
,
String
domain
,
long
extraTime
)
{
...
...
cat-consumer/src/main/resources/META-INF/dal/model/failure-report-codegen.xml
浏览文件 @
7d1378bc
<model>
<model>
<entity
name=
"failure-report"
root=
"true"
>
<entity
name=
"failure-report"
root=
"true"
>
<attribute
name=
"domain"
value-type=
"String"
/>
<attribute
name=
"domain"
value-type=
"String"
/>
<attribute
name=
"machine"
value-type=
"String"
/>
<attribute
name=
"baseUrl"
value-type=
"String"
/>
<attribute
name=
"baseUrl"
value-type=
"String"
/>
<attribute
name=
"startTime"
value-type=
"Date"
format=
"yyyy-MM-dd HH:mm:ss"
/>
<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"
/>
<attribute
name=
"endTime"
value-type=
"Date"
format=
"yyyy-MM-dd HH:mm:ss"
/>
<entity-ref
name=
"machines"
/>
<entity-ref
name=
"threads"
/>
<entity-ref
name=
"threads"
/>
<entity-ref
name=
"segment"
type=
"list"
names=
"segments"
/>
<entity-ref
name=
"segment"
type=
"list"
names=
"segments"
/>
</entity>
</entity>
<entity
name=
"machines"
>
<element
name=
"machine"
value-type=
"String"
type=
"list"
names=
"machines"
/>
</entity>
<entity
name=
"threads"
>
<entity
name=
"threads"
>
<element
name=
"thread"
value-type=
"String"
type=
"list"
names=
"threads"
/>
<element
name=
"thread"
value-type=
"String"
type=
"list"
names=
"threads"
/>
</entity>
</entity>
...
...
cat-consumer/src/main/resources/META-INF/dal/model/failure-report.xml
浏览文件 @
7d1378bc
...
@@ -3,9 +3,6 @@
...
@@ -3,9 +3,6 @@
<entity
name=
"failure-report"
root=
"true"
>
<entity
name=
"failure-report"
root=
"true"
>
<entity-ref
name=
"segment"
type=
"map"
/>
<entity-ref
name=
"segment"
type=
"map"
/>
</entity>
</entity>
<entity
name=
"machines"
>
<element
name=
"machine"
type=
"set"
/>
</entity>
<entity
name=
"threads"
>
<entity
name=
"threads"
>
<element
name=
"thread"
type=
"set"
/>
<element
name=
"thread"
type=
"set"
/>
</entity>
</entity>
...
...
cat-consumer/src/main/resources/META-INF/dal/model/transaction-report-codegen.xml
浏览文件 @
7d1378bc
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<model>
<model>
<entity
name=
"transaction-report"
root=
"true"
>
<entity
name=
"transaction-report"
root=
"true"
>
<attribute
name=
"domain"
value-type=
"String"
/>
<attribute
name=
"domain"
value-type=
"String"
/>
<element
name=
"domain"
value-type=
"String"
type=
"set"
names=
"domains"
/>
<element
name=
"domain"
value-type=
"String"
type=
"set"
names=
"domains"
/>
<attribute
name=
"startTime"
value-type=
"Date"
format=
"yyyy-MM-dd HH:mm:ss"
/>
<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"
/>
<attribute
name=
"endTime"
value-type=
"Date"
format=
"yyyy-MM-dd HH:mm:ss"
/>
<entity-ref
name=
"type"
type=
"list"
names=
"types"
/>
<entity-ref
name=
"type"
type=
"list"
names=
"types"
/>
</entity>
</entity>
<entity
name=
"type"
>
<entity
name=
"type"
>
<attribute
name=
"id"
value-type=
"String"
/>
<attribute
name=
"id"
value-type=
"String"
/>
<entity-ref
name=
"name"
type=
"list"
names=
"names"
/>
<entity-ref
name=
"name"
type=
"list"
names=
"names"
/>
</entity>
<element
name=
"successMessageUrl"
value-type=
"String"
/>
<entity
name=
"name"
>
<element
name=
"failMessageUrl"
value-type=
"String"
/>
<attribute
name=
"id"
value-type=
"String"
/>
</entity>
<attribute
name=
"totalCount"
value-type=
"long"
/>
<entity
name=
"name"
>
<attribute
name=
"failCount"
value-type=
"long"
/>
<attribute
name=
"id"
value-type=
"String"
/>
<attribute
name=
"failPercent"
value-type=
"double"
/>
<attribute
name=
"totalCount"
value-type=
"long"
/>
<attribute
name=
"min"
value-type=
"double"
/>
<attribute
name=
"failCount"
value-type=
"long"
/>
<attribute
name=
"max"
value-type=
"double"
/>
<attribute
name=
"failPercent"
value-type=
"double"
/>
<attribute
name=
"avg"
value-type=
"double"
/>
<attribute
name=
"min"
value-type=
"double"
/>
<attribute
name=
"sum"
value-type=
"double"
/>
<attribute
name=
"max"
value-type=
"double"
/>
<attribute
name=
"sum2"
value-type=
"double"
/>
<attribute
name=
"avg"
value-type=
"double"
/>
<attribute
name=
"std"
value-type=
"double"
/>
<attribute
name=
"sum"
value-type=
"double"
/>
<element
name=
"success-message-id"
value-type=
"String"
/>
<attribute
name=
"sum2"
value-type=
"double"
/>
<element
name=
"fail-message-id"
value-type=
"String"
/>
<attribute
name=
"std"
value-type=
"double"
/>
</entity>
<element
name=
"successMessageUrl"
value-type=
"String"
/>
<element
name=
"failMessageUrl"
value-type=
"String"
/>
</entity>
</model>
</model>
cat-consumer/src/main/resources/META-INF/dal/model/transaction-report.xml
浏览文件 @
7d1378bc
...
@@ -18,8 +18,6 @@
...
@@ -18,8 +18,6 @@
<attribute
name=
"sum"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"sum"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"sum2"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"sum2"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"std"
value-type=
"double"
primitive=
"true"
format=
"0.0"
/>
<attribute
name=
"std"
value-type=
"double"
primitive=
"true"
format=
"0.0"
/>
<element
name=
"success-message-id"
value-type=
"String"
/>
<element
name=
"fail-message-id"
value-type=
"String"
/>
<entity-ref
name=
"name"
type=
"map"
/>
<entity-ref
name=
"name"
type=
"map"
/>
</entity>
</entity>
<entity
name=
"name"
class-name=
"TransactionName"
>
<entity
name=
"name"
class-name=
"TransactionName"
>
...
@@ -33,8 +31,6 @@
...
@@ -33,8 +31,6 @@
<attribute
name=
"sum"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"sum"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"sum2"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"sum2"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"std"
value-type=
"double"
primitive=
"true"
format=
"0.0"
/>
<attribute
name=
"std"
value-type=
"double"
primitive=
"true"
format=
"0.0"
/>
<element
name=
"success-message-id"
value-type=
"String"
/>
<element
name=
"fail-message-id"
value-type=
"String"
/>
</entity>
</entity>
</model>
</model>
cat-consumer/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
7d1378bc
...
@@ -84,6 +84,10 @@
...
@@ -84,6 +84,10 @@
<requirement>
<requirement>
<role>
com.dianping.cat.message.spi.MessageManager
</role>
<role>
com.dianping.cat.message.spi.MessageManager
</role>
</requirement>
</requirement>
<requirement>
<role>
com.dianping.cat.message.spi.MessageStorage
</role>
<role-hint>
html
</role-hint>
</requirement>
</requirements>
</requirements>
</component>
</component>
</components>
</components>
...
...
cat-consumer/src/test/java/com/dianping/cat/consumer/ManyAnalyzerTest.java
浏览文件 @
7d1378bc
...
@@ -61,11 +61,6 @@ public class ManyAnalyzerTest extends ComponentTestCase {
...
@@ -61,11 +61,6 @@ public class ManyAnalyzerTest extends ComponentTestCase {
protected
void
store
(
List
<
AnalyzerResult
>
result
)
{
protected
void
store
(
List
<
AnalyzerResult
>
result
)
{
}
}
@Override
public
AnalyzerResult
generate
(
String
domain
)
{
// TODO Auto-generated method stub
return
null
;
}
}
}
public
static
class
MockAnalyzer2
extends
public
static
class
MockAnalyzer2
extends
...
@@ -89,11 +84,6 @@ public class ManyAnalyzerTest extends ComponentTestCase {
...
@@ -89,11 +84,6 @@ public class ManyAnalyzerTest extends ComponentTestCase {
protected
void
store
(
List
<
AnalyzerResult
>
result
)
{
protected
void
store
(
List
<
AnalyzerResult
>
result
)
{
}
}
@Override
public
AnalyzerResult
generate
(
String
domain
)
{
// TODO Auto-generated method stub
return
null
;
}
}
}
public
static
class
MockAnalyzer3
extends
public
static
class
MockAnalyzer3
extends
...
@@ -117,11 +107,6 @@ public class ManyAnalyzerTest extends ComponentTestCase {
...
@@ -117,11 +107,6 @@ public class ManyAnalyzerTest extends ComponentTestCase {
protected
void
store
(
List
<
AnalyzerResult
>
result
)
{
protected
void
store
(
List
<
AnalyzerResult
>
result
)
{
}
}
@Override
public
AnalyzerResult
generate
(
String
domain
)
{
// TODO Auto-generated method stub
return
null
;
}
}
}
public
static
class
AnalyzerResult
{
public
static
class
AnalyzerResult
{
...
...
cat-consumer/src/test/java/com/dianping/cat/consumer/OneAnalyzerTwoDurationTest.java
浏览文件 @
7d1378bc
...
@@ -79,11 +79,6 @@ public class OneAnalyzerTwoDurationTest extends ComponentTestCase {
...
@@ -79,11 +79,6 @@ public class OneAnalyzerTwoDurationTest extends ComponentTestCase {
protected
void
store
(
List
<
AnalyzerResult
>
result
)
{
protected
void
store
(
List
<
AnalyzerResult
>
result
)
{
}
}
@Override
public
AnalyzerResult
generate
(
String
domain
)
{
// TODO Auto-generated method stub
return
null
;
}
}
}
public
static
class
AnalyzerResult
{
public
static
class
AnalyzerResult
{
...
...
cat-consumer/src/test/java/com/dianping/cat/consumer/failure/FailureAnalyzerStoreTest.java
浏览文件 @
7d1378bc
...
@@ -22,6 +22,8 @@ import com.site.lookup.ComponentTestCase;
...
@@ -22,6 +22,8 @@ import com.site.lookup.ComponentTestCase;
@RunWith
(
JUnit4
.
class
)
@RunWith
(
JUnit4
.
class
)
public
class
FailureAnalyzerStoreTest
extends
ComponentTestCase
{
public
class
FailureAnalyzerStoreTest
extends
ComponentTestCase
{
private
String
m_domain
=
"middleware"
;
private
String
m_domain
=
"middleware"
;
private
String
m_host
=
"127.0.0.1"
;
@Test
@Test
public
void
testLookup
()
throws
Exception
{
public
void
testLookup
()
throws
Exception
{
Handler
failure
=
lookup
(
Handler
.
class
,
"failure-handler"
);
Handler
failure
=
lookup
(
Handler
.
class
,
"failure-handler"
);
...
@@ -51,9 +53,9 @@ public class FailureAnalyzerStoreTest extends ComponentTestCase {
...
@@ -51,9 +53,9 @@ public class FailureAnalyzerStoreTest extends ComponentTestCase {
tree
.
setMessageId
(
"MessageId"
+
i
);
tree
.
setMessageId
(
"MessageId"
+
i
);
tree
.
setThreadId
(
"Thread"
+
i
);
tree
.
setThreadId
(
"Thread"
+
i
);
tree
.
setDomain
(
m_domain
);
tree
.
setDomain
(
m_domain
);
tree
.
setHostName
(
"middleware"
);
tree
.
setHostName
(
m_host
);
tree
.
setIpAddress
(
m_host
);
tree
.
setMessage
(
t
);
tree
.
setMessage
(
t
);
tree
.
setIpAddress
(
"192.168.8."
+
i
%
4
);
t
.
setDuration
(
3
*
1000
);
t
.
setDuration
(
3
*
1000
);
t
.
setTimestamp
(
start
+
1000L
*
60
*
i
);
t
.
setTimestamp
(
start
+
1000L
*
60
*
i
);
analyzer
.
process
(
tree
);
analyzer
.
process
(
tree
);
...
@@ -64,7 +66,7 @@ public class FailureAnalyzerStoreTest extends ComponentTestCase {
...
@@ -64,7 +66,7 @@ public class FailureAnalyzerStoreTest extends ComponentTestCase {
List
<
FailureReport
>
report
=
analyzer
.
generate
();
List
<
FailureReport
>
report
=
analyzer
.
generate
();
analyzer
.
store
(
report
);
analyzer
.
store
(
report
);
FailureReport
targetReport
=
analyzer
.
generateByDomain
(
m_domain
);
FailureReport
targetReport
=
analyzer
.
generateByDomain
AndIp
(
m_domain
,
m_host
);
DefaultJsonBuilder
builder
=
new
DefaultJsonBuilder
();
DefaultJsonBuilder
builder
=
new
DefaultJsonBuilder
();
builder
.
visitFailureReport
(
targetReport
);
builder
.
visitFailureReport
(
targetReport
);
...
@@ -91,6 +93,8 @@ public class FailureAnalyzerStoreTest extends ComponentTestCase {
...
@@ -91,6 +93,8 @@ public class FailureAnalyzerStoreTest extends ComponentTestCase {
tree
.
setMessageId
(
"thread0001"
);
tree
.
setMessageId
(
"thread0001"
);
tree
.
setDomain
(
m_domain
);
tree
.
setDomain
(
m_domain
);
tree
.
setHostName
(
"middleware"
);
tree
.
setHostName
(
"middleware"
);
tree
.
setIpAddress
(
m_host
);
tree
.
setThreadId
(
"Thread"
+
i
%
5
);
tree
.
setMessage
(
t
);
tree
.
setMessage
(
t
);
t
.
setDuration
(
3
*
1000
);
t
.
setDuration
(
3
*
1000
);
t
.
setTimestamp
(
start
+
1000L
*
60
*
i
);
t
.
setTimestamp
(
start
+
1000L
*
60
*
i
);
...
@@ -100,11 +104,10 @@ public class FailureAnalyzerStoreTest extends ComponentTestCase {
...
@@ -100,11 +104,10 @@ public class FailureAnalyzerStoreTest extends ComponentTestCase {
List
<
FailureReport
>
report
=
analyzer
.
generate
();
List
<
FailureReport
>
report
=
analyzer
.
generate
();
analyzer
.
store
(
report
);
analyzer
.
store
(
report
);
FailureReport
targetReport
=
analyzer
.
generateByDomain
(
m_domain
);
FailureReport
targetReport
=
analyzer
.
generateByDomain
AndIp
(
m_domain
,
m_host
);
String
parentPath
=
analyzer
.
getReportPath
();
String
pathname
=
analyzer
.
getFailureFilePath
(
targetReport
);
String
pathname
=
parentPath
+
analyzer
.
getFailureFileName
(
targetReport
);
File
storeFile
=
new
File
(
pathname
);
File
storeFile
=
new
File
(
pathname
+
".html"
);
Assert
.
assertEquals
(
"Check file is exist!"
,
true
,
storeFile
.
exists
());
Assert
.
assertEquals
(
"Check file is exist!"
,
true
,
storeFile
.
exists
());
String
realResult
=
Files
.
forIO
().
readFrom
(
storeFile
,
"utf-8"
);
String
realResult
=
Files
.
forIO
().
readFrom
(
storeFile
,
"utf-8"
);
String
exceptedResult
=
FailureReportStore
.
getStoreString
(
targetReport
);
String
exceptedResult
=
FailureReportStore
.
getStoreString
(
targetReport
);
...
...
cat-consumer/src/test/java/com/dianping/cat/consumer/failure/FailureAnalyzerTest.java
浏览文件 @
7d1378bc
...
@@ -22,21 +22,26 @@ import com.site.lookup.ComponentTestCase;
...
@@ -22,21 +22,26 @@ import com.site.lookup.ComponentTestCase;
@RunWith
(
JUnit4
.
class
)
@RunWith
(
JUnit4
.
class
)
public
class
FailureAnalyzerTest
extends
ComponentTestCase
{
public
class
FailureAnalyzerTest
extends
ComponentTestCase
{
private
String
m_domain
=
"domain1"
;
private
String
m_domain
=
"domain1"
;
private
String
m_host
=
"127.0.0.1"
;
private
static
final
long
HOUR
=
1000L
*
60
*
60
;
@Test
@Test
public
void
testFailureHandler
()
throws
Exception
{
public
void
testFailureHandler
()
throws
Exception
{
long
current
=
System
.
currentTimeMillis
();
long
current
=
System
.
currentTimeMillis
();
long
duration
=
60
*
60
*
1000
;
long
duration
=
60
*
60
*
1000
;
long
extraTime
=
5
*
60
*
1000
;
long
extraTime
=
5
*
60
*
1000
;
long
start
=
current
-
current
%
(
60
*
60
*
1000
);
long
start
=
current
-
current
%
(
60
*
60
*
1000
)
-
HOUR
;
AnalyzerFactory
factory
=
lookup
(
AnalyzerFactory
.
class
);
AnalyzerFactory
factory
=
lookup
(
AnalyzerFactory
.
class
);
FailureReportAnalyzer
analyzer
=
(
FailureReportAnalyzer
)
factory
.
create
(
"failure"
,
start
,
duration
,
m_domain
,
FailureReportAnalyzer
analyzer
=
(
FailureReportAnalyzer
)
factory
.
create
(
"failure"
,
start
,
duration
,
m_domain
,
extraTime
);
extraTime
);
int
number
=
300
*
10
;
// Just for one hour
int
number
=
60
*
10
;
int
threadNumber
=
10
;
int
threadNumber
=
10
;
DefaultEvent
e11
=
new
DefaultEvent
(
"Error"
,
"testError"
);
DefaultEvent
e11
=
new
DefaultEvent
(
"Error"
,
"testError"
);
DefaultEvent
e21
=
new
DefaultEvent
(
"Exception"
,
"testException1"
);
DefaultEvent
e21
=
new
DefaultEvent
(
"Exception"
,
"testException1"
);
DefaultEvent
e31
=
new
DefaultEvent
(
"RuntimeException"
,
"testRuntimeException1"
);
DefaultEvent
e31
=
new
DefaultEvent
(
"RuntimeException"
,
"testRuntimeException1"
);
...
@@ -45,6 +50,8 @@ public class FailureAnalyzerTest extends ComponentTestCase {
...
@@ -45,6 +50,8 @@ public class FailureAnalyzerTest extends ComponentTestCase {
MessageTree
tree
=
new
DefaultMessageTree
();
MessageTree
tree
=
new
DefaultMessageTree
();
tree
.
setMessageId
(
"xx0001"
);
tree
.
setMessageId
(
"xx0001"
);
tree
.
setDomain
(
m_domain
);
tree
.
setDomain
(
m_domain
);
tree
.
setHostName
(
m_host
);
tree
.
setIpAddress
(
m_host
);
DefaultTransaction
t1
=
new
DefaultTransaction
(
"T1"
,
"N1"
,
null
);
DefaultTransaction
t1
=
new
DefaultTransaction
(
"T1"
,
"N1"
,
null
);
DefaultTransaction
t2
=
new
DefaultTransaction
(
"T2"
,
"N2"
,
null
);
DefaultTransaction
t2
=
new
DefaultTransaction
(
"T2"
,
"N2"
,
null
);
DefaultTransaction
t3
=
new
DefaultTransaction
(
"T3"
,
"N3"
,
null
);
DefaultTransaction
t3
=
new
DefaultTransaction
(
"T3"
,
"N3"
,
null
);
...
@@ -61,7 +68,6 @@ public class FailureAnalyzerTest extends ComponentTestCase {
...
@@ -61,7 +68,6 @@ public class FailureAnalyzerTest extends ComponentTestCase {
t1
.
addChild
(
e11
);
t1
.
addChild
(
e11
);
tree
.
setMessage
(
t1
);
tree
.
setMessage
(
t1
);
long
ct
=
System
.
nanoTime
();
long
ct
=
System
.
nanoTime
();
for
(
int
i
=
0
;
i
<
number
;
i
++)
{
for
(
int
i
=
0
;
i
<
number
;
i
++)
{
if
(
i
==
1
)
{
if
(
i
==
1
)
{
...
@@ -69,8 +75,6 @@ public class FailureAnalyzerTest extends ComponentTestCase {
...
@@ -69,8 +75,6 @@ public class FailureAnalyzerTest extends ComponentTestCase {
}
}
long
addTime
=
6
*
1000
*
i
;
long
addTime
=
6
*
1000
*
i
;
long
timestamp
=
start
+
addTime
;
long
timestamp
=
start
+
addTime
;
tree
.
setIpAddress
(
"192.168.1."
+
i
);
t1
.
setTimestamp
(
timestamp
);
t1
.
setTimestamp
(
timestamp
);
t2
.
setTimestamp
(
timestamp
);
t2
.
setTimestamp
(
timestamp
);
t3
.
setTimestamp
(
timestamp
);
t3
.
setTimestamp
(
timestamp
);
...
@@ -79,7 +83,7 @@ public class FailureAnalyzerTest extends ComponentTestCase {
...
@@ -79,7 +83,7 @@ public class FailureAnalyzerTest extends ComponentTestCase {
e22
.
setTimestamp
(
timestamp
);
e22
.
setTimestamp
(
timestamp
);
e31
.
setTimestamp
(
timestamp
);
e31
.
setTimestamp
(
timestamp
);
e32
.
setTimestamp
(
timestamp
);
e32
.
setTimestamp
(
timestamp
);
tree
.
setThreadId
(
"thread"
+
i
%
threadNumber
);
tree
.
setThreadId
(
"thread"
+
i
%
threadNumber
);
analyzer
.
process
(
tree
);
analyzer
.
process
(
tree
);
}
}
...
@@ -87,12 +91,12 @@ public class FailureAnalyzerTest extends ComponentTestCase {
...
@@ -87,12 +91,12 @@ public class FailureAnalyzerTest extends ComponentTestCase {
System
.
out
.
println
(
"time: "
+
time
/
1
e6
+
" ms,"
+
(
time
/
1
e6
/
number
)
+
" ms each"
);
System
.
out
.
println
(
"time: "
+
time
/
1
e6
+
" ms,"
+
(
time
/
1
e6
/
number
)
+
" ms each"
);
FailureReport
report
=
analyzer
.
generateByDomain
(
m_domain
);
FailureReport
report
=
analyzer
.
generateByDomain
AndIp
(
m_domain
,
m_host
);
assertEquals
(
"Check the domain"
,
report
.
getDomain
(),
"domain1"
);
assertEquals
(
"Check the domain"
,
report
.
getDomain
(),
"domain1"
);
assertEquals
(
"Check the machines"
,
number
,
report
.
getMachines
().
getMachines
().
siz
e
());
assertEquals
(
"Check the machines"
,
m_host
,
report
.
getMachin
e
());
assertEquals
(
"Check the threads"
,
threadNumber
,
report
.
getThreads
().
getThreads
().
size
());
assertEquals
(
"Check the threads"
,
threadNumber
,
report
.
getThreads
().
getThreads
().
size
());
Date
startDate
=
report
.
getStartTime
();
Date
startDate
=
report
.
getStartTime
();
Date
endDate
=
report
.
getEndTime
();
Date
endDate
=
report
.
getEndTime
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
...
@@ -111,14 +115,15 @@ public class FailureAnalyzerTest extends ComponentTestCase {
...
@@ -111,14 +115,15 @@ public class FailureAnalyzerTest extends ComponentTestCase {
for
(
int
i
=
0
;
i
<
number
/
10
;
i
++)
{
for
(
int
i
=
0
;
i
<
number
/
10
;
i
++)
{
String
minuteStr
=
sdf2
.
format
(
startDate
);
String
minuteStr
=
sdf2
.
format
(
startDate
);
Segment
temp
=
segments
.
get
(
minuteStr
);
Segment
temp
=
segments
.
get
(
minuteStr
);
List
<
Entry
>
entries
=
temp
.
getEntries
();
List
<
Entry
>
entries
=
temp
.
getEntries
();
if
(
entries
==
null
)
{
if
(
entries
==
null
)
{
System
.
out
.
println
(
minuteStr
);
System
.
out
.
println
(
minuteStr
);
}
else
{
}
else
{
assertEquals
(
"Check the segment size "
,
50
,
entries
.
size
());
assertEquals
(
"Check the segment size "
,
50
,
entries
.
size
());
}
}
startDate
.
setTime
(
startDate
.
getTime
()
+
1000
*
60
);
startDate
.
setTime
(
startDate
.
getTime
()
+
1000
*
60
);
}
}
}
}
...
@@ -128,9 +133,9 @@ public class FailureAnalyzerTest extends ComponentTestCase {
...
@@ -128,9 +133,9 @@ public class FailureAnalyzerTest extends ComponentTestCase {
long
current
=
System
.
currentTimeMillis
();
long
current
=
System
.
currentTimeMillis
();
long
duration
=
60
*
60
*
1000
;
long
duration
=
60
*
60
*
1000
;
long
extraTime
=
5
*
60
*
1000
;
long
extraTime
=
5
*
60
*
1000
;
long
start
=
current
-
current
%
(
60
*
60
*
1000
);
long
start
=
current
-
current
%
(
60
*
60
*
1000
)
-
HOUR
;
String
domain
=
"domain1"
;
String
domain
=
"domain1"
;
AnalyzerFactory
factory
=
lookup
(
AnalyzerFactory
.
class
);
AnalyzerFactory
factory
=
lookup
(
AnalyzerFactory
.
class
);
FailureReportAnalyzer
analyzer
=
(
FailureReportAnalyzer
)
factory
.
create
(
"failure"
,
start
,
duration
,
domain
,
FailureReportAnalyzer
analyzer
=
(
FailureReportAnalyzer
)
factory
.
create
(
"failure"
,
start
,
duration
,
domain
,
extraTime
);
extraTime
);
...
@@ -141,16 +146,16 @@ public class FailureAnalyzerTest extends ComponentTestCase {
...
@@ -141,16 +146,16 @@ public class FailureAnalyzerTest extends ComponentTestCase {
tree
.
setMessageId
(
"thread0001"
);
tree
.
setMessageId
(
"thread0001"
);
tree
.
setDomain
(
m_domain
);
tree
.
setDomain
(
m_domain
);
tree
.
setHostName
(
"middleware"
);
tree
.
setHostName
(
"middleware"
);
tree
.
setIpAddress
(
"127.0.0."
+
i
);
tree
.
setIpAddress
(
m_host
);
tree
.
setMessage
(
t
);
tree
.
setMessage
(
t
);
t
.
setDuration
(
3
*
1000
);
t
.
setDuration
(
3
*
1000
);
t
.
setTimestamp
(
start
+
1000L
*
60
*
i
);
t
.
setTimestamp
(
start
+
1000L
*
60
*
i
);
analyzer
.
process
(
tree
);
analyzer
.
process
(
tree
);
// analyzer.process(tree);
// analyzer.process(tree);
}
}
FailureReport
report
=
analyzer
.
generateByDomain
(
domain
);
FailureReport
report
=
analyzer
.
generateByDomain
AndIp
(
domain
,
m_host
);
assertEquals
(
"Check the
Machines"
,
number
,
report
.
getMachines
().
getMachines
().
siz
e
());
assertEquals
(
"Check the
machines"
,
m_host
,
report
.
getMachin
e
());
assertEquals
(
"Check the domain"
,
report
.
getDomain
(),
"domain1"
);
assertEquals
(
"Check the domain"
,
report
.
getDomain
(),
"domain1"
);
Date
startDate
=
report
.
getStartTime
();
Date
startDate
=
report
.
getStartTime
();
...
...
cat-consumer/src/test/java/com/dianping/cat/consumer/transaction/TransactionReportMessageAnalyzerTest.java
浏览文件 @
7d1378bc
...
@@ -3,14 +3,11 @@
...
@@ -3,14 +3,11 @@
*/
*/
package
com.dianping.cat.consumer.transaction
;
package
com.dianping.cat.consumer.transaction
;
import
static
junit
.
framework
.
Assert
.
assertEquals
;
import
org.junit.After
;
import
org.junit.AfterClass
;
import
org.junit.Before
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runners.JUnit4
;
import
com.dianping.cat.consumer.AnalyzerFactory
;
import
com.dianping.cat.consumer.transaction.model.entity.TransactionName
;
import
com.dianping.cat.consumer.transaction.model.entity.TransactionName
;
import
com.dianping.cat.consumer.transaction.model.entity.TransactionReport
;
import
com.dianping.cat.consumer.transaction.model.entity.TransactionReport
;
import
com.dianping.cat.consumer.transaction.model.entity.TransactionType
;
import
com.dianping.cat.consumer.transaction.model.entity.TransactionType
;
...
@@ -19,40 +16,15 @@ import com.dianping.cat.message.Message;
...
@@ -19,40 +16,15 @@ import com.dianping.cat.message.Message;
import
com.dianping.cat.message.internal.DefaultTransaction
;
import
com.dianping.cat.message.internal.DefaultTransaction
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.internal.DefaultMessageTree
;
import
com.dianping.cat.message.spi.internal.DefaultMessageTree
;
import
com.site.lookup.ComponentTestCase
;
/**
/**
* @author sean.wang
* @author sean.wang
* @since Jan 5, 2012
* @since Jan 5, 2012
*/
*/
public
class
TransactionReportMessageAnalyzerTest
{
@RunWith
(
JUnit4
.
class
)
public
class
TransactionReportMessageAnalyzerTest
extends
ComponentTestCase
{
/**
* @throws java.lang.Exception
*/
@BeforeClass
public
static
void
setUpBeforeClass
()
throws
Exception
{
}
/**
* @throws java.lang.Exception
*/
@AfterClass
public
static
void
tearDownAfterClass
()
throws
Exception
{
}
/**
* @throws java.lang.Exception
*/
@Before
public
void
setUp
()
throws
Exception
{
}
/**
* @throws java.lang.Exception
*/
@After
public
void
tearDown
()
throws
Exception
{
}
/**
/**
* Test method for {@link com.dianping.cat.consumer.transaction.TransactionReportAnalyzer#process(com.dianping.cat.message.spi.MessageTree)}.
* Test method for {@link com.dianping.cat.consumer.transaction.TransactionReportAnalyzer#process(com.dianping.cat.message.spi.MessageTree)}.
...
@@ -60,8 +32,15 @@ public class TransactionReportMessageAnalyzerTest {
...
@@ -60,8 +32,15 @@ public class TransactionReportMessageAnalyzerTest {
* @throws InterruptedException
* @throws InterruptedException
*/
*/
@Test
@Test
public
void
testCommonGenerate
()
throws
InterruptedException
{
public
void
testCommonGenerate
()
throws
Exception
{
TransactionReportAnalyzer
analyzer
=
new
TransactionReportAnalyzer
();
long
current
=
System
.
currentTimeMillis
();
long
duration
=
60
*
60
*
1000
;
long
extraTime
=
5
*
60
*
1000
;
long
start
=
current
-
current
%
(
60
*
60
*
1000
)
-
1000L
*
60
*
60
;
AnalyzerFactory
factory
=
lookup
(
AnalyzerFactory
.
class
);
TransactionReportAnalyzer
analyzer
=
(
TransactionReportAnalyzer
)
factory
.
create
(
"transaction"
,
start
,
duration
,
"testDomain"
,
extraTime
);
for
(
int
i
=
1
;
i
<=
1000
;
i
++)
{
for
(
int
i
=
1
;
i
<=
1000
;
i
++)
{
MessageTree
tree
=
new
DefaultMessageTree
();
MessageTree
tree
=
new
DefaultMessageTree
();
...
@@ -103,8 +82,6 @@ public class TransactionReportMessageAnalyzerTest {
...
@@ -103,8 +82,6 @@ public class TransactionReportMessageAnalyzerTest {
assertEquals
(
2000.0
,
n1
.
getMax
());
assertEquals
(
2000.0
,
n1
.
getMax
());
assertEquals
(
1001.0
,
n1
.
getAvg
());
assertEquals
(
1001.0
,
n1
.
getAvg
());
assertEquals
(
1001000.0
,
n1
.
getSum
());
assertEquals
(
1001000.0
,
n1
.
getSum
());
assertEquals
(
"999"
,
n1
.
getSuccessMessageId
());
assertEquals
(
"1000"
,
n1
.
getFailMessageId
());
TransactionType
typeA1
=
report
.
getTypes
().
get
(
"A-1"
);
TransactionType
typeA1
=
report
.
getTypes
().
get
(
"A-1"
);
TransactionName
n2
=
typeA1
.
getNames
().
get
(
"n2"
);
TransactionName
n2
=
typeA1
.
getNames
().
get
(
"n2"
);
...
@@ -115,8 +92,6 @@ public class TransactionReportMessageAnalyzerTest {
...
@@ -115,8 +92,6 @@ public class TransactionReportMessageAnalyzerTest {
assertEquals
(
1000.0
,
n2
.
getMax
());
assertEquals
(
1000.0
,
n2
.
getMax
());
assertEquals
(
500.5
,
n2
.
getAvg
());
assertEquals
(
500.5
,
n2
.
getAvg
());
assertEquals
(
500500.0
,
n2
.
getSum
());
assertEquals
(
500500.0
,
n2
.
getSum
());
assertEquals
(
null
,
n2
.
getSuccessMessageId
());
assertEquals
(
null
,
n2
.
getFailMessageId
());
DefaultJsonBuilder
builder
=
new
DefaultJsonBuilder
();
DefaultJsonBuilder
builder
=
new
DefaultJsonBuilder
();
report
.
accept
(
builder
);
report
.
accept
(
builder
);
System
.
out
.
println
(
builder
.
getString
());
System
.
out
.
println
(
builder
.
getString
());
...
...
cat-consumer/src/test/resources/com/dianping/cat/consumer/failure/failure.json
浏览文件 @
7d1378bc
{
{
"domain"
:
"middleware"
,
"domain"
:
"middleware"
,
"machine"
:
"127.0.0.1"
,
"startTime"
:
"2012-01-25 13:00:00"
,
"startTime"
:
"2012-01-25 13:00:00"
,
"endTime"
:
"2012-01-25 13:59:00"
,
"endTime"
:
"2012-01-25 13:59:00"
,
"machines"
:
{
"machines"
:
[
"192.168.8.0"
,
"192.168.8.1"
,
"192.168.8.2"
,
"192.168.8.3"
]
},
"threads"
:
{
"threads"
:
{
"threads"
:
[
"threads"
:
[
"Thread0"
,
"Thread0"
,
...
...
cat-core/src/main/java/com/dianping/cat/message/spi/AbstractMessageAnalyzer.java
浏览文件 @
7d1378bc
...
@@ -33,8 +33,6 @@ public abstract class AbstractMessageAnalyzer<R> implements MessageAnalyzer {
...
@@ -33,8 +33,6 @@ public abstract class AbstractMessageAnalyzer<R> implements MessageAnalyzer {
public
abstract
List
<
R
>
generate
();
public
abstract
List
<
R
>
generate
();
public
abstract
R
generate
(
String
domain
);
protected
abstract
void
process
(
MessageTree
tree
);
protected
abstract
void
process
(
MessageTree
tree
);
protected
abstract
boolean
isTimeout
();
protected
abstract
boolean
isTimeout
();
...
...
cat-home/src/main/java/com/dianping/cat/report/page/failure/FailureData.java
0 → 100644
浏览文件 @
7d1378bc
package
com.dianping.cat.report.page.failure
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.Date
;
import
java.util.Map
;
import
com.dianping.cat.consumer.failure.model.entity.FailureReport
;
import
com.dianping.cat.consumer.failure.model.entity.Segment
;
import
com.dianping.cat.consumer.failure.model.entity.Threads
;
import
com.dianping.cat.consumer.failure.model.transform.DefaultJsonBuilder
;
import
com.dianping.cat.tool.DateUtil
;
import
com.site.helper.Files
;
public
class
FailureData
{
public
String
getFailureJsonDate
(
FailureReport
report
)
{
DefaultJsonBuilder
builder
=
new
DefaultJsonBuilder
();
report
.
accept
(
builder
);
return
builder
.
getString
();
}
/*public String getFailureDataFromMemory(FailureReportAnalyzer analyzer, String domain) {
FailureReport report = analyzer.generateByDomain(domain);
return getFailureJsonDate(report);
}
*/
public
String
getFailureDataFromFile
(
String
basePath
,
String
file
)
{
String
result
=
""
;
try
{
result
=
Files
.
forIO
().
readFrom
(
new
File
(
basePath
+
file
),
"utf-8"
);
result
=
result
.
substring
(
result
.
indexOf
(
"<body>"
)
+
6
,
result
.
indexOf
(
"</body>"
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
result
;
}
public
String
getFailureDataByNew
(
int
pos
,
String
domain
)
{
long
currentTime
=
System
.
currentTimeMillis
();
long
currentStart
=
currentTime
-
currentTime
%
DateUtil
.
HOUR
;
long
lastStart
=
currentTime
-
currentTime
%
DateUtil
.
HOUR
-
DateUtil
.
HOUR
;
Date
date
=
new
Date
();
if
(
pos
==
1
)
{
date
.
setTime
(
currentStart
);
}
else
{
date
.
setTime
(
lastStart
);
}
FailureReport
report
=
new
FailureReport
();
//TODO
//report.setMachines(new Machines());
report
.
setThreads
(
new
Threads
());
report
.
setStartTime
(
date
);
report
.
setEndTime
(
new
Date
(
date
.
getTime
()
+
DateUtil
.
HOUR
-
DateUtil
.
MINUTE
));
report
.
setDomain
(
domain
);
long
start
=
report
.
getStartTime
().
getTime
();
long
endTime
=
report
.
getEndTime
().
getTime
();
Map
<
String
,
Segment
>
segments
=
report
.
getSegments
();
for
(;
start
<=
endTime
;
start
=
start
+
60
*
1000
)
{
String
minute
=
DateUtil
.
SDF_SEG
.
format
(
new
Date
(
start
));
segments
.
put
(
minute
,
new
Segment
(
minute
));
}
return
getFailureJsonDate
(
report
);
}
public
String
getFailureDataFromRemote
()
{
return
""
;
}
}
cat-home/src/main/java/com/dianping/cat/report/page/failure/Handler.java
浏览文件 @
7d1378bc
package
com.dianping.cat.report.page.failure
;
package
com.dianping.cat.report.page.failure
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.ServletException
;
import
javax.servlet.ServletException
;
import
com.dianping.cat.consumer.RealtimeConsumer
;
import
com.dianping.cat.consumer.RealtimeConsumer
;
import
com.dianping.cat.consumer.failure.FailureReportAnalyzer
;
import
com.dianping.cat.consumer.failure.FailureReportAnalyzer
;
import
com.dianping.cat.consumer.failure.model.entity.FailureReport
;
import
com.dianping.cat.consumer.failure.model.entity.FailureReport
;
import
com.dianping.cat.consumer.failure.model.entity.Segment
;
import
com.dianping.cat.consumer.failure.model.entity.Threads
;
import
com.dianping.cat.consumer.failure.model.transform.DefaultJsonBuilder
;
import
com.dianping.cat.message.spi.MessageConsumer
;
import
com.dianping.cat.message.spi.MessageConsumer
;
import
com.dianping.cat.report.ReportPage
;
import
com.dianping.cat.report.ReportPage
;
import
com.site.helper.Files
;
import
com.site.lookup.annotation.Inject
;
import
com.site.lookup.annotation.Inject
;
import
com.site.web.mvc.PageHandler
;
import
com.site.web.mvc.PageHandler
;
import
com.site.web.mvc.annotation.InboundActionMeta
;
import
com.site.web.mvc.annotation.InboundActionMeta
;
...
@@ -20,8 +28,6 @@ import com.site.web.mvc.annotation.PayloadMeta;
...
@@ -20,8 +28,6 @@ import com.site.web.mvc.annotation.PayloadMeta;
public
class
Handler
implements
PageHandler
<
Context
>
{
public
class
Handler
implements
PageHandler
<
Context
>
{
private
static
final
String
DEFAULT_DOMAIN
=
"User"
;
private
static
final
String
MEMORY_CURRENT
=
"memory-current"
;
private
static
final
String
MEMORY_CURRENT
=
"memory-current"
;
private
static
final
String
MEMORY_LAST
=
"memory-last"
;
private
static
final
String
MEMORY_LAST
=
"memory-last"
;
...
@@ -30,7 +36,15 @@ public class Handler implements PageHandler<Context> {
...
@@ -30,7 +36,15 @@ public class Handler implements PageHandler<Context> {
private
static
final
long
HOUR
=
60
*
MINUTE
;
private
static
final
long
HOUR
=
60
*
MINUTE
;
private
static
final
SimpleDateFormat
SDF
=
new
SimpleDateFormat
(
"yyyyMMddHH"
);
private
static
final
long
SECOND
=
1000L
;
private
static
final
SimpleDateFormat
SDF
=
new
SimpleDateFormat
(
"yyyyMMddHHmm"
);
private
static
final
SimpleDateFormat
SDF_SEG
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
);
private
static
String
DEFAULT_IP
=
null
;
private
static
String
DEFAULT_DOMAIN
=
null
;
@Inject
@Inject
private
JspViewer
m_jspViewer
;
private
JspViewer
m_jspViewer
;
...
@@ -38,58 +52,35 @@ public class Handler implements PageHandler<Context> {
...
@@ -38,58 +52,35 @@ public class Handler implements PageHandler<Context> {
@Inject
(
type
=
MessageConsumer
.
class
,
value
=
"realtime"
)
@Inject
(
type
=
MessageConsumer
.
class
,
value
=
"realtime"
)
private
RealtimeConsumer
m_consumer
;
private
RealtimeConsumer
m_consumer
;
@Override
private
FailureReport
getFailureReport
(
int
pos
,
String
domain
)
{
@PayloadMeta
(
Payload
.
class
)
long
currentTime
=
System
.
currentTimeMillis
();
@InboundActionMeta
(
name
=
"f"
)
long
currentStart
=
currentTime
-
currentTime
%
HOUR
;
public
void
handleInbound
(
Context
ctx
)
throws
ServletException
,
IOException
{
long
lastStart
=
currentTime
-
currentTime
%
HOUR
-
HOUR
;
// display only, no action here
Date
date
=
new
Date
();
}
if
(
pos
==
1
)
{
date
.
setTime
(
currentStart
);
@Override
@OutboundActionMeta
(
name
=
"f"
)
public
void
handleOutbound
(
Context
ctx
)
throws
ServletException
,
IOException
{
Model
model
=
new
Model
(
ctx
);
model
.
setAction
(
Action
.
VIEW
);
model
.
setPage
(
ReportPage
.
FAILURE
);
Payload
payload
=
ctx
.
getPayload
();
String
file
=
getFailureReportName
(
payload
,
model
);
String
domain
=
payload
.
getDomain
();
if
(
null
==
domain
)
{
model
.
setDomain
(
DEFAULT_DOMAIN
);
domain
=
DEFAULT_DOMAIN
;
}
else
{
}
else
{
model
.
setDomain
(
payload
.
getDomain
()
);
date
.
setTime
(
lastStart
);
}
}
if
(
file
.
equals
(
MEMORY_CURRENT
))
{
FailureReport
report
=
new
FailureReport
();
FailureReportAnalyzer
analyzer
=
(
FailureReportAnalyzer
)
m_consumer
.
getCurrentAnalyzer
(
"failure"
);
//report.setMachines(new Machines());
report
.
setThreads
(
new
Threads
());
if
(
analyzer
==
null
)
{
report
.
setStartTime
(
date
);
System
.
out
.
println
(
"analyzer is null"
);
report
.
setEndTime
(
new
Date
(
date
.
getTime
()
+
HOUR
-
MINUTE
));
model
.
setReport
(
new
FailureReport
());
report
.
setDomain
(
domain
);
}
else
{
long
start
=
report
.
getStartTime
().
getTime
();
model
.
setReport
(
analyzer
.
generateByDomain
(
domain
));
long
endTime
=
report
.
getEndTime
().
getTime
();
}
Map
<
String
,
Segment
>
segments
=
report
.
getSegments
();
}
else
if
(
file
.
equals
(
MEMORY_LAST
))
{
for
(;
start
<=
endTime
;
start
=
start
+
60
*
1000
)
{
FailureReportAnalyzer
analyzer
=
(
FailureReportAnalyzer
)
m_consumer
.
getLastAnalyzer
(
"failure"
);
String
minute
=
SDF_SEG
.
format
(
new
Date
(
start
));
segments
.
put
(
minute
,
new
Segment
(
minute
));
if
(
analyzer
==
null
)
{
System
.
out
.
println
(
"analyzer is null"
);
model
.
setReport
(
new
FailureReport
());
}
else
{
//TODO
getReport
(
""
);
model
.
setReport
(
analyzer
.
generateByDomain
(
domain
));
}
}
else
{
model
.
setReport
(
new
FailureReport
());
}
}
m_jspViewer
.
view
(
ctx
,
model
)
;
return
report
;
}
}
private
String
getFailureReportName
(
Payload
payload
,
Model
model
)
{
private
String
getFailureReportName
(
Payload
payload
,
Model
model
)
{
long
currentTime
=
System
.
currentTimeMillis
();
long
currentTimeMillis
=
System
.
currentTimeMillis
();
long
currentTime
=
currentTimeMillis
;
long
currentStart
=
currentTime
-
currentTime
%
HOUR
;
long
currentStart
=
currentTime
-
currentTime
%
HOUR
;
long
lastStart
=
currentTime
-
currentTime
%
HOUR
-
HOUR
;
long
lastStart
=
currentTime
-
currentTime
%
HOUR
-
HOUR
;
long
startLong
=
currentStart
;
long
startLong
=
currentStart
;
...
@@ -105,13 +96,6 @@ public class Handler implements PageHandler<Context> {
...
@@ -105,13 +96,6 @@ public class Handler implements PageHandler<Context> {
}
else
{
}
else
{
reportStart
=
SDF
.
format
(
currentStart
);
reportStart
=
SDF
.
format
(
currentStart
);
}
}
String
domain
=
payload
.
getDomain
();
if
(
null
==
domain
)
{
model
.
setDomain
(
DEFAULT_DOMAIN
);
domain
=
DEFAULT_DOMAIN
;
}
else
{
model
.
setDomain
(
payload
.
getDomain
());
}
long
computeStart
=
startLong
+
payload
.
getMethod
()
*
HOUR
;
long
computeStart
=
startLong
+
payload
.
getMethod
()
*
HOUR
;
if
(
computeStart
>
currentStart
)
{
if
(
computeStart
>
currentStart
)
{
...
@@ -119,6 +103,16 @@ public class Handler implements PageHandler<Context> {
...
@@ -119,6 +103,16 @@ public class Handler implements PageHandler<Context> {
}
}
model
.
setCurrent
(
SDF
.
format
(
new
Date
(
computeStart
)));
model
.
setCurrent
(
SDF
.
format
(
new
Date
(
computeStart
)));
long
titleEndTime
=
computeStart
+
HOUR
-
SECOND
;
if
(
titleEndTime
>
currentTimeMillis
)
{
titleEndTime
=
currentTimeMillis
;
}
StringBuilder
title
=
new
StringBuilder
().
append
(
"Domain:"
).
append
(
model
.
getCurrentDomain
());
title
.
append
(
" IP "
).
append
(
model
.
getCurrentIp
());
title
.
append
(
" From "
).
append
(
SDF_SEG
.
format
(
new
Date
(
computeStart
))).
append
(
" To "
).
append
(
SDF_SEG
.
format
(
new
Date
(
titleEndTime
)));
model
.
setReportTitle
(
title
.
toString
());
if
(
computeStart
==
currentStart
)
{
if
(
computeStart
==
currentStart
)
{
return
MEMORY_CURRENT
;
return
MEMORY_CURRENT
;
}
else
if
(
computeStart
==
lastStart
)
{
}
else
if
(
computeStart
==
lastStart
)
{
...
@@ -126,14 +120,103 @@ public class Handler implements PageHandler<Context> {
...
@@ -126,14 +120,103 @@ public class Handler implements PageHandler<Context> {
}
}
StringBuilder
result
=
new
StringBuilder
();
StringBuilder
result
=
new
StringBuilder
();
result
.
append
(
domain
).
append
(
"@"
).
append
(
SDF
.
format
(
new
Date
(
computeStart
))).
append
(
"~
"
).
append
(
result
.
append
(
model
.
getCurrentDomain
()).
append
(
model
.
getCurrentIp
()).
append
(
"-"
).
append
(
SDF
.
format
(
new
Date
(
computeStart
))).
append
(
"-
"
).
append
(
SDF
.
format
(
new
Date
(
computeStart
+
HOUR
))
);
SDF
.
format
(
new
Date
(
computeStart
+
HOUR
-
MINUTE
))).
append
(
".html"
);
return
result
.
toString
();
return
result
.
toString
();
}
}
private
FailureReport
getReport
(
String
file
)
{
private
String
getJsonResultFromFile
(
String
basePath
,
String
file
)
{
// TODO
String
result
=
""
;
//Get to json data and output
try
{
return
new
FailureReport
();
result
=
Files
.
forIO
().
readFrom
(
new
File
(
basePath
+
file
),
"utf-8"
);
result
=
result
.
substring
(
result
.
indexOf
(
"<body>"
)
+
6
,
result
.
indexOf
(
"</body>"
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
result
;
}
@Override
@PayloadMeta
(
Payload
.
class
)
@InboundActionMeta
(
name
=
"f"
)
public
void
handleInbound
(
Context
ctx
)
throws
ServletException
,
IOException
{
// display only, no action here
}
@Override
@OutboundActionMeta
(
name
=
"f"
)
public
void
handleOutbound
(
Context
ctx
)
throws
ServletException
,
IOException
{
Model
model
=
new
Model
(
ctx
);
model
.
setAction
(
Action
.
VIEW
);
model
.
setPage
(
ReportPage
.
FAILURE
);
Payload
payload
=
ctx
.
getPayload
();
FailureReportAnalyzer
analyzerForPage
=
(
FailureReportAnalyzer
)
m_consumer
.
getCurrentAnalyzer
(
"failure"
);
//Set all domain of page
List
<
String
>
domains
=
analyzerForPage
.
getAllDomains
();
Collections
.
sort
(
domains
);
model
.
setDomains
(
domains
);
//Set all ip of the domain
//Set the default domain and default ip
String
domain
=
payload
.
getDomain
();
if
(
null
==
domain
)
{
if
(
domains
!=
null
&&
domains
.
size
()>
0
){
DEFAULT_DOMAIN
=
domains
.
get
(
0
);
model
.
setCurrentDomain
(
DEFAULT_DOMAIN
);
}
else
{
throw
new
RuntimeException
(
"The domain is null!"
);
}
}
else
{
model
.
setCurrentDomain
(
domain
);
}
List
<
String
>
ips
=
analyzerForPage
.
getHostIpByDomain
(
model
.
getCurrentDomain
());
Collections
.
sort
(
ips
);
model
.
setIps
(
ips
);
String
ip
=
payload
.
getIp
();
if
(
null
==
ip
){
if
(
ips
!=
null
&&
ips
.
size
()>
0
){
DEFAULT_IP
=
ips
.
get
(
0
);
model
.
setCurrentIp
(
DEFAULT_IP
);
}
else
{
throw
new
RuntimeException
(
"The ip is null!"
);
}
}
else
{
model
.
setCurrentIp
(
ip
);
}
String
file
=
getFailureReportName
(
payload
,
model
);
domain
=
model
.
getCurrentDomain
();
ip
=
model
.
getCurrentIp
();
if
(
file
.
equals
(
MEMORY_CURRENT
)
||
file
.
equals
(
MEMORY_LAST
))
{
FailureReportAnalyzer
analyzer
;
int
pos
=
0
;
if
(
file
.
equals
(
MEMORY_CURRENT
))
{
analyzer
=
(
FailureReportAnalyzer
)
m_consumer
.
getCurrentAnalyzer
(
"failure"
);
pos
=
1
;
}
else
{
analyzer
=
(
FailureReportAnalyzer
)
m_consumer
.
getLastAnalyzer
(
"failure"
);
pos
=
0
;
}
FailureReport
report
;
if
(
analyzer
==
null
)
{
report
=
getFailureReport
(
pos
,
domain
);
}
else
{
report
=
analyzer
.
generateByDomainAndIp
(
domain
,
ip
);
}
DefaultJsonBuilder
builder
=
new
DefaultJsonBuilder
();
report
.
accept
(
builder
);
model
.
setJsonResult
(
builder
.
getString
());
}
else
{
String
baseFilePath
=
analyzerForPage
.
getReportPath
();
model
.
setJsonResult
(
getJsonResultFromFile
(
baseFilePath
,
file
));
}
m_jspViewer
.
view
(
ctx
,
model
);
}
}
}
}
cat-home/src/main/java/com/dianping/cat/report/page/failure/Model.java
浏览文件 @
7d1378bc
package
com.dianping.cat.report.page.failure
;
package
com.dianping.cat.report.page.failure
;
import
com.dianping.cat.consumer.failure.model.entity.FailureRepor
t
;
import
java.util.Lis
t
;
import
com.dianping.cat.consumer.failure.model.transform.DefaultJsonBuilder
;
import
com.dianping.cat.report.ReportPage
;
import
com.dianping.cat.report.ReportPage
;
import
com.site.web.mvc.ViewModel
;
import
com.site.web.mvc.ViewModel
;
public
class
Model
extends
ViewModel
<
ReportPage
,
Action
,
Context
>
{
public
class
Model
extends
ViewModel
<
ReportPage
,
Action
,
Context
>
{
private
FailureReport
m_report
;
private
String
m_current
;
private
String
m_current
;
private
String
m_domain
;
private
String
m_currentDomain
;
private
String
m_currentIp
;
private
List
<
String
>
m_domains
;
private
List
<
String
>
m_ips
;
private
String
m_jsonResult
;
private
String
m_reportTitle
;
public
Model
(
Context
ctx
)
{
public
Model
(
Context
ctx
)
{
super
(
ctx
);
super
(
ctx
);
}
}
public
String
getCurrent
()
{
return
m_current
;
}
public
String
getCurrentDomain
()
{
return
m_currentDomain
;
}
public
String
getCurrentIp
()
{
return
m_currentIp
;
}
@Override
@Override
public
Action
getDefaultAction
()
{
public
Action
getDefaultAction
()
{
return
Action
.
VIEW
;
return
Action
.
VIEW
;
}
}
public
FailureReport
getReport
()
{
public
List
<
String
>
getDomains
()
{
return
m_report
;
return
m_domains
;
}
}
public
String
getReportInJson
()
{
public
List
<
String
>
getIps
()
{
DefaultJsonBuilder
builder
=
new
DefaultJsonBuilder
();
return
m_ips
;
}
m_report
.
accept
(
builder
);
return
builder
.
getString
();
}
public
void
setReport
(
FailureReport
report
)
{
public
String
getJsonResult
(
)
{
m_report
=
repor
t
;
return
m_jsonResul
t
;
}
}
public
String
get
Current
()
{
public
String
get
ReportTitle
()
{
return
m_
current
;
return
m_
reportTitle
;
}
}
public
void
setCurrent
(
String
current
)
{
public
void
setCurrent
(
String
current
)
{
this
.
m_current
=
current
;
this
.
m_current
=
current
;
}
}
public
String
getDomain
()
{
public
void
setCurrentDomain
(
String
currentDomain
)
{
return
m_domain
;
m_currentDomain
=
currentDomain
;
}
public
void
setCurrentIp
(
String
currentIp
)
{
m_currentIp
=
currentIp
;
}
public
void
setDomains
(
List
<
String
>
domains
)
{
m_domains
=
domains
;
}
public
void
setIps
(
List
<
String
>
ips
)
{
m_ips
=
ips
;
}
}
public
void
set
Domain
(
String
domain
)
{
public
void
set
JsonResult
(
String
jsonResult
)
{
this
.
m_domain
=
domain
;
m_jsonResult
=
jsonResult
;
}
}
public
void
setReportTitle
(
String
reportTitle
)
{
m_reportTitle
=
reportTitle
;
}
public
String
getSimpleCurrentIp
(){
return
m_currentIp
.
replace
(
"."
,
""
);
}
}
}
cat-home/src/main/java/com/dianping/cat/report/page/failure/Payload.java
浏览文件 @
7d1378bc
...
@@ -13,6 +13,9 @@ public class Payload implements ActionPayload<ReportPage, Action> {
...
@@ -13,6 +13,9 @@ public class Payload implements ActionPayload<ReportPage, Action> {
@FieldMeta
(
"domain"
)
@FieldMeta
(
"domain"
)
private
String
m_domain
;
private
String
m_domain
;
@FieldMeta
(
"ip"
)
private
String
m_ip
;
@FieldMeta
(
"start"
)
@FieldMeta
(
"start"
)
private
String
m_current
;
private
String
m_current
;
...
@@ -71,4 +74,11 @@ public class Payload implements ActionPayload<ReportPage, Action> {
...
@@ -71,4 +74,11 @@ public class Payload implements ActionPayload<ReportPage, Action> {
m_page
=
page
;
m_page
=
page
;
}
}
public
String
getIp
()
{
return
m_ip
;
}
public
void
setIp
(
String
ip
)
{
m_ip
=
ip
;
}
}
}
cat-home/src/main/java/com/dianping/cat/tool/DateUtil.java
0 → 100644
浏览文件 @
7d1378bc
package
com.dianping.cat.tool
;
import
java.text.SimpleDateFormat
;
public
class
DateUtil
{
public
static
final
long
SECOND
=
1000L
;
public
static
final
long
MINUTE
=
SECOND
*
60
;
public
static
final
long
HOUR
=
MINUTE
*
60
;
public
static
final
SimpleDateFormat
SDF
=
new
SimpleDateFormat
(
"yyyyMMddHHmm"
);
public
static
final
SimpleDateFormat
SDF_SEG
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
);
}
cat-home/src/main/webapp/css/failure.css
浏览文件 @
7d1378bc
.report-table
{
.report-table
{
border-spacing
:
0
;
border-spacing
:
0
;
width
:
100%
;
}
}
.report-table
th
,
.report-table
td
{
.report-table
th
{
padding
:
3px
;
background-color
:
#f5f5f5
;
border-right
:
1px
solid
#ccc
;
border-bottom
:
1px
solid
#ccc
;
border-top
:
1px
solid
#ccc
;
}
.report-table
td
{
padding
:
3px
;
padding
:
3px
;
background-color
:
#f5f5f5
;
background-color
:
#f5f5f5
;
border-right
:
1px
solid
#ccc
;
border-right
:
1px
solid
#ccc
;
...
...
cat-home/src/main/webapp/js/failure.js
浏览文件 @
7d1378bc
...
@@ -5,12 +5,9 @@ function generateTable(wrap, json) {
...
@@ -5,12 +5,9 @@ function generateTable(wrap, json) {
if
(
threads
==
null
){
if
(
threads
==
null
){
threads
=
[];
threads
=
[];
}
}
if
(
json
.
machines
.
machines
==
null
){
/*caption.html(
json
.
machines
.
machines
=
[];
}
caption
.
html
(
"From " + json.startTime + " To " + json.endTime
"From " + json.startTime + " To " + json.endTime
+
"
Failure Report Domain:
"
+
json
.
domain
).
appendTo
(
table
);
+ " Failure Report Domain:" + json.domain).appendTo(table);
*/
thead
.
appendTo
(
table
);
thead
.
appendTo
(
table
);
...
@@ -20,14 +17,14 @@ function generateTable(wrap, json) {
...
@@ -20,14 +17,14 @@ function generateTable(wrap, json) {
temp
.
appendTo
(
thr
);
temp
.
appendTo
(
thr
);
});
});
$
(
'
<tr />
'
).
append
(
/*
$('<tr />').append(
$('<td />').attr('colspan', threads.length + 1).html(
$('<td />').attr('colspan', threads.length + 1).html(
"machines:" + json.machines.machines.join(','))).appendTo(
"machines:" + json.machines.machines.join(','))).appendTo(
table
);
table);
*/
for
(
var
key
in
json
.
segments
)
{
for
(
var
key
in
json
.
segments
)
{
var
seg
=
json
.
segments
[
key
];
var
seg
=
json
.
segments
[
key
];
var
tr
=
$
(
'
<tr />
'
),
tds
=
[];
var
tr
=
$
(
'
<tr />
'
),
tds
=
[];
$
(
'
<td />
'
).
html
(
seg
.
id
).
appendTo
(
tr
);
$
(
'
<td />
'
).
html
(
seg
.
id
.
substring
(
11
)
).
appendTo
(
tr
);
threads
.
forEach
(
function
()
{
threads
.
forEach
(
function
()
{
var
td
=
$
(
'
<td />
'
);
var
td
=
$
(
'
<td />
'
);
td
.
appendTo
(
tr
);
td
.
appendTo
(
tr
);
...
@@ -40,8 +37,7 @@ function generateTable(wrap, json) {
...
@@ -40,8 +37,7 @@ function generateTable(wrap, json) {
.
forEach
(
function
(
entry
)
{
.
forEach
(
function
(
entry
)
{
var
index
=
threads
.
indexOf
(
entry
.
threadId
),
td
=
tds
[
index
],
type
=
entry
.
type
,
anchor
=
$
(
var
index
=
threads
.
indexOf
(
entry
.
threadId
),
td
=
tds
[
index
],
type
=
entry
.
type
,
anchor
=
$
(
'
<a />
'
).
attr
(
"
href
"
,
'
<a />
'
).
attr
(
"
href
"
,
"
/m/path
"
+
entry
.
path
).
attr
(
"
target
"
,
"
m/
"
+
entry
.
path
).
addClass
(
type
).
html
(
entry
.
text
);
"
_blank
"
).
addClass
(
type
).
html
(
entry
.
text
);
if
(
td
.
html
())
{
if
(
td
.
html
())
{
td
.
append
(
$
(
'
<br />
'
));
td
.
append
(
$
(
'
<br />
'
));
...
@@ -59,3 +55,10 @@ function generateTable(wrap, json) {
...
@@ -59,3 +55,10 @@ function generateTable(wrap, json) {
}
}
generateTable
(
'
#failureTable
'
,
jsonData
);
generateTable
(
'
#failureTable
'
,
jsonData
);
var
currentDomain
=
$
(
"
#currentDomain
"
).
val
();
$
(
"
#domain-
"
+
currentDomain
).
css
(
"
background
"
,
"
#FFCC00
"
);
var
currentIp
=
$
(
"
#currentIp
"
).
val
();
$
(
"
a[data-id='ip-
"
+
currentIp
+
"
']
"
).
css
(
"
background
"
,
"
#FFCC00
"
);
cat-home/src/main/webapp/js/mootools.js
0 → 100644
浏览文件 @
7d1378bc
此差异已折叠。
点击以展开。
cat-home/src/main/webapp/js/transaction.js
浏览文件 @
7d1378bc
...
@@ -3,9 +3,9 @@ $(function(){
...
@@ -3,9 +3,9 @@ $(function(){
var
types
=
data
[
"
types
"
];
var
types
=
data
[
"
types
"
];
for
(
i
in
types
)
{
for
(
i
in
types
)
{
var
type
=
types
[
i
];
var
type
=
types
[
i
];
var
sampleid
=
type
.
fail
id
==
null
?
type
.
successid
:
type
.
failid
;
var
sampleid
=
type
.
fail
MessageUrl
!=
null
?
type
.
failMessageUrl
:
type
.
successMessageUrl
;
var
stat
=
""
+
type
.
min
+
"
/
"
+
type
.
max
+
"
/
"
+
type
.
avg
+
"
/
"
+
type
.
std
;
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
"
:
sampleid
,
"
stat
"
:
stat
});
tabledata
.
push
({
"
type
"
:
type
.
id
,
"
total
"
:
type
.
totalCount
,
"
fail
"
:
type
.
failCount
,
"
failPercent
"
:
type
.
failPercent
,
"
sample
"
:
"
<a href=
\"
/cat/r/m/
"
+
sampleid
+
"
\"
target=
\"
_blank
\"
>link</a>
"
,
"
stat
"
:
stat
});
}
}
}
}
);
);
...
@@ -15,22 +15,26 @@ $(function()
...
@@ -15,22 +15,26 @@ $(function()
domainlinks
=
'
Domains
'
;
domainlinks
=
'
Domains
'
;
$
.
each
(
data
.
domains
,
function
(
i
,
t
){
domainlinks
+=
"
[ <a href=
\"
/cat/r/t?domain=
"
+
t
+
"
\"
>
"
+
t
+
"
</a> ]
"
});
$
.
each
(
data
.
domains
,
function
(
i
,
t
){
domainlinks
+=
"
[ <a href=
\"
/cat/r/t?domain=
"
+
t
+
"
\"
>
"
+
t
+
"
</a> ]
"
});
$
(
"
#domainlist
"
).
html
(
domainlinks
);
$
(
"
#domainlist
"
).
html
(
domainlinks
);
$
(
"
#gridTable
"
).
jqGrid
({
$
(
"
#gridTable
"
).
jqGrid
({
defaults
:
{
//shrinkToFit:true,
//forceFit:true,
},
datatype
:
"
local
"
,
datatype
:
"
local
"
,
colNames
:[
'
Type
'
,
'
Total Count
'
,
'
Fail Count
'
,
'
Failure%
'
,
'
Sample Link
'
,
'
Min/Max/Avg/Std(ms)
'
],
colNames
:[
'
Type
'
,
'
Total Count
'
,
'
Fail Count
'
,
'
Failure%
'
,
'
Sample Link
'
,
'
Min/Max/Avg/Std(ms)
'
],
colModel
:[
colModel
:[
{
name
:
'
type
'
,
index
:
'
type
'
,
width
:
200
},
{
name
:
'
type
'
,
index
:
'
type
'
,
align
:
'
center
'
},
{
name
:
'
total
'
,
index
:
'
total
'
,
width
:
100
,
sorttype
:
"
int
"
,
align
:
'
right
'
},
{
name
:
'
total
'
,
index
:
'
total
'
,
sorttype
:
"
int
"
,
align
:
'
center
'
},
{
name
:
'
fail
'
,
index
:
'
fail
'
,
width
:
100
,
sorttype
:
"
int
"
,
align
:
'
right
'
},
{
name
:
'
fail
'
,
index
:
'
fail
'
,
sorttype
:
"
int
"
,
align
:
'
center
'
},
{
name
:
'
failPercent
'
,
index
:
'
failPercent
'
,
width
:
100
,
sorttype
:
"
float
"
,
align
:
'
center
'
},
{
name
:
'
failPercent
'
,
index
:
'
failPercent
'
,
sorttype
:
"
float
"
,
align
:
'
center
'
},
{
name
:
'
sample
'
,
index
:
'
sample
'
,
width
:
200
,
sortable
:
false
},
{
name
:
'
sample
'
,
index
:
'
sample
'
,
sortable
:
false
,
align
:
'
center
'
,
width
:
100
},
{
name
:
'
stat
'
,
width
:
200
,
sortable
:
false
}
{
name
:
'
stat
'
,
sortable
:
false
,
align
:
'
center
'
,
width
:
200
}
],
],
sortname
:
'
type
'
,
sortname
:
'
type
'
,
sortorder
:
'
asc
'
,
sortorder
:
'
asc
'
,
caption
:
"
Domain
"
+
data
[
"
domain
"
]
+
"
Transaction Summary
"
,
caption
:
"
Domain
"
+
data
[
"
domain
"
]
+
"
Transaction Summary
"
,
height
:
'
100%
'
,
height
:
'
100%
'
,
autowidth
:
true
,
//
autowidth: true,
loadComplete
:
function
()
{
loadComplete
:
function
()
{
$
(
"
#gridTable
"
).
setGridHeight
(
'
auto
'
);
$
(
"
#gridTable
"
).
setGridHeight
(
'
auto
'
);
}
}
...
@@ -41,10 +45,10 @@ $(function()
...
@@ -41,10 +45,10 @@ $(function()
grid
.
jqGrid
(
'
addRowData
'
,
i
+
1
,
tabledata
[
i
]);
grid
.
jqGrid
(
'
addRowData
'
,
i
+
1
,
tabledata
[
i
]);
}
}
$
(
function
(){
//
$(function(){
$
(
window
).
resize
(
function
(){
//
$(window).resize(function(){
$
(
"
#gridTable
"
).
setGridWidth
(
$
(
window
).
width
()
*
0.99
);
//
$("#gridTable").setGridWidth($(window).width()*0.99);
});
//
});
});
//
});
}
}
);
);
\ No newline at end of file
cat-home/src/main/webapp/jsp/report/failure.jsp
浏览文件 @
7d1378bc
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<%@ taglib
prefix=
"a"
uri=
"/WEB-INF/app.tld"
%>
<%@ taglib
prefix=
"a"
uri=
"/WEB-INF/app.tld"
%>
<%@ taglib
prefix=
"c"
uri=
"http://java.sun.com/jsp/jstl/core"
%>
<%@ taglib
prefix=
"res"
uri=
"http://www.ebay.com/webres"
%>
<%@ taglib
prefix=
"res"
uri=
"http://www.ebay.com/webres"
%>
<jsp:useBean
id=
"ctx"
<jsp:useBean
id=
"ctx"
type=
"com.dianping.cat.report.page.failure.Context"
scope=
"request"
/>
type=
"com.dianping.cat.report.page.failure.Context"
scope=
"request"
/>
...
@@ -11,27 +12,25 @@
...
@@ -11,27 +12,25 @@
<a:body>
<a:body>
<res:useCss
value=
'
${
res
.
css
.
local
.
default_css
}
'
target=
"head-css"
/>
<res:useCss
value=
'
${
res
.
css
.
local
.
default_css
}
'
target=
"head-css"
/>
<res:useCss
value=
'
${
res
.
css
.
local
.
jquery_css
}
'
target=
"head-css"
/>
<res:useCss
value=
'
${
res
.
css
.
local
.
jqgrid_css
}
'
target=
"head-css"
/>
<res:useCss
value=
'
${
res
.
css
.
local
.
style_css
}
'
target=
"head-css"
/>
<res:useCss
value=
'
${
res
.
css
.
local
.
style_css
}
'
target=
"head-css"
/>
<res:useCss
value=
'
${
res
.
css
.
local
.
failure_css
}
'
target=
"head-css"
/>
<res:useCss
value=
'
${
res
.
css
.
local
.
failure_css
}
'
target=
"head-css"
/>
<res:useJs
value=
'
${
res
.
js
.
local
.
mootools_js
}
'
target=
"head-js"
/>
<res:useJs
value=
'
${
res
.
js
.
local
.
jquery_min_js
}
'
target=
"head-js"
/>
<res:useJs
value=
'
${
res
.
js
.
local
.
jquery_min_js
}
'
target=
"head-js"
/>
<res:useJs
value=
'
${
res
.
js
.
local
.
jquery_ui_min_js
}
'
target=
"head-js"
/>
<res:useJs
value=
'
${
res
.
js
.
local
.
grid_js
}
'
target=
"head-js"
/>
<res:useJs
value=
'
${
res
.
js
.
local
.
jqgrid_min_js
}
'
target=
"head-js"
/>
<res:useJs
value=
'
${
res
.
js
.
local
.
sql_scripts_js
}
'
target=
"head-js"
/>
<res:useJs
value=
'
${
res
.
js
.
local
.
sql_scripts_js
}
'
target=
"head-js"
/>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
var
jsonData
=
$
{
model
.
reportInJson
};
var
jsonData
=
$
{
model
.
jsonResult
};
</script>
</script>
<table
width=
"100%"
border=
"0"
cellpadding=
"6"
cellspacing=
"0"
<table
width=
"100%"
border=
"0"
cellpadding=
"6"
cellspacing=
"0"
class=
"fancy-header"
>
class=
"fancy-header"
>
<tbody>
<tbody>
<tr>
<tr>
<td
nowrap=
""
>
Dian Ping CAT Reports:
Report For XXXXXX Current: ${model.current
}
</td>
<td
nowrap=
""
>
Dian Ping CAT Reports:
${model.reportTitle
}
</td>
<td
width=
"100%"
align=
"right"
nowrap=
""
>
Generated: XXXXXX
</td>
<td
width=
"100%"
align=
"right"
nowrap=
""
>
Generated: XXXXXX
</td>
<td
style=
"display:none"
><input
id=
"currentDomain"
value=
"${model.currentDomain}"
>
<input
id=
"currentIp"
value=
"${model.currentIp}"
></input></td>
</tr>
</tr>
</tbody>
</tbody>
</table>
</table>
...
@@ -40,29 +39,38 @@
...
@@ -40,29 +39,38 @@
<tbody>
<tbody>
<tr>
<tr>
<td
nowrap=
"nowrap"
align=
"left"
class=
"seealso"
>
Domains:
<td
nowrap=
"nowrap"
align=
"left"
class=
"seealso"
>
Domains:
[
<a
href=
"/cat/r/f?domain=Shop"
>
Shop
</a>
<c:forEach
] [
<a
href=
"/cat/r/f?domain=User"
>
User
</a>
var=
"domain"
items=
"
${
model
.
domains
}
"
>
] [
<a
href=
"/cat/r/f?domain=Pic"
>
Pic
</a>
[
<a
id=
"domain-${domain}"
href=
"/cat/r/f?domain=${domain}"
>
${domain}
</a>
]
] [
<a
href=
"/cat/r/f?domain=Review"
>
Review
</a>
</c:forEach>
<br>
] [
<a
href=
"/cat/r/f?domain=Group"
>
Group
</a>
] [
<a
href=
"/cat/r/f?domain=Tuan"
>
Tuan
</a>
]
<br>
</td>
</td>
<td
nowrap=
"nowrap"
align=
"right"
class=
"seealso"
>
<td
nowrap=
"nowrap"
align=
"right"
class=
"seealso"
>
[
<a
[
<a
href=
"/cat/r/f?domain=${model.domain}&start=${model.current}&method=-24"
>
-1d
</a>
href=
"/cat/r/f?domain=${model.currentDomain}&start=${model.current}&ip=${model.currentIp}&method=-24"
>
-1d
</a>
] [
<a
href=
"/cat/r/f?domain=${model.domain}&start=${model.current}&method=-2"
>
-2H
</a>
] [
<a
] [
<a
href=
"/cat/r/f?domain=${model.domain}&start=${model.current}&method=-1"
>
-1H
</a>
href=
"/cat/r/f?domain=${model.currentDomain}&start=${model.current}&ip=${model.currentIp}&method=-2"
>
-2H
</a>
] [
<a
href=
"/cat/r/f?domain=${model.domain}&start=${model.current}&method=1"
>
+1H
</a>
] [
<a
] [
<a
href=
"/cat/r/f?domain=${model.domain}&start=${model.current}&method=2"
>
+2H
</a>
href=
"/cat/r/f?domain=${model.currentDomain}&start=${model.current}&ip=${model.currentIp}&method=-1"
>
-1H
</a>
] [
<a
href=
"/cat/r/f?domain=${model.domain}&start=${model.current}&method=24"
>
+1d
</a>
] [
<a
href=
"/cat/r/f?domain=${model.currentDomain}&start=${model.current}&ip=${model.currentIp}&method=1"
>
+1H
</a>
] [
<a
href=
"/cat/r/f?domain=${model.currentDomain}&start=${model.current}&ip=${model.currentIp}&method=2"
>
+2H
</a>
] [
<a
href=
"/cat/r/f?domain=${model.currentDomain}&start=${model.current}&ip=${model.currentIp}&method=24"
>
+1d
</a>
]
<br>
]
<br>
</td>
</td>
</tr>
</tr>
<tr>
<td
nowrap=
"nowrap"
align=
"left"
class=
"seealso"
>
Ips:
<c:forEach
var=
"ip"
items=
"
${
model
.
ips
}
"
>
[
<a
data-id=
"ip-${ip}"
href=
"/cat/r/f?domain=${model.currentDomain}&start=${model.current}&ip=${model.currentIp}"
>
${ip}
</a>
]
</c:forEach>
<br>
</td>
</tr>
</tbody>
</tbody>
</table>
</table>
<br/>
<br
/>
<table
id=
"failureTable"
width=
"100%"
border=
"0"
cellspacing=
"0"
></table>
<table
id=
"failureTable"
width=
"100%"
border=
"0"
cellspacing=
"0"
></table>
<br/>
<br
/>
<table
width=
"100%"
border=
"0"
cellpadding=
"6"
cellspacing=
"0"
<table
width=
"100%"
border=
"0"
cellpadding=
"6"
cellspacing=
"0"
class=
"fancy-footer"
>
class=
"fancy-footer"
>
<tbody>
<tbody>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录