Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
53f0ff19
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,发现更多精彩内容 >>
提交
53f0ff19
编写于
11月 27, 2013
作者:
A
ainilife
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'biz' of
ssh://code.dianpingoa.com/arch/cat
into biz
上级
9bcee645
df803fe0
变更
45
展开全部
隐藏空白更改
内联
并排
Showing
45 changed file
with
1498 addition
and
581 deletion
+1498
-581
README.md
README.md
+3
-1
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/build/ComponentsConfigurator.java
...m/dianping/cat/consumer/build/ComponentsConfigurator.java
+3
-3
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/metric/MetricAnalyzer.java
...java/com/dianping/cat/consumer/metric/MetricAnalyzer.java
+1
-1
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/metric/MetricConfigManager.java
...com/dianping/cat/consumer/metric/MetricConfigManager.java
+3
-3
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/metric/ProductLineConfigManager.java
...ianping/cat/consumer/metric/ProductLineConfigManager.java
+2
-2
cat-consumer-advanced/src/main/resources/META-INF/plexus/components.xml
...dvanced/src/main/resources/META-INF/plexus/components.xml
+7
-7
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/AllTests.java
...ced/src/test/java/com/dianping/cat/consumer/AllTests.java
+8
-2
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/MockLog.java
...nced/src/test/java/com/dianping/cat/consumer/MockLog.java
+110
-0
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/metric/MetricAnalyzerTest.java
.../com/dianping/cat/consumer/metric/MetricAnalyzerTest.java
+5
-2
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/metric/MetricConfigManagerTest.java
...dianping/cat/consumer/metric/MetricConfigManagerTest.java
+143
-0
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/metric/ProductLineConfigManagerTest.java
...ing/cat/consumer/metric/ProductLineConfigManagerTest.java
+131
-0
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/performance/MetricPerformanceTest.java
...nping/cat/consumer/performance/MetricPerformanceTest.java
+1
-1
cat-consumer-advanced/src/test/resources/com/dianping/cat/consumer/metric/metric_analyzer.xml
...rces/com/dianping/cat/consumer/metric/metric_analyzer.xml
+0
-0
cat-consumer/src/main/java/com/dianping/cat/consumer/dump/DumpAnalyzer.java
...ain/java/com/dianping/cat/consumer/dump/DumpAnalyzer.java
+16
-0
cat-consumer/src/main/java/com/dianping/cat/consumer/problem/aggregation/AggregationConfigManager.java
...onsumer/problem/aggregation/AggregationConfigManager.java
+1
-1
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/DefaultConsumerTest.java
...t/java/com/dianping/cat/consumer/DefaultConsumerTest.java
+21
-0
cat-consumer/src/test/java/com/dianping/cat/consumer/MockLog.java
...umer/src/test/java/com/dianping/cat/consumer/MockLog.java
+110
-0
cat-consumer/src/test/java/com/dianping/cat/consumer/RealtimeConfigConfiguration.java
...om/dianping/cat/consumer/RealtimeConfigConfiguration.java
+51
-0
cat-consumer/src/test/java/com/dianping/cat/consumer/core/DumpAnalyzerTest.java
...java/com/dianping/cat/consumer/core/DumpAnalyzerTest.java
+0
-64
cat-consumer/src/test/java/com/dianping/cat/consumer/dump/DumpAnalyzerTest.java
...java/com/dianping/cat/consumer/dump/DumpAnalyzerTest.java
+133
-0
cat-consumer/src/test/java/com/dianping/cat/consumer/problem/AggregationConfigManagerTest.java
...ng/cat/consumer/problem/AggregationConfigManagerTest.java
+151
-0
cat-consumer/src/test/java/com/dianping/cat/consumer/problem/ProblemAnalyzerTest.java
...om/dianping/cat/consumer/problem/ProblemAnalyzerTest.java
+60
-36
cat-consumer/src/test/java/com/dianping/cat/consumer/state/StateAnalyzerTest.java
...va/com/dianping/cat/consumer/state/StateAnalyzerTest.java
+0
-1
cat-consumer/src/test/resources/com/dianping/cat/consumer/problem/problem_analyzer.xml
...es/com/dianping/cat/consumer/problem/problem_analyzer.xml
+485
-319
cat-core/src/main/java/com/dianping/cat/storage/DefaultBucketManager.java
...n/java/com/dianping/cat/storage/DefaultBucketManager.java
+0
-37
cat-home/src/main/java/com/dianping/cat/build/ABTestComponentConfigurator.java
...a/com/dianping/cat/build/ABTestComponentConfigurator.java
+1
-1
cat-home/src/main/java/com/dianping/cat/build/CatDatabaseConfigurator.java
.../java/com/dianping/cat/build/CatDatabaseConfigurator.java
+0
-3
cat-home/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
...n/java/com/dianping/cat/build/ComponentsConfigurator.java
+2
-2
cat-home/src/main/java/com/dianping/cat/build/TaskComponentConfigurator.java
...ava/com/dianping/cat/build/TaskComponentConfigurator.java
+2
-2
cat-home/src/main/java/com/dianping/cat/build/UserDatabaseConfigurator.java
...java/com/dianping/cat/build/UserDatabaseConfigurator.java
+0
-3
cat-home/src/main/java/com/dianping/cat/report/page/dependency/Handler.java
...java/com/dianping/cat/report/page/dependency/Handler.java
+1
-1
cat-home/src/main/java/com/dianping/cat/report/page/dependency/graph/TopologyGraphManager.java
...at/report/page/dependency/graph/TopologyGraphManager.java
+1
-1
cat-home/src/main/java/com/dianping/cat/report/page/metric/Handler.java
...ain/java/com/dianping/cat/report/page/metric/Handler.java
+1
-1
cat-home/src/main/java/com/dianping/cat/report/page/metric/Model.java
.../main/java/com/dianping/cat/report/page/metric/Model.java
+1
-1
cat-home/src/main/java/com/dianping/cat/report/page/metric/chart/GraphCreator.java
...m/dianping/cat/report/page/metric/chart/GraphCreator.java
+3
-3
cat-home/src/main/java/com/dianping/cat/report/service/impl/MetricReportService.java
...dianping/cat/report/service/impl/MetricReportService.java
+1
-1
cat-home/src/main/java/com/dianping/cat/report/task/abtest/ABTestReportBuilder.java
.../dianping/cat/report/task/abtest/ABTestReportBuilder.java
+1
-1
cat-home/src/main/java/com/dianping/cat/report/task/metric/MetricAlert.java
...java/com/dianping/cat/report/task/metric/MetricAlert.java
+2
-2
cat-home/src/main/java/com/dianping/cat/report/task/metric/MetricBaselineReportBuilder.java
...g/cat/report/task/metric/MetricBaselineReportBuilder.java
+2
-2
cat-home/src/main/java/com/dianping/cat/report/task/spi/ReportFacade.java
...n/java/com/dianping/cat/report/task/spi/ReportFacade.java
+1
-1
cat-home/src/main/java/com/dianping/cat/system/config/ConfigReloadTask.java
...java/com/dianping/cat/system/config/ConfigReloadTask.java
+2
-2
cat-home/src/main/java/com/dianping/cat/system/page/abtest/ReportHandler.java
...va/com/dianping/cat/system/page/abtest/ReportHandler.java
+1
-1
cat-home/src/main/java/com/dianping/cat/system/page/config/Handler.java
...ain/java/com/dianping/cat/system/page/config/Handler.java
+2
-2
cat-home/src/main/resources/META-INF/plexus/components.xml
cat-home/src/main/resources/META-INF/plexus/components.xml
+23
-71
未找到文件。
README.md
浏览文件 @
53f0ff19
...
...
@@ -22,7 +22,7 @@ CAT监控系统将每次URL、Service的请求内部执行情况都封装为一
![
Alt text
](
https://raw.github.com/dianping/cat/master/cat-home/src/main/webapp/images/logviewAll02.png
)
分布式消息树【一台机器
CALL
另外一台机器】
分布式消息树【一台机器
调用
另外一台机器】
---------------------
![
Alt text
](
https://raw.github.com/dianping/cat/master/cat-home/src/main/webapp/images/logviewAll03.png
)
...
...
@@ -44,7 +44,9 @@ Quick Started
Note:
*
Linux
\M
ac 需要对/data/appdatas/cat和/data/applogs/cat有读写权限
*
Windows 则是对系统运行盘下的/data/appdatas/cat和/data/applogs/cat有读写权限
#####3、(Optional)如果安装了hadoop集群,需到/data/appdatas/cat/server.xml中配置对应hadoop信息。将localmode设置为false,默认情况下,CAT在开发模式(localmode=true)下工作。
#####4、运行CAT
cd cat-home;mvn jetty:run
然后打开浏览器,输入http://localhost:2281/cat/。
...
...
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/build/ComponentsConfigurator.java
浏览文件 @
53f0ff19
...
...
@@ -13,9 +13,6 @@ import com.dianping.cat.ServerConfigManager;
import
com.dianping.cat.abtest.spi.internal.ABTestCodec
;
import
com.dianping.cat.analysis.MessageAnalyzer
;
import
com.dianping.cat.consumer.CatConsumerAdvancedModule
;
import
com.dianping.cat.consumer.advanced.MetricAnalyzer
;
import
com.dianping.cat.consumer.advanced.MetricConfigManager
;
import
com.dianping.cat.consumer.advanced.ProductLineConfigManager
;
import
com.dianping.cat.consumer.advanced.dal.BusinessReportDao
;
import
com.dianping.cat.consumer.advanced.dal.SqltableDao
;
import
com.dianping.cat.consumer.cross.CrossAnalyzer
;
...
...
@@ -24,6 +21,9 @@ import com.dianping.cat.consumer.dependency.DependencyAnalyzer;
import
com.dianping.cat.consumer.dependency.DependencyDelegate
;
import
com.dianping.cat.consumer.matrix.MatrixAnalyzer
;
import
com.dianping.cat.consumer.matrix.MatrixDelegate
;
import
com.dianping.cat.consumer.metric.MetricAnalyzer
;
import
com.dianping.cat.consumer.metric.MetricConfigManager
;
import
com.dianping.cat.consumer.metric.ProductLineConfigManager
;
import
com.dianping.cat.consumer.sql.DatabaseParser
;
import
com.dianping.cat.consumer.sql.SqlAnalyzer
;
import
com.dianping.cat.consumer.sql.SqlDelegate
;
...
...
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/
advanced
/MetricAnalyzer.java
→
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/
metric
/MetricAnalyzer.java
浏览文件 @
53f0ff19
package
com.dianping.cat.consumer.
advanced
;
package
com.dianping.cat.consumer.
metric
;
import
java.util.Date
;
import
java.util.HashMap
;
...
...
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/
advanced
/MetricConfigManager.java
→
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/
metric
/MetricConfigManager.java
浏览文件 @
53f0ff19
package
com.dianping.cat.consumer.
advanced
;
package
com.dianping.cat.consumer.
metric
;
import
java.io.IOException
;
import
java.util.ArrayList
;
...
...
@@ -24,7 +24,7 @@ import com.dianping.cat.Cat;
import
com.dianping.cat.advanced.metric.config.entity.MetricConfig
;
import
com.dianping.cat.advanced.metric.config.entity.MetricItemConfig
;
import
com.dianping.cat.advanced.metric.config.transform.DefaultSaxParser
;
import
com.dianping.cat.consumer.
advanced
.MetricAnalyzer.ConfigItem
;
import
com.dianping.cat.consumer.
metric
.MetricAnalyzer.ConfigItem
;
import
com.dianping.cat.core.config.Config
;
import
com.dianping.cat.core.config.ConfigDao
;
import
com.dianping.cat.core.config.ConfigEntity
;
...
...
@@ -32,7 +32,7 @@ import com.dianping.cat.core.config.ConfigEntity;
public
class
MetricConfigManager
implements
Initializable
,
LogEnabled
{
@Inject
pr
ivate
ConfigDao
m_configDao
;
pr
otected
ConfigDao
m_configDao
;
private
int
m_configId
;
...
...
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/
advanced
/ProductLineConfigManager.java
→
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/
metric
/ProductLineConfigManager.java
浏览文件 @
53f0ff19
package
com.dianping.cat.consumer.
advanced
;
package
com.dianping.cat.consumer.
metric
;
import
java.io.IOException
;
import
java.util.ArrayList
;
...
...
@@ -34,7 +34,7 @@ import com.dianping.cat.core.config.ConfigEntity;
public
class
ProductLineConfigManager
implements
Initializable
,
LogEnabled
{
@Inject
pr
ivate
ConfigDao
m_configDao
;
pr
otected
ConfigDao
m_configDao
;
private
int
m_configId
;
...
...
cat-consumer-advanced/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
53f0ff19
...
...
@@ -215,8 +215,8 @@
</requirements>
</component>
<component>
<role>
com.dianping.cat.consumer.
advanced
.MetricConfigManager
</role>
<implementation>
com.dianping.cat.consumer.
advanced
.MetricConfigManager
</implementation>
<role>
com.dianping.cat.consumer.
metric
.MetricConfigManager
</role>
<implementation>
com.dianping.cat.consumer.
metric
.MetricConfigManager
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.core.config.ConfigDao
</role>
...
...
@@ -224,8 +224,8 @@
</requirements>
</component>
<component>
<role>
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
</role>
<implementation>
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
</implementation>
<role>
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
</role>
<implementation>
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.core.config.ConfigDao
</role>
...
...
@@ -235,7 +235,7 @@
<component>
<role>
com.dianping.cat.analysis.MessageAnalyzer
</role>
<role-hint>
metric
</role-hint>
<implementation>
com.dianping.cat.consumer.
advanced
.MetricAnalyzer
</implementation>
<implementation>
com.dianping.cat.consumer.
metric
.MetricAnalyzer
</implementation>
<instantiation-strategy>
per-lookup
</instantiation-strategy>
<requirements>
<requirement>
...
...
@@ -245,10 +245,10 @@
<role>
com.dianping.cat.consumer.advanced.dal.BusinessReportDao
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.MetricConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.MetricConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.abtest.spi.internal.ABTestCodec
</role>
...
...
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/AllTests.java
浏览文件 @
53f0ff19
...
...
@@ -4,7 +4,6 @@ import org.junit.runner.RunWith;
import
org.junit.runners.Suite
;
import
org.junit.runners.Suite.SuiteClasses
;
import
com.dianping.cat.consumer.advanced.MetricAnalyzerTest
;
import
com.dianping.cat.consumer.cross.CrossAnalyzerTest
;
import
com.dianping.cat.consumer.cross.CrossInfoTest
;
import
com.dianping.cat.consumer.cross.CrossReportMergerTest
;
...
...
@@ -13,6 +12,9 @@ import com.dianping.cat.consumer.dependency.DependencyReportMergerTest;
import
com.dianping.cat.consumer.matrix.MatrixAnalyzerTest
;
import
com.dianping.cat.consumer.matrix.MatrixModelTest
;
import
com.dianping.cat.consumer.matrix.MatrixReportMergerTest
;
import
com.dianping.cat.consumer.metric.MetricAnalyzerTest
;
import
com.dianping.cat.consumer.metric.MetricConfigManagerTest
;
import
com.dianping.cat.consumer.metric.ProductLineConfigManagerTest
;
import
com.dianping.cat.consumer.sql.DatabaseParserTest
;
import
com.dianping.cat.consumer.sql.SqlAnalyzerTest
;
import
com.dianping.cat.consumer.sql.SqlParsersTest
;
...
...
@@ -45,7 +47,11 @@ MatrixAnalyzerTest.class,
DependencyAnalyzerTest
.
class
,
DependencyReportMergerTest
.
class
DependencyReportMergerTest
.
class
,
ProductLineConfigManagerTest
.
class
,
MetricConfigManagerTest
.
class
})
public
class
AllTests
{
...
...
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/MockLog.java
0 → 100644
浏览文件 @
53f0ff19
package
com.dianping.cat.consumer
;
import
org.codehaus.plexus.logging.Logger
;
public
class
MockLog
implements
Logger
{
@Override
public
void
debug
(
String
message
)
{
}
@Override
public
void
debug
(
String
message
,
Throwable
throwable
)
{
}
@Override
public
boolean
isDebugEnabled
()
{
return
false
;
}
@Override
public
void
info
(
String
message
)
{
}
@Override
public
void
info
(
String
message
,
Throwable
throwable
)
{
}
@Override
public
boolean
isInfoEnabled
()
{
return
false
;
}
@Override
public
void
warn
(
String
message
)
{
}
@Override
public
void
warn
(
String
message
,
Throwable
throwable
)
{
}
@Override
public
boolean
isWarnEnabled
()
{
return
false
;
}
@Override
public
void
error
(
String
message
)
{
}
@Override
public
void
error
(
String
message
,
Throwable
throwable
)
{
}
@Override
public
boolean
isErrorEnabled
()
{
return
false
;
}
@Override
public
void
fatalError
(
String
message
)
{
}
@Override
public
void
fatalError
(
String
message
,
Throwable
throwable
)
{
}
@Override
public
boolean
isFatalErrorEnabled
()
{
return
false
;
}
@Override
public
Logger
getChildLogger
(
String
name
)
{
return
null
;
}
@Override
public
int
getThreshold
()
{
return
0
;
}
@Override
public
void
setThreshold
(
int
threshold
)
{
}
@Override
public
String
getName
()
{
return
null
;
}
}
\ No newline at end of file
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/
advanced
/MetricAnalyzerTest.java
→
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/
metric
/MetricAnalyzerTest.java
浏览文件 @
53f0ff19
package
com.dianping.cat.consumer.
advanced
;
package
com.dianping.cat.consumer.
metric
;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
...
...
@@ -24,10 +24,13 @@ import org.unidal.lookup.ComponentTestCase;
import
com.dianping.cat.Constants
;
import
com.dianping.cat.abtest.spi.internal.DefaultABTestCodec
;
import
com.dianping.cat.advanced.metric.config.entity.MetricItemConfig
;
import
com.dianping.cat.consumer.advanced.MetricAnalyzer.ConfigItem
;
import
com.dianping.cat.consumer.advanced.dal.BusinessReport
;
import
com.dianping.cat.consumer.advanced.dal.BusinessReportDao
;
import
com.dianping.cat.consumer.company.model.entity.ProductLine
;
import
com.dianping.cat.consumer.metric.MetricAnalyzer
;
import
com.dianping.cat.consumer.metric.MetricConfigManager
;
import
com.dianping.cat.consumer.metric.ProductLineConfigManager
;
import
com.dianping.cat.consumer.metric.MetricAnalyzer.ConfigItem
;
import
com.dianping.cat.consumer.metric.model.entity.MetricReport
;
import
com.dianping.cat.message.internal.DefaultEvent
;
import
com.dianping.cat.message.internal.DefaultMetric
;
...
...
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/metric/MetricConfigManagerTest.java
0 → 100644
浏览文件 @
53f0ff19
package
com.dianping.cat.consumer.metric
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.List
;
import
junit.framework.Assert
;
import
org.junit.Test
;
import
org.unidal.dal.jdbc.DalException
;
import
org.unidal.dal.jdbc.Readset
;
import
org.unidal.dal.jdbc.Updateset
;
import
com.dianping.cat.advanced.metric.config.entity.MetricConfig
;
import
com.dianping.cat.advanced.metric.config.entity.MetricItemConfig
;
import
com.dianping.cat.consumer.MockLog
;
import
com.dianping.cat.consumer.metric.MetricAnalyzer.ConfigItem
;
import
com.dianping.cat.core.config.Config
;
import
com.dianping.cat.core.config.ConfigDao
;
public
class
MetricConfigManagerTest
{
private
static
int
s_storeCount
;
@Test
public
void
testInitNormal
()
throws
Exception
{
MetricConfigManager
manager
=
new
MockMetricConfigManager
();
((
MockMetricConfigManager
)
manager
).
setConfigDao
(
new
MockConfigDao1
());
manager
.
initialize
();
String
domain1
=
"domain1"
;
String
domain2
=
"domain2"
;
manager
.
insertIfNotExist
(
domain1
,
"type"
,
"metricKey"
,
new
ConfigItem
());
Assert
.
assertEquals
(
1
,
s_storeCount
);
manager
.
insertIfNotExist
(
domain1
,
"type"
,
"metricKey"
,
new
ConfigItem
());
Assert
.
assertEquals
(
1
,
s_storeCount
);
manager
.
insertIfNotExist
(
domain2
,
"type"
,
"metricKey"
,
new
ConfigItem
());
Assert
.
assertEquals
(
2
,
s_storeCount
);
manager
.
insertMetricItemConfig
(
new
MetricItemConfig
());
Assert
.
assertEquals
(
3
,
s_storeCount
);
MetricItemConfig
item
=
manager
.
queryMetricItemConfig
(
manager
.
buildMetricKey
(
domain1
,
"type"
,
"metricKey"
));
Assert
.
assertEquals
(
true
,
item
!=
null
);
manager
.
deleteDomainConfig
(
manager
.
buildMetricKey
(
domain1
,
"type"
,
"metricKey"
));
Assert
.
assertEquals
(
4
,
s_storeCount
);
Assert
.
assertEquals
(
2
,
manager
.
getMetricConfig
().
getMetricItemConfigs
().
size
());
HashSet
<
String
>
hashSet
=
new
HashSet
<
String
>();
hashSet
.
add
(
domain1
);
hashSet
.
add
(
domain2
);
List
<
MetricItemConfig
>
sets
=
manager
.
queryMetricItemConfigs
(
hashSet
);
Assert
.
assertEquals
(
1
,
sets
.
size
());
manager
.
enableLogging
(
new
MockLog
());
manager
.
refreshMetricConfig
();
Assert
.
assertEquals
(
1
,
manager
.
getMetricConfig
().
getMetricItemConfigs
().
size
());
}
@Test
public
void
testInitThrowException
()
throws
Exception
{
MetricConfigManager
manager
=
new
MockMetricConfigManager
();
((
MockMetricConfigManager
)
manager
).
setConfigDao
(
new
MockConfigDao2
());
manager
.
enableLogging
(
new
MockLog
());
try
{
manager
.
initialize
();
}
catch
(
Exception
e
)
{
}
MetricConfig
config
=
manager
.
getMetricConfig
();
Assert
.
assertEquals
(
0
,
config
.
getMetricItemConfigs
().
size
());
}
public
static
class
MockMetricConfigManager
extends
MetricConfigManager
{
public
void
setConfigDao
(
ConfigDao
configDao
)
{
m_configDao
=
configDao
;
}
}
public
static
class
MockConfigDao2
extends
MockConfigDao1
{
@Override
public
Config
findByName
(
String
name
,
Readset
<
Config
>
readset
)
throws
DalException
{
throw
new
DalException
(
"this is a exception for test"
);
}
}
public
static
class
MockConfigDao1
extends
ConfigDao
{
@Override
public
Config
createLocal
()
{
return
super
.
createLocal
();
}
@Override
public
int
deleteByPK
(
Config
proto
)
throws
DalException
{
return
1
;
}
@Override
public
Config
findByPK
(
int
keyId
,
Readset
<
Config
>
readset
)
throws
DalException
{
Config
config
=
new
Config
();
config
.
setId
(
keyId
);
config
.
setContent
(
new
MetricConfig
().
toString
());
config
.
setModifyDate
(
new
Date
());
return
config
;
}
@Override
public
Config
findByName
(
String
name
,
Readset
<
Config
>
readset
)
throws
DalException
{
Config
config
=
new
Config
();
config
.
setName
(
name
);
MetricConfig
metricConfig
=
new
MetricConfig
();
MetricItemConfig
metricItemConfig
=
new
MetricItemConfig
();
metricItemConfig
.
setDomain
(
"domain"
);
metricItemConfig
.
setMetricKey
(
"domain:URL:metricKey"
);
metricItemConfig
.
setType
(
"URL"
);
metricItemConfig
.
setMetricKey
(
"metricKey"
);
metricConfig
.
addMetricItemConfig
(
metricItemConfig
);
config
.
setContent
(
metricConfig
.
toString
());
config
.
setModifyDate
(
new
Date
());
return
config
;
}
@Override
public
int
insert
(
Config
proto
)
throws
DalException
{
return
1
;
}
@Override
public
int
updateByPK
(
Config
proto
,
Updateset
<
Config
>
updateset
)
throws
DalException
{
s_storeCount
++;
return
1
;
}
}
}
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/metric/ProductLineConfigManagerTest.java
0 → 100644
浏览文件 @
53f0ff19
package
com.dianping.cat.consumer.metric
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
junit.framework.Assert
;
import
org.junit.Test
;
import
org.unidal.dal.jdbc.DalException
;
import
org.unidal.dal.jdbc.DalNotFoundException
;
import
org.unidal.dal.jdbc.Readset
;
import
org.unidal.dal.jdbc.Updateset
;
import
com.dianping.cat.consumer.MockLog
;
import
com.dianping.cat.consumer.company.model.entity.Company
;
import
com.dianping.cat.consumer.company.model.entity.ProductLine
;
import
com.dianping.cat.core.config.Config
;
import
com.dianping.cat.core.config.ConfigDao
;
public
class
ProductLineConfigManagerTest
{
private
static
int
s_storeCount
;
@Test
public
void
testInitNormal
()
throws
Exception
{
ProductLineConfigManager
manager
=
new
MockProductLineConfigManager
();
((
MockProductLineConfigManager
)
manager
).
setConfigDao
(
new
MockConfigDao1
());
manager
.
initialize
();
ProductLine
line1
=
new
ProductLine
(
"Test1"
);
ProductLine
line2
=
new
ProductLine
(
"Test2"
);
String
[]
domains1
=
{
"domain1"
,
"domain2"
};
String
[]
domains2
=
{
"domain3"
,
"domain4"
};
manager
.
insertProductLine
(
line1
,
domains1
);
manager
.
insertProductLine
(
line2
,
domains2
);
Assert
.
assertEquals
(
2
,
s_storeCount
);
Assert
.
assertEquals
(
"Default"
,
manager
.
queryProductLineByDomain
(
"domain"
));
Assert
.
assertEquals
(
"Test1"
,
manager
.
queryProductLineByDomain
(
"domain1"
));
List
<
String
>
pDomains
=
manager
.
queryProductLineDomains
(
"Test1"
);
Assert
.
assertEquals
(
2
,
pDomains
.
size
());
Map
<
String
,
ProductLine
>
productLines
=
manager
.
queryProductLines
();
Assert
.
assertEquals
(
3
,
productLines
.
size
());
manager
.
enableLogging
(
new
MockLog
());
manager
.
refreshProductLineConfig
();
productLines
=
manager
.
queryProductLines
();
Assert
.
assertEquals
(
1
,
productLines
.
size
());
}
@Test
public
void
testInitThrowException
()
throws
Exception
{
ProductLineConfigManager
manager
=
new
MockProductLineConfigManager
();
((
MockProductLineConfigManager
)
manager
).
setConfigDao
(
new
MockConfigDao2
());
try
{
manager
.
initialize
();
}
catch
(
Exception
e
)
{
}
Company
config
=
manager
.
getCompany
();
Assert
.
assertEquals
(
0
,
config
.
getProductLines
().
size
());
}
public
static
class
MockProductLineConfigManager
extends
ProductLineConfigManager
{
public
void
setConfigDao
(
ConfigDao
configDao
)
{
m_configDao
=
configDao
;
}
}
public
static
class
MockConfigDao2
extends
MockConfigDao1
{
@Override
public
Config
findByName
(
String
name
,
Readset
<
Config
>
readset
)
throws
DalNotFoundException
{
throw
new
DalNotFoundException
(
"this is a exception for test"
);
}
}
public
static
class
MockConfigDao1
extends
ConfigDao
{
@Override
public
Config
createLocal
()
{
return
super
.
createLocal
();
}
@Override
public
int
deleteByPK
(
Config
proto
)
throws
DalException
{
return
1
;
}
@Override
public
Config
findByPK
(
int
keyId
,
Readset
<
Config
>
readset
)
throws
DalException
{
Config
config
=
new
Config
();
config
.
setId
(
keyId
);
config
.
setModifyDate
(
new
Date
());
config
.
setContent
(
new
Company
().
toString
());
return
config
;
}
@Override
public
Config
findByName
(
String
name
,
Readset
<
Config
>
readset
)
throws
DalException
{
Config
config
=
new
Config
();
config
.
setName
(
name
);
Company
company
=
new
Company
();
ProductLine
productLine
=
new
ProductLine
(
"Test"
);
company
.
addProductLine
(
productLine
);
config
.
setContent
(
company
.
toString
());
config
.
setModifyDate
(
new
Date
());
return
config
;
}
@Override
public
int
insert
(
Config
proto
)
throws
DalException
{
return
1
;
}
@Override
public
int
updateByPK
(
Config
proto
,
Updateset
<
Config
>
updateset
)
throws
DalException
{
s_storeCount
++;
return
1
;
}
}
}
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/performance/MetricPerformanceTest.java
浏览文件 @
53f0ff19
...
...
@@ -3,7 +3,7 @@ package com.dianping.cat.consumer.performance;
import
org.junit.Test
;
import
org.unidal.lookup.ComponentTestCase
;
import
com.dianping.cat.consumer.
advanced
.MetricAnalyzer
;
import
com.dianping.cat.consumer.
metric
.MetricAnalyzer
;
import
com.dianping.cat.message.Message
;
import
com.dianping.cat.message.internal.MockMessageBuilder
;
import
com.dianping.cat.message.spi.MessageTree
;
...
...
cat-consumer-advanced/src/test/resources/com/dianping/cat/consumer/
advanced
/metric_analyzer.xml
→
cat-consumer-advanced/src/test/resources/com/dianping/cat/consumer/
metric
/metric_analyzer.xml
浏览文件 @
53f0ff19
文件已移动
cat-consumer/src/main/java/com/dianping/cat/consumer/dump/DumpAnalyzer.java
浏览文件 @
53f0ff19
...
...
@@ -120,4 +120,20 @@ public class DumpAnalyzer extends AbstractMessageAnalyzer<Object> implements Log
}
}
public
Map
<
String
,
Integer
>
getOldVersionDomains
()
{
return
m_oldVersionDomains
;
}
public
void
setServerStateManager
(
ServerStatisticManager
serverStateManager
)
{
m_serverStateManager
=
serverStateManager
;
}
public
void
setBucketManager
(
LocalMessageBucketManager
bucketManager
)
{
m_bucketManager
=
bucketManager
;
}
public
Map
<
String
,
Integer
>
getErrorTimestampDomains
()
{
return
m_errorTimestampDomains
;
}
}
cat-consumer/src/main/java/com/dianping/cat/consumer/problem/aggregation/AggregationConfigManager.java
浏览文件 @
53f0ff19
...
...
@@ -18,7 +18,7 @@ import com.dianping.cat.core.config.ConfigEntity;
public
class
AggregationConfigManager
implements
Initializable
{
@Inject
pr
ivate
ConfigDao
m_configDao
;
pr
otected
ConfigDao
m_configDao
;
@Inject
protected
AggregationHandler
m_handler
;
...
...
cat-consumer/src/test/java/com/dianping/cat/consumer/AllTests.java
浏览文件 @
53f0ff19
...
...
@@ -9,10 +9,12 @@ import com.dianping.cat.consumer.core.GsonTest;
import
com.dianping.cat.consumer.core.NumberFormatTest
;
import
com.dianping.cat.consumer.core.aggregation.CompositeFormatTest
;
import
com.dianping.cat.consumer.core.aggregation.DefaultFormatTest
;
import
com.dianping.cat.consumer.dump.DumpAnalyzerTest
;
import
com.dianping.cat.consumer.event.EventAnalyzerTest
;
import
com.dianping.cat.consumer.event.EventReportMergerTest
;
import
com.dianping.cat.consumer.heartbeat.HeartbeatAnalyzerTest
;
import
com.dianping.cat.consumer.heartbeat.HeartbeatReportMergerTest
;
import
com.dianping.cat.consumer.problem.AggregationConfigManagerTest
;
import
com.dianping.cat.consumer.problem.ProblemAnalyzerTest
;
import
com.dianping.cat.consumer.problem.ProblemHandlerTest
;
import
com.dianping.cat.consumer.problem.ProblemReportAggregationTest
;
...
...
@@ -81,12 +83,16 @@ ProblemAnalyzerTest.class,
ProblemReportMergerTest
.
class
,
AggregationConfigManagerTest
.
class
,
ProblemReportAllBuilderTest
.
class
,
CompositeFormatTest
.
class
,
DefaultFormatTest
.
class
,
DumpAnalyzerTest
.
class
,
TransactionReportTypeAggergatorTest
.
class
})
public
class
AllTests
{
...
...
cat-consumer/src/test/java/com/dianping/cat/consumer/DefaultConsumerTest.java
0 → 100644
浏览文件 @
53f0ff19
package
com.dianping.cat.consumer
;
import
junit.framework.Assert
;
import
org.junit.Test
;
import
org.unidal.lookup.ComponentTestCase
;
import
com.dianping.cat.analysis.MessageAnalyzer
;
import
com.dianping.cat.consumer.transaction.TransactionAnalyzer
;
import
com.dianping.cat.message.spi.core.MessageConsumer
;
public
class
DefaultConsumerTest
extends
ComponentTestCase
{
@Test
public
void
test
()
throws
Exception
{
RealtimeConsumer
consumer
=
(
RealtimeConsumer
)
lookup
(
MessageConsumer
.
class
);
MessageAnalyzer
analyzer
=
consumer
.
getCurrentAnalyzer
(
TransactionAnalyzer
.
ID
);
Assert
.
assertEquals
(
true
,
analyzer
!=
null
);
}
}
cat-consumer/src/test/java/com/dianping/cat/consumer/MockLog.java
0 → 100644
浏览文件 @
53f0ff19
package
com.dianping.cat.consumer
;
import
org.codehaus.plexus.logging.Logger
;
public
class
MockLog
implements
Logger
{
@Override
public
void
debug
(
String
message
)
{
}
@Override
public
void
debug
(
String
message
,
Throwable
throwable
)
{
}
@Override
public
boolean
isDebugEnabled
()
{
return
false
;
}
@Override
public
void
info
(
String
message
)
{
}
@Override
public
void
info
(
String
message
,
Throwable
throwable
)
{
}
@Override
public
boolean
isInfoEnabled
()
{
return
false
;
}
@Override
public
void
warn
(
String
message
)
{
}
@Override
public
void
warn
(
String
message
,
Throwable
throwable
)
{
}
@Override
public
boolean
isWarnEnabled
()
{
return
false
;
}
@Override
public
void
error
(
String
message
)
{
}
@Override
public
void
error
(
String
message
,
Throwable
throwable
)
{
}
@Override
public
boolean
isErrorEnabled
()
{
return
false
;
}
@Override
public
void
fatalError
(
String
message
)
{
}
@Override
public
void
fatalError
(
String
message
,
Throwable
throwable
)
{
}
@Override
public
boolean
isFatalErrorEnabled
()
{
return
false
;
}
@Override
public
Logger
getChildLogger
(
String
name
)
{
return
null
;
}
@Override
public
int
getThreshold
()
{
return
0
;
}
@Override
public
void
setThreshold
(
int
threshold
)
{
}
@Override
public
String
getName
()
{
return
null
;
}
}
\ No newline at end of file
cat-consumer/src/test/java/com/dianping/cat/consumer/RealtimeConfigConfiguration.java
0 → 100644
浏览文件 @
53f0ff19
package
com.dianping.cat.consumer
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.unidal.lookup.configuration.AbstractResourceConfigurator
;
import
org.unidal.lookup.configuration.Component
;
import
com.dianping.cat.analysis.MessageAnalyzer
;
import
com.dianping.cat.analysis.MessageAnalyzerManager
;
import
com.dianping.cat.consumer.event.EventAnalyzer
;
import
com.dianping.cat.consumer.top.TopAnalyzer
;
import
com.dianping.cat.consumer.transaction.Configurator
;
import
com.dianping.cat.consumer.transaction.TransactionAnalyzer
;
import
com.dianping.cat.consumer.transaction.TransactionAnalyzerTest
;
public
class
RealtimeConfigConfiguration
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
>();
return
all
;
}
public
static
class
MockMessageAnalyzerManager
implements
MessageAnalyzerManager
{
@Override
public
List
<
String
>
getAnalyzerNames
()
{
List
<
String
>
list
=
new
ArrayList
<
String
>();
list
.
add
(
TransactionAnalyzer
.
ID
);
list
.
add
(
EventAnalyzer
.
ID
);
list
.
add
(
TopAnalyzer
.
ID
);
return
list
;
}
@Override
public
MessageAnalyzer
getAnalyzer
(
String
name
,
long
startTime
)
{
return
null
;
}
}
}
cat-consumer/src/test/java/com/dianping/cat/consumer/core/DumpAnalyzerTest.java
已删除
100644 → 0
浏览文件 @
9bcee645
package
com.dianping.cat.consumer.core
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runners.JUnit4
;
import
org.unidal.lookup.ComponentTestCase
;
import
com.dianping.cat.analysis.MessageAnalyzer
;
import
com.dianping.cat.analysis.MessageAnalyzerManager
;
import
com.dianping.cat.message.Transaction
;
import
com.dianping.cat.message.internal.DefaultTransaction
;
import
com.dianping.cat.message.io.DefaultMessageQueue
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.internal.DefaultMessageTree
;
@RunWith
(
JUnit4
.
class
)
public
class
DumpAnalyzerTest
extends
ComponentTestCase
{
@Test
public
void
test
()
throws
Exception
{
MessageAnalyzerManager
manager
=
lookup
(
MessageAnalyzerManager
.
class
);
long
now
=
1334041324150L
;
int
num
=
1000000
;
DefaultMessageQueue
queue
=
new
DefaultMessageQueue
(
num
);
for
(
int
i
=
0
;
i
<
num
;
i
++)
{
queue
.
offer
(
newMessageTree
(
i
,
now
+
i
*
10L
));
}
MessageAnalyzer
analyzer
=
manager
.
getAnalyzer
(
"dump"
,
now
);
analyzer
.
analyze
(
queue
);
analyzer
.
doCheckpoint
(
true
);
}
private
MessageTree
newMessageTree
(
int
i
,
long
timestamp
)
{
MessageTree
tree
=
new
DefaultMessageTree
();
tree
.
setDomain
(
"domain"
);
tree
.
setHostName
(
"hostName"
+
i
);
tree
.
setIpAddress
(
"ipAddress"
+
i
);
tree
.
setMessageId
(
String
.
valueOf
(
i
));
tree
.
setParentMessageId
(
"parentMessageId"
+
i
);
tree
.
setRootMessageId
(
"rootMessageId"
+
i
);
tree
.
setSessionToken
(
"sessionToken"
);
tree
.
setThreadGroupName
(
"threadGroupName"
);
tree
.
setThreadId
(
"threadId"
+
i
);
tree
.
setThreadName
(
"threadName"
);
tree
.
setMessage
(
newTransaction
(
"type"
,
"name"
+
i
,
timestamp
,
"0"
,
123456
+
i
,
"data"
+
i
));
return
tree
;
}
private
Transaction
newTransaction
(
String
type
,
String
name
,
long
timestamp
,
String
status
,
int
duration
,
String
data
)
{
DefaultTransaction
transaction
=
new
DefaultTransaction
(
type
,
name
,
null
);
transaction
.
setStatus
(
status
);
transaction
.
addData
(
data
);
transaction
.
complete
();
transaction
.
setTimestamp
(
timestamp
);
transaction
.
setDurationInMillis
(
duration
);
return
transaction
;
}
}
cat-consumer/src/test/java/com/dianping/cat/consumer/dump/DumpAnalyzerTest.java
0 → 100644
浏览文件 @
53f0ff19
package
com.dianping.cat.consumer.dump
;
import
java.io.IOException
;
import
junit.framework.Assert
;
import
org.junit.Test
;
import
com.dianping.cat.consumer.MockLog
;
import
com.dianping.cat.message.Message
;
import
com.dianping.cat.message.internal.DefaultTransaction
;
import
com.dianping.cat.message.internal.MessageId
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.internal.DefaultMessageTree
;
import
com.dianping.cat.statistic.ServerStatisticManager
;
import
com.dianping.cat.storage.dump.LocalMessageBucketManager
;
public
class
DumpAnalyzerTest
{
@Test
public
void
test
()
throws
Exception
{
DumpAnalyzer
analyzer
=
new
DumpAnalyzer
();
int
size
=
1000
;
MockLocalMessageBucketManager
bucketManager
=
new
MockLocalMessageBucketManager
();
analyzer
.
setServerStateManager
(
new
ServerStatisticManager
());
analyzer
.
setBucketManager
(
bucketManager
);
analyzer
.
enableLogging
(
new
MockLog
());
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
analyzer
.
process
(
generateMessageTree
(
i
));
}
Assert
.
assertEquals
(
size
,
bucketManager
.
m_insert
);
analyzer
.
doCheckpoint
(
true
);
Thread
.
sleep
(
1000
);
Assert
.
assertEquals
(
true
,
bucketManager
.
m_archive
);
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
analyzer
.
process
(
generateOldMessageTree
());
}
Assert
.
assertEquals
(
size
,
bucketManager
.
m_insert
);
Assert
.
assertEquals
(
size
,
analyzer
.
getOldVersionDomains
().
get
(
"Cat"
).
intValue
());
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
analyzer
.
process
(
generateErrorMessageTree
());
}
Assert
.
assertEquals
(
size
,
bucketManager
.
m_insert
);
Assert
.
assertEquals
(
size
,
analyzer
.
getOldVersionDomains
().
get
(
"Cat"
).
intValue
());
Assert
.
assertEquals
(
size
,
analyzer
.
getErrorTimestampDomains
().
get
(
"Cat"
).
intValue
());
}
protected
MessageTree
generateOldMessageTree
()
{
DefaultMessageTree
tree
=
(
DefaultMessageTree
)
generateMessageTree
(
10
);
tree
.
setMessageId
(
"Cat-0a010680-1385467200000-10"
);
return
tree
;
}
protected
MessageTree
generateErrorMessageTree
()
{
DefaultMessageTree
tree
=
(
DefaultMessageTree
)
generateMessageTree
(
10
);
tree
.
setMessageId
(
"Cat-0a010680-184852-10"
);
return
tree
;
}
protected
MessageTree
generateMessageTree
(
int
i
)
{
MessageTree
tree
=
new
DefaultMessageTree
();
tree
.
setDomain
(
"Cat"
);
tree
.
setHostName
(
"group001"
);
tree
.
setIpAddress
(
"192.168.1.1"
);
DefaultTransaction
t
=
new
DefaultTransaction
(
"A"
,
"n"
+
i
%
2
,
null
);
DefaultTransaction
t2
=
new
DefaultTransaction
(
"A-1"
,
"n"
+
i
%
3
,
null
);
if
(
i
%
2
==
0
)
{
t2
.
setStatus
(
"ERROR"
);
}
else
{
t2
.
setStatus
(
Message
.
SUCCESS
);
}
t2
.
complete
();
t2
.
setDurationInMillis
(
i
);
t
.
addChild
(
t2
);
if
(
i
%
2
==
0
)
{
t
.
setStatus
(
"ERROR"
);
}
else
{
t
.
setStatus
(
Message
.
SUCCESS
);
}
t
.
complete
();
t
.
setDurationInMillis
(
i
*
2
);
long
timestamp
=
1385467200000L
;
t
.
setTimestamp
(
timestamp
+
1000
);
t2
.
setTimestamp
(
timestamp
+
2000
);
tree
.
setMessage
(
t
);
tree
.
setMessageId
(
"Cat-0a010680-384852-"
+
i
);
return
tree
;
}
public
static
class
MockLocalMessageBucketManager
extends
LocalMessageBucketManager
{
protected
boolean
m_archive
=
false
;
protected
int
m_insert
=
0
;
@Override
public
MessageTree
loadMessage
(
String
messageId
)
throws
IOException
{
return
new
DefaultMessageTree
();
}
@Override
public
void
storeMessage
(
MessageTree
tree
,
MessageId
id
)
throws
IOException
{
m_insert
++;
}
@Override
public
void
archive
(
long
startTime
)
{
m_archive
=
true
;
}
}
}
cat-consumer/src/test/java/com/dianping/cat/consumer/problem/AggregationConfigManagerTest.java
0 → 100644
浏览文件 @
53f0ff19
package
com.dianping.cat.consumer.problem
;
import
java.util.List
;
import
junit.framework.Assert
;
import
org.junit.Test
;
import
org.unidal.dal.jdbc.DalException
;
import
org.unidal.dal.jdbc.DalNotFoundException
;
import
org.unidal.dal.jdbc.Readset
;
import
org.unidal.dal.jdbc.Updateset
;
import
com.dianping.cat.consumer.aggreation.model.entity.Aggregation
;
import
com.dianping.cat.consumer.aggreation.model.entity.AggregationRule
;
import
com.dianping.cat.consumer.problem.aggregation.AggregationConfigManager
;
import
com.dianping.cat.consumer.problem.aggregation.AggregationHandler
;
import
com.dianping.cat.core.config.Config
;
import
com.dianping.cat.core.config.ConfigDao
;
public
class
AggregationConfigManagerTest
{
private
static
int
s_storeCount
;
@Test
public
void
test
()
{
AggregationConfigManager
manager
=
new
MockAggregationConfigManager
();
((
MockAggregationConfigManager
)
manager
).
setAggregationHandler
(
new
MockAggregationHandler
());
((
MockAggregationConfigManager
)
manager
).
setConfigDao
(
new
MockConfigDao1
());
manager
.
initialize
();
manager
.
deleteAggregationRule
(
"rule"
);
Assert
.
assertEquals
(
1
,
s_storeCount
);
AggregationRule
rule
=
new
AggregationRule
();
rule
.
setDomain
(
"domain1"
);
rule
.
setPattern
(
"domain1"
);
manager
.
insertAggregationRule
(
rule
);
Assert
.
assertEquals
(
2
,
s_storeCount
);
AggregationRule
rule2
=
new
AggregationRule
();
rule2
.
setDomain
(
"domain2"
);
rule2
.
setPattern
(
"domain2"
);
manager
.
insertAggregationRule
(
rule2
);
Assert
.
assertEquals
(
3
,
s_storeCount
);
List
<
AggregationRule
>
rules
=
manager
.
queryAggrarationRules
();
Assert
.
assertEquals
(
3
,
rules
.
size
());
List
<
AggregationRule
>
dbRules
=
manager
.
queryAggrarationRulesFromDB
();
Assert
.
assertEquals
(
1
,
dbRules
.
size
());
AggregationRule
aggration
=
manager
.
queryAggration
(
"domain"
);
Assert
.
assertEquals
(
true
,
aggration
!=
null
);
}
@Test
public
void
testInitThrowException
()
{
MockAggregationConfigManager
manager
=
new
MockAggregationConfigManager
();
manager
.
setAggregationHandler
(
new
MockAggregationHandler
());
manager
.
setConfigDao
(
new
MockConfigDao2
());
manager
.
initialize
();
List
<
AggregationRule
>
rules
=
manager
.
queryAggrarationRules
();
Assert
.
assertEquals
(
0
,
rules
.
size
());
}
public
static
class
MockAggregationConfigManager
extends
AggregationConfigManager
{
protected
void
setConfigDao
(
ConfigDao
configDao
)
{
m_configDao
=
configDao
;
}
protected
void
setAggregationHandler
(
AggregationHandler
handler
)
{
m_handler
=
handler
;
}
}
public
static
class
MockConfigDao2
extends
MockConfigDao1
{
@Override
public
Config
findByName
(
String
name
,
Readset
<
Config
>
readset
)
throws
DalNotFoundException
{
throw
new
DalNotFoundException
(
"this is test exception, please ignore it!"
);
}
}
public
static
class
MockConfigDao1
extends
ConfigDao
{
@Override
public
Config
createLocal
()
{
return
super
.
createLocal
();
}
@Override
public
int
deleteByPK
(
Config
proto
)
throws
DalException
{
return
1
;
}
@Override
public
Config
findByPK
(
int
keyId
,
Readset
<
Config
>
readset
)
throws
DalException
{
Config
config
=
new
Config
();
config
.
setId
(
keyId
);
config
.
setContent
(
new
Aggregation
().
toString
());
return
config
;
}
@Override
public
Config
findByName
(
String
name
,
Readset
<
Config
>
readset
)
throws
DalException
{
Config
config
=
new
Config
();
config
.
setName
(
name
);
Aggregation
aggregation
=
new
Aggregation
();
AggregationRule
rule
=
new
AggregationRule
();
rule
.
setDomain
(
"domain"
);
rule
.
setType
(
1
);
rule
.
setPattern
(
"domain"
);
aggregation
.
addAggregationRule
(
rule
);
config
.
setContent
(
aggregation
.
toString
());
return
config
;
}
@Override
public
int
insert
(
Config
proto
)
throws
DalException
{
return
1
;
}
@Override
public
int
updateByPK
(
Config
proto
,
Updateset
<
Config
>
updateset
)
throws
DalException
{
s_storeCount
++;
return
1
;
}
}
public
static
class
MockAggregationHandler
implements
AggregationHandler
{
@Override
public
void
register
(
List
<
AggregationRule
>
rules
)
{
}
@Override
public
String
handle
(
int
type
,
String
domain
,
String
input
)
{
return
null
;
}
}
}
cat-consumer/src/test/java/com/dianping/cat/consumer/problem/ProblemAnalyzerTest.java
浏览文件 @
53f0ff19
...
...
@@ -13,6 +13,11 @@ import org.unidal.lookup.ComponentTestCase;
import
com.dianping.cat.Constants
;
import
com.dianping.cat.analysis.MessageAnalyzer
;
import
com.dianping.cat.consumer.problem.model.entity.ProblemReport
;
import
com.dianping.cat.message.Event
;
import
com.dianping.cat.message.Heartbeat
;
import
com.dianping.cat.message.Transaction
;
import
com.dianping.cat.message.internal.DefaultEvent
;
import
com.dianping.cat.message.internal.DefaultHeartbeat
;
import
com.dianping.cat.message.internal.DefaultTransaction
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.internal.DefaultMessageTree
;
...
...
@@ -28,10 +33,8 @@ public class ProblemAnalyzerTest extends ComponentTestCase {
@Before
public
void
setUp
()
throws
Exception
{
super
.
setUp
();
long
currentTimeMillis
=
System
.
currentTimeMillis
();
m_timestamp
=
currentTimeMillis
-
currentTimeMillis
%
(
3600
*
1000
);
m_timestamp
=
1385470800000L
;
m_analyzer
=
(
ProblemAnalyzer
)
lookup
(
MessageAnalyzer
.
class
,
ProblemAnalyzer
.
ID
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyyMMdd HH:mm"
);
Date
date
=
sdf
.
parse
(
"20120101 00:00"
);
...
...
@@ -55,46 +58,67 @@ public class ProblemAnalyzerTest extends ComponentTestCase {
protected
MessageTree
generateMessageTree
(
int
i
)
{
MessageTree
tree
=
new
DefaultMessageTree
();
tree
.
setMessageId
(
""
+
i
);
tree
.
setDomain
(
m_domain
);
tree
.
setHostName
(
"group001"
);
tree
.
setIpAddress
(
"192.168.1.1"
);
tree
.
setThreadGroupName
(
"Cat"
);
tree
.
setThreadName
(
"Cat-ProblemAnalyzer-Test"
);
DefaultTransaction
t
=
new
DefaultTransaction
(
"A"
,
"n"
+
i
%
2
,
null
);
t
.
setTimestamp
(
m_timestamp
);
t
.
setDurationInMillis
(
i
*
50
);
switch
(
i
%
7
)
{
case
0
:
t
.
setType
(
"URL"
);
break
;
case
1
:
t
.
setType
(
"Call"
);
break
;
case
2
:
t
.
setType
(
"Cache."
);
t
.
setDurationInMillis
(
i
*
5
);
break
;
case
3
:
t
.
setType
(
"SQL"
);
break
;
case
4
:
t
.
setType
(
"PigeonCall"
);
break
;
case
5
:
t
.
setType
(
"Service"
);
break
;
case
6
:
t
.
setType
(
"PigeonService"
);
break
;
if
(
i
<
10
)
{
DefaultEvent
error
=
new
DefaultEvent
(
"Error"
,
"Error"
,
null
);
error
.
setTimestamp
(
m_timestamp
);
tree
.
setMessage
(
error
);
}
else
if
(
i
<
20
)
{
DefaultHeartbeat
heartbeat
=
new
DefaultHeartbeat
(
"heartbeat"
,
"heartbeat"
);
heartbeat
.
setTimestamp
(
m_timestamp
);
tree
.
setMessage
(
heartbeat
);
}
else
{
DefaultTransaction
t
=
new
DefaultTransaction
(
"A"
,
"n"
+
i
%
2
,
null
);
t
.
setTimestamp
(
m_timestamp
);
t
.
setDurationInMillis
(
i
*
50
);
switch
(
i
%
7
)
{
case
0
:
t
.
setType
(
"URL"
);
break
;
case
1
:
t
.
setType
(
"Call"
);
break
;
case
2
:
t
.
setType
(
"Cache."
);
t
.
setDurationInMillis
(
i
*
5
);
break
;
case
3
:
t
.
setType
(
"SQL"
);
break
;
case
4
:
t
.
setType
(
"PigeonCall"
);
break
;
case
5
:
t
.
setType
(
"Service"
);
break
;
case
6
:
t
.
setType
(
"PigeonService"
);
break
;
}
Event
error
=
new
DefaultEvent
(
"Error"
,
"Error"
,
null
);
Event
exception
=
new
DefaultEvent
(
"Other"
,
"Exception"
,
null
);
Heartbeat
heartbeat
=
new
DefaultHeartbeat
(
"heartbeat"
,
"heartbeat"
);
DefaultTransaction
transaction
=
new
DefaultTransaction
(
"Transaction"
,
"Transaction"
,
null
);
transaction
.
setStatus
(
Transaction
.
SUCCESS
);
t
.
addChild
(
transaction
);
t
.
addChild
(
error
);
t
.
addChild
(
exception
);
t
.
addChild
(
heartbeat
);
tree
.
setMessage
(
t
);
}
tree
.
setMessage
(
t
);
return
tree
;
}
...
...
cat-consumer/src/test/java/com/dianping/cat/consumer/state/StateAnalyzerTest.java
浏览文件 @
53f0ff19
...
...
@@ -36,7 +36,6 @@ public class StateAnalyzerTest extends ComponentTestCase {
@Test
public
void
testProcess
()
throws
Exception
{
StateReport
report
=
m_analyzer
.
getReport
(
m_domain
);
String
expected
=
Files
.
forIO
().
readFrom
(
getClass
().
getResourceAsStream
(
"state_analyzer.xml"
),
"utf-8"
);
...
...
cat-consumer/src/test/resources/com/dianping/cat/consumer/problem/problem_analyzer.xml
浏览文件 @
53f0ff19
此差异已折叠。
点击以展开。
cat-core/src/main/java/com/dianping/cat/storage/DefaultBucketManager.java
浏览文件 @
53f0ff19
...
...
@@ -37,41 +37,4 @@ public class DefaultBucketManager extends ContainerHolder implements BucketManag
return
getBucket
(
String
.
class
,
timestamp
,
name
,
"report"
);
}
public
static
class
Entry
{
private
String
m_namespace
;
private
String
m_path
;
private
Class
<?>
m_type
;
public
Entry
(
Class
<?>
type
,
String
path
,
String
namespace
)
{
m_type
=
type
;
m_path
=
path
;
m_namespace
=
namespace
;
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
obj
instanceof
Entry
)
{
Entry
e
=
(
Entry
)
obj
;
return
e
.
m_type
==
m_type
&&
e
.
m_path
.
equals
(
m_path
)
&&
e
.
m_namespace
.
equals
(
m_namespace
);
}
return
false
;
}
@Override
public
int
hashCode
()
{
int
hashcode
=
m_type
.
hashCode
();
hashcode
=
hashcode
*
31
+
m_path
.
hashCode
();
return
hashcode
;
}
@Override
public
String
toString
()
{
return
String
.
format
(
"Entry[type=%s,path=%s]"
,
m_type
,
m_path
);
}
}
}
cat-home/src/main/java/com/dianping/cat/build/ABTestComponentConfigurator.java
浏览文件 @
53f0ff19
...
...
@@ -6,7 +6,7 @@ import java.util.List;
import
org.unidal.lookup.configuration.AbstractResourceConfigurator
;
import
org.unidal.lookup.configuration.Component
;
import
com.dianping.cat.consumer.
advanced
.MetricConfigManager
;
import
com.dianping.cat.consumer.
metric
.MetricConfigManager
;
import
com.dianping.cat.core.dal.ProjectDao
;
import
com.dianping.cat.home.dal.abtest.AbtestDao
;
import
com.dianping.cat.home.dal.abtest.AbtestReportDao
;
...
...
cat-home/src/main/java/com/dianping/cat/build/CatDatabaseConfigurator.java
浏览文件 @
53f0ff19
...
...
@@ -11,9 +11,6 @@ final class CatDatabaseConfigurator extends AbstractJdbcResourceConfigurator {
public
List
<
Component
>
defineComponents
()
{
List
<
Component
>
all
=
new
ArrayList
<
Component
>();
all
.
add
(
defineJdbcDataSourceComponent
(
"cat"
,
"com.mysql.jdbc.Driver"
,
"jdbc:mysql://127.0.0.1:3306/cat"
,
"root"
,
"password"
,
"<![CDATA[useUnicode=true&autoReconnect=true]]>"
));
defineSimpleTableProviderComponents
(
all
,
"cat"
,
com
.
dianping
.
cat
.
home
.
dal
.
report
.
_INDEX
.
getEntityClasses
());
defineDaoComponents
(
all
,
com
.
dianping
.
cat
.
home
.
dal
.
report
.
_INDEX
.
getDaoClasses
());
...
...
cat-home/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
浏览文件 @
53f0ff19
...
...
@@ -12,9 +12,9 @@ import org.unidal.lookup.configuration.Component;
import
com.dianping.cat.CatHomeModule
;
import
com.dianping.cat.ServerConfigManager
;
import
com.dianping.cat.consumer.advanced.MetricConfigManager
;
import
com.dianping.cat.consumer.advanced.ProductLineConfigManager
;
import
com.dianping.cat.consumer.dependency.DependencyAnalyzer
;
import
com.dianping.cat.consumer.metric.MetricConfigManager
;
import
com.dianping.cat.consumer.metric.ProductLineConfigManager
;
import
com.dianping.cat.core.config.ConfigDao
;
import
com.dianping.cat.core.dal.ProjectDao
;
import
com.dianping.cat.home.dal.report.EventDao
;
...
...
cat-home/src/main/java/com/dianping/cat/build/TaskComponentConfigurator.java
浏览文件 @
53f0ff19
...
...
@@ -8,8 +8,8 @@ import org.unidal.lookup.configuration.Component;
import
com.dianping.cat.DomainManager
;
import
com.dianping.cat.ServerConfigManager
;
import
com.dianping.cat.consumer.
advanced
.MetricConfigManager
;
import
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
;
import
com.dianping.cat.consumer.
metric
.MetricConfigManager
;
import
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
;
import
com.dianping.cat.core.dal.DailyGraphDao
;
import
com.dianping.cat.core.dal.GraphDao
;
import
com.dianping.cat.core.dal.TaskDao
;
...
...
cat-home/src/main/java/com/dianping/cat/build/UserDatabaseConfigurator.java
浏览文件 @
53f0ff19
...
...
@@ -11,9 +11,6 @@ final class UserDatabaseConfigurator extends AbstractJdbcResourceConfigurator {
public
List
<
Component
>
defineComponents
()
{
List
<
Component
>
all
=
new
ArrayList
<
Component
>();
all
.
add
(
defineJdbcDataSourceComponent
(
"user"
,
"com.mysql.jdbc.Driver"
,
"jdbc:mysql://192.168.8.44:3306/hawk"
,
"hawk"
,
"hawk"
,
"<![CDATA[useUnicode=true&autoReconnect=true]]>"
));
defineSimpleTableProviderComponents
(
all
,
"user"
,
com
.
dianping
.
cat
.
home
.
dal
.
user
.
_INDEX
.
getEntityClasses
());
defineDaoComponents
(
all
,
com
.
dianping
.
cat
.
home
.
dal
.
user
.
_INDEX
.
getDaoClasses
());
...
...
cat-home/src/main/java/com/dianping/cat/report/page/dependency/Handler.java
浏览文件 @
53f0ff19
...
...
@@ -18,7 +18,6 @@ import org.unidal.web.mvc.annotation.InboundActionMeta;
import
org.unidal.web.mvc.annotation.OutboundActionMeta
;
import
org.unidal.web.mvc.annotation.PayloadMeta
;
import
com.dianping.cat.consumer.advanced.ProductLineConfigManager
;
import
com.dianping.cat.consumer.company.model.entity.ProductLine
;
import
com.dianping.cat.consumer.dependency.DependencyAnalyzer
;
import
com.dianping.cat.consumer.dependency.DependencyReportMerger
;
...
...
@@ -26,6 +25,7 @@ import com.dianping.cat.consumer.dependency.model.entity.Dependency;
import
com.dianping.cat.consumer.dependency.model.entity.DependencyReport
;
import
com.dianping.cat.consumer.dependency.model.entity.Index
;
import
com.dianping.cat.consumer.dependency.model.entity.Segment
;
import
com.dianping.cat.consumer.metric.ProductLineConfigManager
;
import
com.dianping.cat.helper.TimeUtil
;
import
com.dianping.cat.home.dal.report.Event
;
import
com.dianping.cat.home.dependency.graph.entity.TopologyEdge
;
...
...
cat-home/src/main/java/com/dianping/cat/report/page/dependency/graph/TopologyGraphManager.java
浏览文件 @
53f0ff19
...
...
@@ -21,11 +21,11 @@ import org.unidal.lookup.annotation.Inject;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.ServerConfigManager
;
import
com.dianping.cat.consumer.advanced.ProductLineConfigManager
;
import
com.dianping.cat.consumer.company.model.entity.Domain
;
import
com.dianping.cat.consumer.company.model.entity.ProductLine
;
import
com.dianping.cat.consumer.dependency.DependencyAnalyzer
;
import
com.dianping.cat.consumer.dependency.model.entity.DependencyReport
;
import
com.dianping.cat.consumer.metric.ProductLineConfigManager
;
import
com.dianping.cat.helper.TimeUtil
;
import
com.dianping.cat.home.dal.report.TopologyGraphDao
;
import
com.dianping.cat.home.dal.report.TopologyGraphEntity
;
...
...
cat-home/src/main/java/com/dianping/cat/report/page/metric/Handler.java
浏览文件 @
53f0ff19
...
...
@@ -13,7 +13,7 @@ import org.unidal.web.mvc.annotation.InboundActionMeta;
import
org.unidal.web.mvc.annotation.OutboundActionMeta
;
import
org.unidal.web.mvc.annotation.PayloadMeta
;
import
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
;
import
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
;
import
com.dianping.cat.helper.TimeUtil
;
import
com.dianping.cat.report.ReportPage
;
import
com.dianping.cat.report.page.LineChart
;
...
...
cat-home/src/main/java/com/dianping/cat/report/page/metric/Model.java
浏览文件 @
53f0ff19
...
...
@@ -9,8 +9,8 @@ import java.util.Map;
import
org.unidal.web.mvc.view.annotation.EntityMeta
;
import
org.unidal.web.mvc.view.annotation.ModelMeta
;
import
com.dianping.cat.consumer.advanced.MetricAnalyzer
;
import
com.dianping.cat.consumer.company.model.entity.ProductLine
;
import
com.dianping.cat.consumer.metric.MetricAnalyzer
;
import
com.dianping.cat.home.dal.abtest.Abtest
;
import
com.dianping.cat.report.page.AbstractReportModel
;
import
com.dianping.cat.report.page.LineChart
;
...
...
cat-home/src/main/java/com/dianping/cat/report/page/metric/chart/GraphCreator.java
浏览文件 @
53f0ff19
...
...
@@ -12,10 +12,10 @@ import java.util.Map.Entry;
import
org.unidal.lookup.annotation.Inject
;
import
com.dianping.cat.advanced.metric.config.entity.MetricItemConfig
;
import
com.dianping.cat.consumer.advanced.MetricAnalyzer
;
import
com.dianping.cat.consumer.advanced.MetricConfigManager
;
import
com.dianping.cat.consumer.advanced.ProductLineConfigManager
;
import
com.dianping.cat.consumer.company.model.entity.ProductLine
;
import
com.dianping.cat.consumer.metric.MetricAnalyzer
;
import
com.dianping.cat.consumer.metric.MetricConfigManager
;
import
com.dianping.cat.consumer.metric.ProductLineConfigManager
;
import
com.dianping.cat.consumer.metric.model.entity.MetricReport
;
import
com.dianping.cat.helper.Chinese
;
import
com.dianping.cat.helper.TimeUtil
;
...
...
cat-home/src/main/java/com/dianping/cat/report/service/impl/MetricReportService.java
浏览文件 @
53f0ff19
...
...
@@ -6,10 +6,10 @@ import java.util.List;
import
org.unidal.lookup.annotation.Inject
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.consumer.advanced.MetricAnalyzer
;
import
com.dianping.cat.consumer.advanced.dal.BusinessReport
;
import
com.dianping.cat.consumer.advanced.dal.BusinessReportDao
;
import
com.dianping.cat.consumer.advanced.dal.BusinessReportEntity
;
import
com.dianping.cat.consumer.metric.MetricAnalyzer
;
import
com.dianping.cat.consumer.metric.model.entity.MetricReport
;
import
com.dianping.cat.consumer.metric.model.transform.DefaultNativeParser
;
import
com.dianping.cat.message.Event
;
...
...
cat-home/src/main/java/com/dianping/cat/report/task/abtest/ABTestReportBuilder.java
浏览文件 @
53f0ff19
...
...
@@ -13,7 +13,7 @@ import org.unidal.dal.jdbc.DalException;
import
org.unidal.lookup.annotation.Inject
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
;
import
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
;
import
com.dianping.cat.consumer.metric.model.entity.MetricReport
;
import
com.dianping.cat.helper.TimeUtil
;
import
com.dianping.cat.home.dal.abtest.AbtestReportDao
;
...
...
cat-home/src/main/java/com/dianping/cat/report/task/metric/MetricAlert.java
浏览文件 @
53f0ff19
...
...
@@ -14,8 +14,8 @@ import org.unidal.lookup.annotation.Inject;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.ServerConfigManager
;
import
com.dianping.cat.advanced.metric.config.entity.MetricItemConfig
;
import
com.dianping.cat.consumer.
advanced
.MetricConfigManager
;
import
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
;
import
com.dianping.cat.consumer.
metric
.MetricConfigManager
;
import
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
;
import
com.dianping.cat.consumer.metric.model.entity.MetricItem
;
import
com.dianping.cat.consumer.metric.model.entity.MetricReport
;
import
com.dianping.cat.helper.TimeUtil
;
...
...
cat-home/src/main/java/com/dianping/cat/report/task/metric/MetricBaselineReportBuilder.java
浏览文件 @
53f0ff19
...
...
@@ -13,8 +13,8 @@ import org.unidal.lookup.annotation.Inject;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.advanced.metric.config.entity.MetricItemConfig
;
import
com.dianping.cat.consumer.
advanced
.MetricConfigManager
;
import
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
;
import
com.dianping.cat.consumer.
metric
.MetricConfigManager
;
import
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
;
import
com.dianping.cat.consumer.metric.model.entity.MetricItem
;
import
com.dianping.cat.consumer.metric.model.entity.MetricReport
;
import
com.dianping.cat.helper.TimeUtil
;
...
...
cat-home/src/main/java/com/dianping/cat/report/task/spi/ReportFacade.java
浏览文件 @
53f0ff19
...
...
@@ -13,12 +13,12 @@ import org.unidal.lookup.annotation.Inject;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.Constants
;
import
com.dianping.cat.ReportType
;
import
com.dianping.cat.consumer.advanced.MetricAnalyzer
;
import
com.dianping.cat.consumer.cross.CrossAnalyzer
;
import
com.dianping.cat.consumer.dependency.DependencyAnalyzer
;
import
com.dianping.cat.consumer.event.EventAnalyzer
;
import
com.dianping.cat.consumer.heartbeat.HeartbeatAnalyzer
;
import
com.dianping.cat.consumer.matrix.MatrixAnalyzer
;
import
com.dianping.cat.consumer.metric.MetricAnalyzer
;
import
com.dianping.cat.consumer.problem.ProblemAnalyzer
;
import
com.dianping.cat.consumer.sql.SqlAnalyzer
;
import
com.dianping.cat.consumer.state.StateAnalyzer
;
...
...
cat-home/src/main/java/com/dianping/cat/system/config/ConfigReloadTask.java
浏览文件 @
53f0ff19
...
...
@@ -4,8 +4,8 @@ import org.unidal.helper.Threads.Task;
import
org.unidal.lookup.annotation.Inject
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.consumer.
advanced
.MetricConfigManager
;
import
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
;
import
com.dianping.cat.consumer.
metric
.MetricConfigManager
;
import
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
;
public
class
ConfigReloadTask
implements
Task
{
...
...
cat-home/src/main/java/com/dianping/cat/system/page/abtest/ReportHandler.java
浏览文件 @
53f0ff19
...
...
@@ -20,7 +20,7 @@ import org.unidal.lookup.annotation.Inject;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.advanced.metric.config.entity.MetricItemConfig
;
import
com.dianping.cat.consumer.
advanced
.MetricConfigManager
;
import
com.dianping.cat.consumer.
metric
.MetricConfigManager
;
import
com.dianping.cat.home.dal.abtest.Abtest
;
import
com.dianping.cat.home.dal.abtest.AbtestDao
;
import
com.dianping.cat.home.dal.abtest.AbtestEntity
;
...
...
cat-home/src/main/java/com/dianping/cat/system/page/config/Handler.java
浏览文件 @
53f0ff19
...
...
@@ -24,10 +24,10 @@ import org.unidal.web.mvc.annotation.PayloadMeta;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.Constants
;
import
com.dianping.cat.advanced.metric.config.entity.MetricItemConfig
;
import
com.dianping.cat.consumer.advanced.MetricConfigManager
;
import
com.dianping.cat.consumer.advanced.ProductLineConfigManager
;
import
com.dianping.cat.consumer.aggreation.model.entity.AggregationRule
;
import
com.dianping.cat.consumer.company.model.entity.ProductLine
;
import
com.dianping.cat.consumer.metric.MetricConfigManager
;
import
com.dianping.cat.consumer.metric.ProductLineConfigManager
;
import
com.dianping.cat.consumer.problem.aggregation.AggregationConfigManager
;
import
com.dianping.cat.core.dal.Project
;
import
com.dianping.cat.core.dal.ProjectDao
;
...
...
cat-home/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
53f0ff19
...
...
@@ -130,7 +130,7 @@
<role>
com.dianping.cat.ServerConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.home.dal.report.TopologyGraphDao
</role>
...
...
@@ -149,10 +149,10 @@
<implementation>
com.dianping.cat.system.config.ConfigReloadTask
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.MetricConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.MetricConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
</role>
</requirement>
</requirements>
</component>
...
...
@@ -194,10 +194,10 @@
<role>
com.dianping.cat.report.baseline.BaselineService
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.MetricConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.MetricConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
</role>
</requirement>
</requirements>
</component>
...
...
@@ -730,10 +730,10 @@
<role>
com.dianping.cat.report.task.metric.MetricPointParser
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.MetricConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.MetricConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.report.baseline.BaselineCreator
</role>
...
...
@@ -760,10 +760,10 @@
<role>
com.dianping.cat.report.task.metric.MetricPointParser
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.MetricConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.MetricConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.report.baseline.BaselineService
</role>
...
...
@@ -971,7 +971,7 @@
<role>
com.dianping.cat.home.dal.abtest.AbtestReportDao
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.system.page.abtest.service.ABTestService
</role>
...
...
@@ -1575,30 +1575,6 @@
<datasourceFile>
/data/appdatas/cat/datasources.xml
</datasourceFile>
</configuration>
</component>
<component>
<role>
org.unidal.dal.jdbc.datasource.DataSource
</role>
<role-hint>
cat
</role-hint>
<implementation>
org.unidal.dal.jdbc.datasource.JdbcDataSource
</implementation>
<configuration>
<id>
cat
</id>
<maximum-pool-size>
3
</maximum-pool-size>
<connection-timeout>
1s
</connection-timeout>
<idle-timeout>
10m
</idle-timeout>
<statement-cache-size>
1000
</statement-cache-size>
<properties>
<driver>
com.mysql.jdbc.Driver
</driver>
<url>
jdbc:mysql://127.0.0.1:3306/cat
</url>
<user>
root
</user>
<password>
password
</password>
<connectionProperties>
<![CDATA[useUnicode=true&autoReconnect=true]]>
</connectionProperties>
</properties>
</configuration>
<requirements>
<requirement>
<role>
org.unidal.dal.jdbc.datasource.JdbcDataSourceDescriptorManager
</role>
</requirement>
</requirements>
</component>
<component>
<role>
org.unidal.dal.jdbc.mapping.TableProvider
</role>
<role-hint>
baseline
</role-hint>
...
...
@@ -1865,30 +1841,6 @@
</requirement>
</requirements>
</component>
<component>
<role>
org.unidal.dal.jdbc.datasource.DataSource
</role>
<role-hint>
user
</role-hint>
<implementation>
org.unidal.dal.jdbc.datasource.JdbcDataSource
</implementation>
<configuration>
<id>
user
</id>
<maximum-pool-size>
3
</maximum-pool-size>
<connection-timeout>
1s
</connection-timeout>
<idle-timeout>
10m
</idle-timeout>
<statement-cache-size>
1000
</statement-cache-size>
<properties>
<driver>
com.mysql.jdbc.Driver
</driver>
<url>
jdbc:mysql://192.168.8.44:3306/hawk
</url>
<user>
hawk
</user>
<password>
hawk
</password>
<connectionProperties>
<![CDATA[useUnicode=true&autoReconnect=true]]>
</connectionProperties>
</properties>
</configuration>
<requirements>
<requirement>
<role>
org.unidal.dal.jdbc.datasource.JdbcDataSourceDescriptorManager
</role>
</requirement>
</requirements>
</component>
<component>
<role>
org.unidal.dal.jdbc.mapping.TableProvider
</role>
<role-hint>
dp-admin-login
</role-hint>
...
...
@@ -1949,7 +1901,7 @@
<role>
com.dianping.cat.home.dal.abtest.AbtestReportDao
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.MetricConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.MetricConfigManager
</role>
</requirement>
</requirements>
</component>
...
...
@@ -2849,7 +2801,7 @@
<role>
com.dianping.cat.report.page.PayloadNormalizer
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.report.page.metric.chart.GraphCreator
</role>
...
...
@@ -2866,8 +2818,8 @@
</requirements>
</component>
<component>
<role>
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
</role>
<implementation>
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
</implementation>
<role>
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
</role>
<implementation>
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.core.config.ConfigDao
</role>
...
...
@@ -2891,16 +2843,16 @@
<role>
com.dianping.cat.report.page.metric.chart.CachedMetricReportService
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.MetricConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.MetricConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.consumer.
advanced
.MetricConfigManager
</role>
<implementation>
com.dianping.cat.consumer.
advanced
.MetricConfigManager
</implementation>
<role>
com.dianping.cat.consumer.
metric
.MetricConfigManager
</role>
<implementation>
com.dianping.cat.consumer.
metric
.MetricConfigManager
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.core.config.ConfigDao
</role>
...
...
@@ -2938,7 +2890,7 @@
<role>
com.dianping.cat.report.page.dependency.graph.TopologyGraphManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.report.page.dependency.ExternalInfoBuilder
</role>
...
...
@@ -2964,7 +2916,7 @@
<role>
com.dianping.cat.report.page.dependency.graph.TopologyGraphBuilder
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.ServerConfigManager
</role>
...
...
@@ -3296,13 +3248,13 @@
<role>
com.dianping.cat.report.page.dependency.graph.TopologyGraphConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.ProductLineConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.ProductLineConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.problem.aggregation.AggregationConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.MetricConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.MetricConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.system.config.ExceptionThresholdConfigManager
</role>
...
...
@@ -3441,7 +3393,7 @@
<role>
com.dianping.cat.home.dal.abtest.AbtestReportDao
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.
advanced
.MetricConfigManager
</role>
<role>
com.dianping.cat.consumer.
metric
.MetricConfigManager
</role>
</requirement>
</requirements>
</component>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录