Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
c6c79306
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,发现更多精彩内容 >>
提交
c6c79306
编写于
10月 24, 2013
作者:
A
ainilife
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor unit tests for transaction and event
上级
2e3133b9
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
268 addition
and
281 deletion
+268
-281
cat-consumer/src/test/java/com/dianping/cat/consumer/AllTests.java
...mer/src/test/java/com/dianping/cat/consumer/AllTests.java
+6
-0
cat-consumer/src/test/java/com/dianping/cat/consumer/MockReportManager.java
...est/java/com/dianping/cat/consumer/MockReportManager.java
+12
-10
cat-consumer/src/test/java/com/dianping/cat/consumer/event/Configurator.java
...st/java/com/dianping/cat/consumer/event/Configurator.java
+37
-0
cat-consumer/src/test/java/com/dianping/cat/consumer/event/EventAnalyzerTest.java
...va/com/dianping/cat/consumer/event/EventAnalyzerTest.java
+10
-16
cat-consumer/src/test/java/com/dianping/cat/consumer/transaction/Configurator.java
...a/com/dianping/cat/consumer/transaction/Configurator.java
+37
-0
cat-consumer/src/test/java/com/dianping/cat/consumer/transaction/TransactionAnalyzerTest.java
...ing/cat/consumer/transaction/TransactionAnalyzerTest.java
+15
-20
cat-consumer/src/test/java/com/dianping/cat/consumer/transaction/TransactionReportFilterTest.java
...cat/consumer/transaction/TransactionReportFilterTest.java
+1
-1
cat-consumer/src/test/java/com/dianping/cat/consumer/transaction/TransactionReportTest.java
...nping/cat/consumer/transaction/TransactionReportTest.java
+1
-2
cat-consumer/src/test/resources/com/dianping/cat/consumer/event/EventAnalyzerTest.xml
...ces/com/dianping/cat/consumer/event/EventAnalyzerTest.xml
+21
-23
cat-consumer/src/test/resources/com/dianping/cat/consumer/event/event_analyzer.xml
...ources/com/dianping/cat/consumer/event/event_analyzer.xml
+21
-0
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/TransactionAnalyzerTest.xml
...ping/cat/consumer/transaction/TransactionAnalyzerTest.xml
+21
-103
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/transaction.xml
...ces/com/dianping/cat/consumer/transaction/transaction.xml
+0
-106
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/transaction_analyzer.xml
...ianping/cat/consumer/transaction/transaction_analyzer.xml
+86
-0
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/transaction_report.html
...dianping/cat/consumer/transaction/transaction_report.html
+0
-0
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/transaction_report.json
...dianping/cat/consumer/transaction/transaction_report.json
+0
-0
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/transaction_report.xml
.../dianping/cat/consumer/transaction/transaction_report.xml
+0
-0
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/transaction_report_filter.xml
...ng/cat/consumer/transaction/transaction_report_filter.xml
+0
-0
未找到文件。
cat-consumer/src/test/java/com/dianping/cat/consumer/AllTests.java
浏览文件 @
c6c79306
...
...
@@ -11,6 +11,7 @@ import com.dianping.cat.consumer.core.ProblemHandlerTest;
import
com.dianping.cat.consumer.core.ProblemReportAggregationTest
;
import
com.dianping.cat.consumer.core.aggregation.CompositeFormatTest
;
import
com.dianping.cat.consumer.core.aggregation.DefaultFormatTest
;
import
com.dianping.cat.consumer.event.EventAnalyzerTest
;
import
com.dianping.cat.consumer.transaction.TransactionAnalyzerTest
;
import
com.dianping.cat.consumer.transaction.TransactionReportFilterTest
;
import
com.dianping.cat.consumer.transaction.TransactionReportTest
;
...
...
@@ -28,12 +29,17 @@ GsonTest.class,
NumberFormatTest
.
class
,
/* transaction */
TransactionAnalyzerTest
.
class
,
TransactionReportTest
.
class
,
TransactionReportFilterTest
.
class
,
/* event */
EventAnalyzerTest
.
class
,
CompositeFormatTest
.
class
,
DefaultFormatTest
.
class
,
...
...
cat-consumer/src/test/java/com/dianping/cat/consumer/MockReportManager.java
浏览文件 @
c6c79306
...
...
@@ -4,6 +4,8 @@ import java.util.HashSet;
import
java.util.Map
;
import
java.util.Set
;
import
org.unidal.lookup.annotation.Inject
;
import
com.dianping.cat.Constants
;
import
com.dianping.cat.service.DefaultReportManager.StoragePolicy
;
import
com.dianping.cat.service.ReportDelegate
;
...
...
@@ -11,18 +13,12 @@ import com.dianping.cat.service.ReportManager;
public
class
MockReportManager
<
T
>
implements
ReportManager
<
T
>
{
@Inject
private
ReportDelegate
<
T
>
m_delegate
;
private
T
m_report
;
private
Set
<
String
>
m_set
;
public
MockReportManager
(
ReportDelegate
<
T
>
delegate
,
String
domain
)
{
m_delegate
=
delegate
;
m_set
=
new
HashSet
<
String
>();
m_set
.
add
(
domain
);
}
@Override
public
void
cleanup
()
{
...
...
@@ -34,15 +30,21 @@ public class MockReportManager<T> implements ReportManager<T> {
@Override
public
Set
<
String
>
getDomains
(
long
startTime
)
{
if
(
m_set
==
null
)
{
m_set
=
new
HashSet
<
String
>();
m_set
.
add
(
"group"
);
}
return
m_set
;
}
@Override
public
T
getHourlyReport
(
long
startTime
,
String
domain
,
boolean
createIfNotExist
)
{
if
(
m_report
==
null
)
{
if
(
m_report
==
null
)
{
m_report
=
m_delegate
.
makeReport
(
domain
,
startTime
,
Constants
.
HOUR
);
}
return
m_report
;
}
...
...
cat-consumer/src/test/java/com/dianping/cat/consumer/event/Configurator.java
0 → 100644
浏览文件 @
c6c79306
package
com.dianping.cat.consumer.event
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.unidal.lookup.configuration.AbstractResourceConfigurator
;
import
org.unidal.lookup.configuration.Component
;
import
com.dianping.cat.consumer.MockReportManager
;
import
com.dianping.cat.service.ReportDelegate
;
import
com.dianping.cat.service.ReportManager
;
public
class
Configurator
extends
AbstractResourceConfigurator
{
public
static
void
main
(
String
[]
args
)
{
generatePlexusComponentsXmlFile
(
new
Configurator
());
}
protected
Class
<?>
getTestClass
()
{
return
EventAnalyzerTest
.
class
;
}
@Override
public
List
<
Component
>
defineComponents
()
{
List
<
Component
>
all
=
new
ArrayList
<
Component
>();
final
String
ID
=
EventAnalyzer
.
ID
;
all
.
add
(
C
(
ReportManager
.
class
,
ID
,
MockReportManager
.
class
)
//
.
req
(
ReportDelegate
.
class
,
ID
,
"m_delegate"
));
all
.
add
(
C
(
ReportDelegate
.
class
,
ID
,
ExtendedEventDelegate
.
class
));
return
all
;
}
public
static
class
ExtendedEventDelegate
extends
EventDelegate
{
}
}
cat-consumer/src/test/java/com/dianping/cat/consumer/event/EventAnalyzerTest.java
浏览文件 @
c6c79306
...
...
@@ -7,15 +7,13 @@ import org.junit.Test;
import
org.unidal.helper.Files
;
import
org.unidal.lookup.ComponentTestCase
;
import
com.dianping.cat.
consumer.MockReportManag
er
;
import
com.dianping.cat.
analysis.MessageAnalyz
er
;
import
com.dianping.cat.consumer.event.model.entity.EventReport
;
import
com.dianping.cat.message.Message
;
import
com.dianping.cat.message.internal.DefaultEvent
;
import
com.dianping.cat.message.internal.DefaultTransaction
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.internal.DefaultMessageTree
;
import
com.dianping.cat.service.ReportDelegate
;
import
com.dianping.cat.service.ReportManager
;
public
class
EventAnalyzerTest
extends
ComponentTestCase
{
...
...
@@ -26,32 +24,28 @@ public class EventAnalyzerTest extends ComponentTestCase {
private
String
m_domain
=
"group"
;
@Before
public
void
init
()
{
public
void
setUp
()
throws
Exception
{
super
.
setUp
();
m_timestamp
=
System
.
currentTimeMillis
()
-
System
.
currentTimeMillis
()
%
(
3600
*
1000
);
ReportDelegate
<
EventReport
>
deleaate
=
new
EventDelegate
();
ReportManager
<
EventReport
>
reportManager
=
new
MockReportManager
<
EventReport
>(
deleaate
,
m_domain
);
m_analyzer
=
new
EventAnalyzer
();
m_analyzer
.
setReportManager
(
reportManager
);
m_analyzer
=
(
EventAnalyzer
)
lookup
(
MessageAnalyzer
.
class
,
EventAnalyzer
.
ID
);
}
@Test
public
void
testProcessTransaction
()
throws
Exception
{
public
void
testProcess
()
throws
Exception
{
for
(
int
i
=
1
;
i
<=
1000
;
i
++)
{
MessageTree
tree
=
new
MessageTree
(
i
);
MessageTree
tree
=
generate
MessageTree
(
i
);
m_analyzer
.
process
(
tree
);
}
EventReport
report
=
m_analyzer
.
getReport
(
m_domain
);
String
expected
=
Files
.
forIO
().
readFrom
(
getClass
().
getResourceAsStream
(
"
EventAnalyzerTest
.xml"
),
"utf-8"
);
Assert
.
assertEquals
(
expected
.
replaceAll
(
"\
\s*"
,
""
),
report
.
toString
().
replaceAll
(
"\\s*
"
,
""
));
String
expected
=
Files
.
forIO
().
readFrom
(
getClass
().
getResourceAsStream
(
"
event_analyzer
.xml"
),
"utf-8"
);
Assert
.
assertEquals
(
expected
.
replaceAll
(
"\
r"
,
""
),
report
.
toString
().
replaceAll
(
"\r
"
,
""
));
}
protected
MessageTree
new
MessageTree
(
int
i
)
{
protected
MessageTree
generate
MessageTree
(
int
i
)
{
MessageTree
tree
=
new
DefaultMessageTree
();
tree
.
setMessageId
(
""
+
i
);
...
...
cat-consumer/src/test/java/com/dianping/cat/consumer/transaction/Configurator.java
0 → 100644
浏览文件 @
c6c79306
package
com.dianping.cat.consumer.transaction
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.unidal.lookup.configuration.AbstractResourceConfigurator
;
import
org.unidal.lookup.configuration.Component
;
import
com.dianping.cat.consumer.MockReportManager
;
import
com.dianping.cat.service.ReportDelegate
;
import
com.dianping.cat.service.ReportManager
;
public
class
Configurator
extends
AbstractResourceConfigurator
{
public
static
void
main
(
String
[]
args
)
{
generatePlexusComponentsXmlFile
(
new
Configurator
());
}
protected
Class
<?>
getTestClass
()
{
return
TransactionAnalyzerTest
.
class
;
}
@Override
public
List
<
Component
>
defineComponents
()
{
List
<
Component
>
all
=
new
ArrayList
<
Component
>();
final
String
ID
=
TransactionAnalyzer
.
ID
;
all
.
add
(
C
(
ReportManager
.
class
,
ID
,
MockReportManager
.
class
)
//
.
req
(
ReportDelegate
.
class
,
ID
,
"m_delegate"
));
all
.
add
(
C
(
ReportDelegate
.
class
,
ID
,
ExtendedTransactionDelegate
.
class
));
return
all
;
}
public
static
class
ExtendedTransactionDelegate
extends
TransactionDelegate
{
}
}
cat-consumer/src/test/java/com/dianping/cat/consumer/transaction/TransactionAnalyzerTest.java
浏览文件 @
c6c79306
...
...
@@ -7,15 +7,12 @@ import org.junit.Test;
import
org.unidal.helper.Files
;
import
org.unidal.lookup.ComponentTestCase
;
import
com.dianping.cat.ServerConfigManager
;
import
com.dianping.cat.consumer.MockReportManager
;
import
com.dianping.cat.analysis.MessageAnalyzer
;
import
com.dianping.cat.consumer.transaction.model.entity.TransactionReport
;
import
com.dianping.cat.message.Message
;
import
com.dianping.cat.message.internal.DefaultTransaction
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.internal.DefaultMessageTree
;
import
com.dianping.cat.service.ReportDelegate
;
import
com.dianping.cat.service.ReportManager
;
public
class
TransactionAnalyzerTest
extends
ComponentTestCase
{
private
long
m_timestamp
;
...
...
@@ -25,25 +22,22 @@ public class TransactionAnalyzerTest extends ComponentTestCase {
private
String
m_domain
=
"group"
;
@Before
public
void
init
()
{
m_timestamp
=
System
.
currentTimeMillis
()
-
System
.
currentTimeMillis
()
%
(
3600
*
1000
);
public
void
setUp
()
throws
Exception
{
super
.
setUp
(
);
ReportDelegate
<
TransactionReport
>
transactionDelegate
=
new
TransactionDelegate
();
ServerConfigManager
serverConfigManager
=
new
ServerConfigManager
();
ReportManager
<
TransactionReport
>
reportManager
=
new
MockReportManager
<
TransactionReport
>(
transactionDelegate
,
m_domain
);
m_timestamp
=
System
.
currentTimeMillis
()
-
System
.
currentTimeMillis
()
%
(
3600
*
1000
);
m_analyzer
=
new
TransactionAnalyzer
();
m_analyzer
.
setDelegate
((
TransactionDelegate
)
transactionDelegate
);
m_analyzer
.
setReportManager
(
reportManager
);
m_analyzer
.
setServerConfigManager
(
serverConfigManager
);
try
{
m_analyzer
=
(
TransactionAnalyzer
)
lookup
(
MessageAnalyzer
.
class
,
TransactionAnalyzer
.
ID
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@Test
public
void
testProcessTransaction
()
throws
Exception
{
public
void
testProcess
()
throws
Exception
{
for
(
int
i
=
1
;
i
<=
1000
;
i
++)
{
MessageTree
tree
=
new
MessageTree
(
i
);
MessageTree
tree
=
generate
MessageTree
(
i
);
m_analyzer
.
process
(
tree
);
}
...
...
@@ -52,11 +46,12 @@ public class TransactionAnalyzerTest extends ComponentTestCase {
report
.
accept
(
new
TransactionStatisticsComputer
());
String
expected
=
Files
.
forIO
().
readFrom
(
getClass
().
getResourceAsStream
(
"TransactionAnalyzerTest.xml"
),
"utf-8"
);
Assert
.
assertEquals
(
expected
.
replaceAll
(
"\\s*"
,
""
),
report
.
toString
().
replaceAll
(
"\\s*"
,
""
));
String
expected
=
Files
.
forIO
().
readFrom
(
getClass
().
getResourceAsStream
(
"transaction_analyzer.xml"
),
"utf-8"
);
Assert
.
assertEquals
(
expected
.
replaceAll
(
"\r"
,
""
),
report
.
toString
().
replaceAll
(
"\r"
,
""
));
}
protected
MessageTree
new
MessageTree
(
int
i
)
{
protected
MessageTree
generate
MessageTree
(
int
i
)
{
MessageTree
tree
=
new
DefaultMessageTree
();
tree
.
setMessageId
(
""
+
i
);
...
...
cat-consumer/src/test/java/com/dianping/cat/consumer/transaction/TransactionReportFilterTest.java
浏览文件 @
c6c79306
...
...
@@ -16,7 +16,7 @@ public class TransactionReportFilterTest {
@Test
public
void
whether_url_has_max_names
()
throws
Exception
{
String
source
=
Files
.
forIO
().
readFrom
(
getClass
().
getResourceAsStream
(
"transaction.xml"
),
"utf-8"
);
String
source
=
Files
.
forIO
().
readFrom
(
getClass
().
getResourceAsStream
(
"transaction
_report_filter
.xml"
),
"utf-8"
);
TransactionReport
report
=
DefaultSaxParser
.
parse
(
source
);
TransactionType
type
=
report
.
findMachine
(
"10.1.77.193"
).
findType
(
"URL"
);
...
...
cat-consumer/src/test/java/com/dianping/cat/consumer/transaction/TransactionReportTest.java
浏览文件 @
c6c79306
...
...
@@ -11,12 +11,11 @@ import com.dianping.cat.consumer.transaction.model.transform.DefaultXmlBuilder;
public
class
TransactionReportTest
{
@Test
public
void
testXml
()
throws
Exception
{
String
source
=
Files
.
forIO
().
readFrom
(
getClass
().
getResourceAsStream
(
"
TransactionR
eport.xml"
),
"utf-8"
);
String
source
=
Files
.
forIO
().
readFrom
(
getClass
().
getResourceAsStream
(
"
transaction_r
eport.xml"
),
"utf-8"
);
TransactionReport
report
=
DefaultSaxParser
.
parse
(
source
);
String
xml
=
new
DefaultXmlBuilder
().
buildXml
(
report
);
String
expected
=
source
;
Assert
.
assertEquals
(
"XML is not well parsed!"
,
expected
.
replace
(
"\r"
,
""
),
xml
.
replace
(
"\r"
,
""
));
}
}
cat-consumer/src/test/resources/com/dianping/cat/consumer/event/EventAnalyzerTest.xml
浏览文件 @
c6c79306
<?xml version="1.0" encoding="utf-8"?>
<event-report
domain=
"group"
startTime=
"1970-01-01 08:00:00"
endTime=
"1970-01-01 08:59:59"
>
<domain>
group
</domain>
<ip>
192.168.1.1
</ip>
<machine
ip=
"192.168.1.1"
>
<type
id=
"test2"
totalCount=
"1000"
failCount=
"1000"
failPercent=
"100.00"
>
<failMessageUrl>
1
</failMessageUrl>
<name
id=
"fail"
totalCount=
"1000"
failCount=
"1000"
failPercent=
"100.00"
>
<failMessageUrl>
1
</failMessageUrl>
<range
value=
"0"
count=
"1000"
fails=
"1000"
/>
</name>
</type>
<type
id=
"test1"
totalCount=
"1000"
failCount=
"0"
failPercent=
"0.00"
>
<successMessageUrl>
1
</successMessageUrl>
<name
id=
"success"
totalCount=
"1000"
failCount=
"0"
failPercent=
"0.00"
>
<successMessageUrl>
1
</successMessageUrl>
<range
value=
"0"
count=
"1000"
fails=
"0"
/>
</name>
</type>
</machine>
</event-report>
<plexus>
<components>
<component>
<role>
com.dianping.cat.service.ReportManager
</role>
<role-hint>
event
</role-hint>
<implementation>
com.dianping.cat.consumer.MockReportManager
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.service.ReportDelegate
</role>
<role-hint>
event
</role-hint>
<field-name>
m_delegate
</field-name>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.service.ReportDelegate
</role>
<role-hint>
event
</role-hint>
<implementation>
com.dianping.cat.consumer.event.Configurator$ExtendedEventDelegate
</implementation>
</component>
</components>
</plexus>
cat-consumer/src/test/resources/com/dianping/cat/consumer/event/event_analyzer.xml
0 → 100644
浏览文件 @
c6c79306
<?xml version="1.0" encoding="utf-8"?>
<event-report
domain=
"group"
startTime=
"1970-01-01 08:00:00"
endTime=
"1970-01-01 08:59:59"
>
<domain>
group
</domain>
<ip>
192.168.1.1
</ip>
<machine
ip=
"192.168.1.1"
>
<type
id=
"test2"
totalCount=
"1000"
failCount=
"1000"
failPercent=
"100.00"
>
<failMessageUrl>
1
</failMessageUrl>
<name
id=
"fail"
totalCount=
"1000"
failCount=
"1000"
failPercent=
"100.00"
>
<failMessageUrl>
1
</failMessageUrl>
<range
value=
"55"
count=
"1000"
fails=
"1000"
/>
</name>
</type>
<type
id=
"test1"
totalCount=
"1000"
failCount=
"0"
failPercent=
"0.00"
>
<successMessageUrl>
1
</successMessageUrl>
<name
id=
"success"
totalCount=
"1000"
failCount=
"0"
failPercent=
"0.00"
>
<successMessageUrl>
1
</successMessageUrl>
<range
value=
"55"
count=
"1000"
fails=
"0"
/>
</name>
</type>
</machine>
</event-report>
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/TransactionAnalyzerTest.xml
浏览文件 @
c6c79306
<?xml version="1.0" encoding="utf-8"?>
<transaction-report
domain=
"group"
startTime=
"1970-01-01 08:00:00"
endTime=
"1970-01-01 08:59:59"
>
<domain>
group
</domain>
<ip>
192.168.1.1
</ip>
<machine
ip=
"192.168.1.1"
>
<type
id=
"A"
totalCount=
"1000"
failCount=
"500"
failPercent=
"50.00"
min=
"2.0"
max=
"2000.0"
avg=
"1001.0"
sum=
"1001000.0"
sum2=
"1335334000.0"
std=
"577.3"
tps=
"0.00"
line95Value=
"1902.00"
line99Value=
"2000.00"
>
<successMessageUrl>
1
</successMessageUrl>
<failMessageUrl>
2
</failMessageUrl>
<name
id=
"n1"
totalCount=
"500"
failCount=
"0"
failPercent=
"0.00"
min=
"2.0"
max=
"1998.0"
avg=
"1000.0"
sum=
"500000.0"
sum2=
"666666000.0"
std=
"577.3"
tps=
"0.00"
line95Value=
"1902.00"
line99Value=
"1998.00"
>
<successMessageUrl>
1
</successMessageUrl>
<range
value=
"0"
count=
"500"
sum=
"500000.0"
avg=
"1000.0"
fails=
"0"
/>
<duration
value=
"2"
count=
"1"
/>
<duration
value=
"8"
count=
"1"
/>
<duration
value=
"16"
count=
"2"
/>
<duration
value=
"32"
count=
"4"
/>
<duration
value=
"64"
count=
"8"
/>
<duration
value=
"128"
count=
"16"
/>
<duration
value=
"256"
count=
"32"
/>
<duration
value=
"512"
count=
"64"
/>
<duration
value=
"1024"
count=
"128"
/>
<duration
value=
"2048"
count=
"244"
/>
</name>
<name
id=
"n0"
totalCount=
"500"
failCount=
"500"
failPercent=
"100.00"
min=
"4.0"
max=
"2000.0"
avg=
"1002.0"
sum=
"501000.0"
sum2=
"668668000.0"
std=
"577.3"
tps=
"0.00"
line95Value=
"1904.00"
line99Value=
"2000.00"
>
<failMessageUrl>
2
</failMessageUrl>
<range
value=
"0"
count=
"500"
sum=
"501000.0"
avg=
"1002.0"
fails=
"500"
/>
<duration
value=
"4"
count=
"1"
/>
<duration
value=
"8"
count=
"1"
/>
<duration
value=
"16"
count=
"2"
/>
<duration
value=
"32"
count=
"4"
/>
<duration
value=
"64"
count=
"8"
/>
<duration
value=
"128"
count=
"16"
/>
<duration
value=
"256"
count=
"32"
/>
<duration
value=
"512"
count=
"64"
/>
<duration
value=
"1024"
count=
"128"
/>
<duration
value=
"2048"
count=
"244"
/>
</name>
</type>
<type
id=
"A-1"
totalCount=
"1000"
failCount=
"500"
failPercent=
"50.00"
min=
"1.0"
max=
"1000.0"
avg=
"500.5"
sum=
"500500.0"
sum2=
"333833500.0"
std=
"288.7"
tps=
"0.00"
line95Value=
"951.00"
line99Value=
"1000.00"
>
<successMessageUrl>
1
</successMessageUrl>
<failMessageUrl>
2
</failMessageUrl>
<name
id=
"n1"
totalCount=
"334"
failCount=
"167"
failPercent=
"50.00"
min=
"1.0"
max=
"1000.0"
avg=
"500.5"
sum=
"167167.0"
sum2=
"111611611.0"
std=
"289.3"
tps=
"0.00"
line95Value=
"955.00"
line99Value=
"1000.00"
>
<successMessageUrl>
1
</successMessageUrl>
<failMessageUrl>
4
</failMessageUrl>
<range
value=
"0"
count=
"334"
sum=
"167167.0"
avg=
"500.5"
fails=
"167"
/>
<duration
value=
"1"
count=
"1"
/>
<duration
value=
"4"
count=
"1"
/>
<duration
value=
"8"
count=
"1"
/>
<duration
value=
"16"
count=
"3"
/>
<duration
value=
"32"
count=
"5"
/>
<duration
value=
"64"
count=
"11"
/>
<duration
value=
"128"
count=
"21"
/>
<duration
value=
"256"
count=
"43"
/>
<duration
value=
"512"
count=
"85"
/>
<duration
value=
"1024"
count=
"163"
/>
</name>
<name
id=
"n2"
totalCount=
"333"
failCount=
"167"
failPercent=
"50.15"
min=
"2.0"
max=
"998.0"
avg=
"500.0"
sum=
"166500.0"
sum2=
"110944278.0"
std=
"288.4"
tps=
"0.00"
line95Value=
"953.00"
line99Value=
"998.00"
>
<successMessageUrl>
5
</successMessageUrl>
<failMessageUrl>
2
</failMessageUrl>
<range
value=
"0"
count=
"333"
sum=
"166500.0"
avg=
"500.0"
fails=
"167"
/>
<duration
value=
"2"
count=
"1"
/>
<duration
value=
"8"
count=
"2"
/>
<duration
value=
"16"
count=
"2"
/>
<duration
value=
"32"
count=
"6"
/>
<duration
value=
"64"
count=
"10"
/>
<duration
value=
"128"
count=
"22"
/>
<duration
value=
"256"
count=
"42"
/>
<duration
value=
"512"
count=
"86"
/>
<duration
value=
"1024"
count=
"162"
/>
</name>
<name
id=
"n0"
totalCount=
"333"
failCount=
"166"
failPercent=
"49.85"
min=
"3.0"
max=
"999.0"
avg=
"501.0"
sum=
"166833.0"
sum2=
"111277611.0"
std=
"288.4"
tps=
"0.00"
line95Value=
"954.00"
line99Value=
"999.00"
>
<successMessageUrl>
3
</successMessageUrl>
<failMessageUrl>
6
</failMessageUrl>
<range
value=
"0"
count=
"333"
sum=
"166833.0"
avg=
"501.0"
fails=
"166"
/>
<duration
value=
"4"
count=
"1"
/>
<duration
value=
"8"
count=
"1"
/>
<duration
value=
"16"
count=
"3"
/>
<duration
value=
"32"
count=
"5"
/>
<duration
value=
"64"
count=
"11"
/>
<duration
value=
"128"
count=
"21"
/>
<duration
value=
"256"
count=
"43"
/>
<duration
value=
"512"
count=
"85"
/>
<duration
value=
"1024"
count=
"163"
/>
</name>
</type>
</machine>
</transaction-report>
\ No newline at end of file
<plexus>
<components>
<component>
<role>
com.dianping.cat.service.ReportManager
</role>
<role-hint>
transaction
</role-hint>
<implementation>
com.dianping.cat.consumer.MockReportManager
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.service.ReportDelegate
</role>
<role-hint>
transaction
</role-hint>
<field-name>
m_delegate
</field-name>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.service.ReportDelegate
</role>
<role-hint>
transaction
</role-hint>
<implementation>
com.dianping.cat.consumer.transaction.Configurator$ExtendedTransactionDelegate
</implementation>
</component>
</components>
</plexus>
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/transaction.xml
已删除
100644 → 0
浏览文件 @
2e3133b9
<transaction-report
domain=
"MobileApi"
startTime=
"2012-06-18 14:00:00"
endTime=
"2012-06-18 14:59:59"
>
<domain>
Cat
</domain>
<domain>
MobileApi
</domain>
<ip>
10.1.77.193
</ip>
<machine
ip=
"10.1.77.193"
>
<type
id=
"SQL"
totalCount=
"111507"
failCount=
"0"
failPercent=
"0.00"
min=
"0.417"
max=
"102.919"
avg=
"0.0"
sum=
"1937.0"
sum2=
"34333.7"
std=
"0.0"
tps=
"0.00"
line95Value=
"14.00"
line95Sum=
"14.00"
line95Count=
"1"
>
<successMessageUrl>
MobileApi-0a014dc1-1339999254922-0
</successMessageUrl>
<name
id=
"APICategory.getAllParentCategoryId"
totalCount=
"1"
failCount=
"0"
failPercent=
"0.00"
min=
"13.326"
max=
"13.326"
avg=
"0.0"
sum=
"13.3"
sum2=
"177.6"
std=
"0.0"
tps=
"0.00"
line95Value=
"13.00"
line95Sum=
"13.00"
line95Count=
"1"
>
<successMessageUrl>
MobileApi-0a014dc1-1340002657975-0
</successMessageUrl>
<range
value=
"55"
count=
"1"
sum=
"13.326"
avg=
"0.0"
fails=
"0"
/>
<duration
value=
"16"
count=
"1"
/>
</name>
<name
id=
"APISearch.getFilterOptionList"
totalCount=
"1"
failCount=
"0"
failPercent=
"0.00"
min=
"0.871"
max=
"0.871"
avg=
"0.0"
sum=
"0.9"
sum2=
"0.8"
std=
"0.0"
tps=
"0.00"
line95Value=
"0.00"
line95Sum=
"0.00"
line95Count=
"1"
>
<successMessageUrl>
MobileApi-0a014dc1-1340002658121-0
</successMessageUrl>
<range
value=
"55"
count=
"1"
sum=
"0.871"
avg=
"0.0"
fails=
"0"
/>
<duration
value=
"1"
count=
"1"
/>
</name>
</type>
<type
id=
"URL"
totalCount=
"111120"
failCount=
"0"
failPercent=
"0.00"
min=
"2.354"
max=
"2164.387"
avg=
"0.0"
sum=
"2689.6"
sum2=
"4772307.3"
std=
"0.0"
tps=
"0.00"
line95Value=
"2164.00"
line95Sum=
"2164.00"
line95Count=
"1"
>
<successMessageUrl>
MobileApi-0a014dc1-1339999960694-0
</successMessageUrl>
<name
id=
"/config.bin"
totalCount=
"20"
failCount=
"0"
failPercent=
"0.00"
min=
"2.354"
max=
"2.725"
avg=
"0.0"
sum=
"5.1"
sum2=
"13.0"
std=
"0.0"
tps=
"0.00"
line95Value=
"2.00"
line95Sum=
"2.00"
line95Count=
"1"
>
<successMessageUrl>
MobileApi-0a014dc1-1339999960694-0
</successMessageUrl>
<range
value=
"10"
count=
"2"
sum=
"5.079000000000001"
avg=
"0.0"
fails=
"0"
/>
<duration
value=
"4"
count=
"2"
/>
</name>
<name
id=
"/hotregion.bin"
totalCount=
"20"
failCount=
"0"
failPercent=
"0.00"
min=
"2.908"
max=
"8.311"
avg=
"0.0"
sum=
"11.2"
sum2=
"77.5"
std=
"0.0"
tps=
"0.00"
line95Value=
"8.00"
line95Sum=
"8.00"
line95Count=
"1"
>
<successMessageUrl>
MobileApi-0a014dc1-1339999960753-0
</successMessageUrl>
<range
value=
"10"
count=
"2"
sum=
"11.219"
avg=
"0.0"
fails=
"0"
/>
<duration
value=
"4"
count=
"1"
/>
<duration
value=
"16"
count=
"1"
/>
</name>
<name
id=
"/category.bin"
totalCount=
"20"
failCount=
"0"
failPercent=
"0.00"
min=
"12.934"
max=
"13.056"
avg=
"0.0"
sum=
"26.0"
sum2=
"337.7"
std=
"0.0"
tps=
"0.00"
line95Value=
"13.00"
line95Sum=
"13.00"
line95Count=
"1"
>
<successMessageUrl>
MobileApi-0a014dc1-1339999960794-0
</successMessageUrl>
<range
value=
"10"
count=
"2"
sum=
"25.99"
avg=
"0.0"
fails=
"0"
/>
<duration
value=
"16"
count=
"2"
/>
</name>
<name
id=
"/city.bin"
totalCount=
"1"
failCount=
"0"
failPercent=
"0.00"
min=
"38.21"
max=
"38.21"
avg=
"0.0"
sum=
"38.2"
sum2=
"1460.0"
std=
"0.0"
tps=
"0.00"
line95Value=
"38.00"
line95Sum=
"38.00"
line95Count=
"1"
>
<successMessageUrl>
MobileApi-0a014dc1-1339999961753-0
</successMessageUrl>
<range
value=
"10"
count=
"1"
sum=
"38.21"
avg=
"0.0"
fails=
"0"
/>
<duration
value=
"64"
count=
"1"
/>
</name>
<name
id=
"/location.bin"
totalCount=
"1"
failCount=
"0"
failPercent=
"0.00"
min=
"249.694"
max=
"249.694"
avg=
"0.0"
sum=
"249.7"
sum2=
"62347.1"
std=
"0.0"
tps=
"0.00"
line95Value=
"249.00"
line95Sum=
"249.00"
line95Count=
"1"
>
<successMessageUrl>
MobileApi-0a014dc1-1339999968913-0
</successMessageUrl>
<range
value=
"10"
count=
"1"
sum=
"249.694"
avg=
"0.0"
fails=
"0"
/>
<duration
value=
"256"
count=
"1"
/>
</name>
<name
id=
"/locatecategory.bin"
totalCount=
"10"
failCount=
"0"
failPercent=
"0.00"
min=
"5.392"
max=
"5.392"
avg=
"0.0"
sum=
"5.4"
sum2=
"29.1"
std=
"0.0"
tps=
"0.00"
line95Value=
"5.00"
line95Sum=
"5.00"
line95Count=
"1"
>
<successMessageUrl>
MobileApi-0a014dc1-1339999994494-0
</successMessageUrl>
<range
value=
"10"
count=
"1"
sum=
"5.392"
avg=
"0.0"
fails=
"0"
/>
<duration
value=
"8"
count=
"1"
/>
</name>
<name
id=
"/localshop.bin"
totalCount=
"30"
failCount=
"0"
failPercent=
"0.00"
min=
"42.469"
max=
"2164.387"
avg=
"0.0"
sum=
"2354.1"
sum2=
"4708042.8"
std=
"0.0"
tps=
"0.00"
line95Value=
"2164.00"
line95Sum=
"2164.00"
line95Count=
"1"
>
<successMessageUrl>
MobileApi-0a014dc1-1340000001993-0
</successMessageUrl>
<range
value=
"10"
count=
"3"
sum=
"2354.0570000000002"
avg=
"0.0"
fails=
"0"
/>
<duration
value=
"64"
count=
"1"
/>
<duration
value=
"256"
count=
"1"
/>
<duration
value=
"4096"
count=
"1"
/>
</name>
</type>
</machine>
</transaction-report>
\ No newline at end of file
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/transaction_analyzer.xml
0 → 100644
浏览文件 @
c6c79306
<?xml version="1.0" encoding="utf-8"?>
<transaction-report
domain=
"group"
startTime=
"1970-01-01 08:00:00"
endTime=
"1970-01-01 08:59:59"
>
<domain>
group
</domain>
<ip>
192.168.1.1
</ip>
<machine
ip=
"192.168.1.1"
>
<type
id=
"A"
totalCount=
"1000"
failCount=
"500"
failPercent=
"50.00"
min=
"2.0"
max=
"2000.0"
avg=
"1001.0"
sum=
"1001000.0"
sum2=
"1335334000.0"
std=
"577.3"
tps=
"0.00"
line95Value=
"1902.00"
line99Value=
"2000.00"
>
<successMessageUrl>
1
</successMessageUrl>
<failMessageUrl>
2
</failMessageUrl>
<name
id=
"n1"
totalCount=
"500"
failCount=
"0"
failPercent=
"0.00"
min=
"2.0"
max=
"1998.0"
avg=
"1000.0"
sum=
"500000.0"
sum2=
"666666000.0"
std=
"577.3"
tps=
"0.00"
line95Value=
"1902.00"
line99Value=
"1998.00"
>
<successMessageUrl>
1
</successMessageUrl>
<range
value=
"0"
count=
"500"
sum=
"500000.0"
avg=
"1000.0"
fails=
"0"
/>
<duration
value=
"2"
count=
"1"
/>
<duration
value=
"8"
count=
"1"
/>
<duration
value=
"16"
count=
"2"
/>
<duration
value=
"32"
count=
"4"
/>
<duration
value=
"64"
count=
"8"
/>
<duration
value=
"128"
count=
"16"
/>
<duration
value=
"256"
count=
"32"
/>
<duration
value=
"512"
count=
"64"
/>
<duration
value=
"1024"
count=
"128"
/>
<duration
value=
"2048"
count=
"244"
/>
</name>
<name
id=
"n0"
totalCount=
"500"
failCount=
"500"
failPercent=
"100.00"
min=
"4.0"
max=
"2000.0"
avg=
"1002.0"
sum=
"501000.0"
sum2=
"668668000.0"
std=
"577.3"
tps=
"0.00"
line95Value=
"1904.00"
line99Value=
"2000.00"
>
<failMessageUrl>
2
</failMessageUrl>
<range
value=
"0"
count=
"500"
sum=
"501000.0"
avg=
"1002.0"
fails=
"500"
/>
<duration
value=
"4"
count=
"1"
/>
<duration
value=
"8"
count=
"1"
/>
<duration
value=
"16"
count=
"2"
/>
<duration
value=
"32"
count=
"4"
/>
<duration
value=
"64"
count=
"8"
/>
<duration
value=
"128"
count=
"16"
/>
<duration
value=
"256"
count=
"32"
/>
<duration
value=
"512"
count=
"64"
/>
<duration
value=
"1024"
count=
"128"
/>
<duration
value=
"2048"
count=
"244"
/>
</name>
</type>
<type
id=
"A-1"
totalCount=
"1000"
failCount=
"500"
failPercent=
"50.00"
min=
"1.0"
max=
"1000.0"
avg=
"500.5"
sum=
"500500.0"
sum2=
"333833500.0"
std=
"288.7"
tps=
"0.00"
line95Value=
"951.00"
line99Value=
"1000.00"
>
<successMessageUrl>
1
</successMessageUrl>
<failMessageUrl>
2
</failMessageUrl>
<name
id=
"n1"
totalCount=
"334"
failCount=
"167"
failPercent=
"50.00"
min=
"1.0"
max=
"1000.0"
avg=
"500.5"
sum=
"167167.0"
sum2=
"111611611.0"
std=
"289.3"
tps=
"0.00"
line95Value=
"955.00"
line99Value=
"1000.00"
>
<successMessageUrl>
1
</successMessageUrl>
<failMessageUrl>
4
</failMessageUrl>
<range
value=
"0"
count=
"334"
sum=
"167167.0"
avg=
"500.5"
fails=
"167"
/>
<duration
value=
"1"
count=
"1"
/>
<duration
value=
"4"
count=
"1"
/>
<duration
value=
"8"
count=
"1"
/>
<duration
value=
"16"
count=
"3"
/>
<duration
value=
"32"
count=
"5"
/>
<duration
value=
"64"
count=
"11"
/>
<duration
value=
"128"
count=
"21"
/>
<duration
value=
"256"
count=
"43"
/>
<duration
value=
"512"
count=
"85"
/>
<duration
value=
"1024"
count=
"163"
/>
</name>
<name
id=
"n2"
totalCount=
"333"
failCount=
"167"
failPercent=
"50.15"
min=
"2.0"
max=
"998.0"
avg=
"500.0"
sum=
"166500.0"
sum2=
"110944278.0"
std=
"288.4"
tps=
"0.00"
line95Value=
"953.00"
line99Value=
"998.00"
>
<successMessageUrl>
5
</successMessageUrl>
<failMessageUrl>
2
</failMessageUrl>
<range
value=
"0"
count=
"333"
sum=
"166500.0"
avg=
"500.0"
fails=
"167"
/>
<duration
value=
"2"
count=
"1"
/>
<duration
value=
"8"
count=
"2"
/>
<duration
value=
"16"
count=
"2"
/>
<duration
value=
"32"
count=
"6"
/>
<duration
value=
"64"
count=
"10"
/>
<duration
value=
"128"
count=
"22"
/>
<duration
value=
"256"
count=
"42"
/>
<duration
value=
"512"
count=
"86"
/>
<duration
value=
"1024"
count=
"162"
/>
</name>
<name
id=
"n0"
totalCount=
"333"
failCount=
"166"
failPercent=
"49.85"
min=
"3.0"
max=
"999.0"
avg=
"501.0"
sum=
"166833.0"
sum2=
"111277611.0"
std=
"288.4"
tps=
"0.00"
line95Value=
"954.00"
line99Value=
"999.00"
>
<successMessageUrl>
3
</successMessageUrl>
<failMessageUrl>
6
</failMessageUrl>
<range
value=
"0"
count=
"333"
sum=
"166833.0"
avg=
"501.0"
fails=
"166"
/>
<duration
value=
"4"
count=
"1"
/>
<duration
value=
"8"
count=
"1"
/>
<duration
value=
"16"
count=
"3"
/>
<duration
value=
"32"
count=
"5"
/>
<duration
value=
"64"
count=
"11"
/>
<duration
value=
"128"
count=
"21"
/>
<duration
value=
"256"
count=
"43"
/>
<duration
value=
"512"
count=
"85"
/>
<duration
value=
"1024"
count=
"163"
/>
</name>
</type>
</machine>
</transaction-report>
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/
TransactionR
eport.html
→
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/
transaction_r
eport.html
浏览文件 @
c6c79306
文件已移动
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/
TransactionR
eport.json
→
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/
transaction_r
eport.json
浏览文件 @
c6c79306
文件已移动
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/
TransactionR
eport.xml
→
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/
transaction_r
eport.xml
浏览文件 @
c6c79306
文件已移动
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/transaction
F
ilter.xml
→
cat-consumer/src/test/resources/com/dianping/cat/consumer/transaction/transaction
_report_f
ilter.xml
浏览文件 @
c6c79306
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录