Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
1a864c3c
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,发现更多精彩内容 >>
提交
1a864c3c
编写于
7月 16, 2014
作者:
曾
曾伟伟
浏览文件
操作
浏览文件
下载
差异文件
app data collect
上级
850e29bf
251c82cf
变更
27
展开全部
隐藏空白更改
内联
并排
Showing
27 changed file
with
1272 addition
and
927 deletion
+1272
-927
README.md
README.md
+1
-2
cat-broker/src/main/java/com/dianping/cat/broker/api/app/AppDataConsumer.java
...java/com/dianping/cat/broker/api/app/AppDataConsumer.java
+12
-7
cat-broker/src/main/java/com/dianping/cat/broker/api/app/BucketHandler.java
...n/java/com/dianping/cat/broker/api/app/BucketHandler.java
+69
-63
cat-broker/src/main/java/com/dianping/cat/broker/api/page/IpService.java
...main/java/com/dianping/cat/broker/api/page/IpService.java
+0
-24
cat-broker/src/main/java/com/dianping/cat/broker/api/page/batch/Handler.java
.../java/com/dianping/cat/broker/api/page/batch/Handler.java
+25
-4
cat-broker/src/main/java/com/dianping/cat/broker/build/ComponentsConfigurator.java
...com/dianping/cat/broker/build/ComponentsConfigurator.java
+11
-0
cat-broker/src/main/resources/META-INF/dal/model/appData-codegen.xml
...src/main/resources/META-INF/dal/model/appData-codegen.xml
+1
-1
cat-broker/src/main/resources/META-INF/plexus/components.xml
cat-broker/src/main/resources/META-INF/plexus/components.xml
+75
-22
cat-broker/src/test/java/com/dianping/cat/broker/AppTest.java
...broker/src/test/java/com/dianping/cat/broker/AppTest.java
+51
-0
cat-core/pom.xml
cat-core/pom.xml
+1
-1
cat-core/src/main/java/com/dianping/cat/build/AppDatabaseConfigurator.java
.../java/com/dianping/cat/build/AppDatabaseConfigurator.java
+2
-2
cat-core/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
...n/java/com/dianping/cat/build/ComponentsConfigurator.java
+6
-1
cat-core/src/main/java/com/dianping/cat/config/app/AppDataCommandTableProvider.java
.../dianping/cat/config/app/AppDataCommandTableProvider.java
+42
-0
cat-core/src/main/java/com/dianping/cat/config/app/AppDataService.java
...main/java/com/dianping/cat/config/app/AppDataService.java
+61
-6
cat-core/src/main/resources/META-INF/dal/jdbc/app-codegen.xml
...core/src/main/resources/META-INF/dal/jdbc/app-codegen.xml
+4
-4
cat-core/src/main/resources/META-INF/dal/jdbc/app-dal.xml
cat-core/src/main/resources/META-INF/dal/jdbc/app-dal.xml
+104
-2
cat-core/src/main/resources/META-INF/plexus/components.xml
cat-core/src/main/resources/META-INF/plexus/components.xml
+9
-0
cat-core/src/main/resources/META-INF/wizard/jdbc/wizard.xml
cat-core/src/main/resources/META-INF/wizard/jdbc/wizard.xml
+1
-1
cat-home/pom.xml
cat-home/pom.xml
+0
-5
cat-home/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
...n/java/com/dianping/cat/build/ComponentsConfigurator.java
+103
-89
cat-home/src/main/java/com/dianping/cat/report/view/NavigationBar.java
...main/java/com/dianping/cat/report/view/NavigationBar.java
+2
-0
cat-home/src/main/resources/META-INF/plexus/components.xml
cat-home/src/main/resources/META-INF/plexus/components.xml
+326
-302
cat-home/src/test/java/com/dianping/cat/report/analyzer/TopologyGraphTest.java
...a/com/dianping/cat/report/analyzer/TopologyGraphTest.java
+35
-16
cat-maven-plugin/src/main/java/com/dianping/cat/plugin/InstallMojo.java
...in/src/main/java/com/dianping/cat/plugin/InstallMojo.java
+1
-1
cat-maven-plugin/src/main/resources/com/dianping/cat/plugin/Cat.sql
...plugin/src/main/resources/com/dianping/cat/plugin/Cat.sql
+101
-138
pom.xml
pom.xml
+221
-220
script/Cat.sql
script/Cat.sql
+8
-16
未找到文件。
README.md
浏览文件 @
1a864c3c
...
...
@@ -28,7 +28,6 @@ CAT监控系统将每次URL、Service的请求内部执行情况都封装为一
![
Alt text
](
https://raw.github.com/dianping/cat/master/cat-home/src/main/webapp/images/logviewAll03.png
)
Requirements
---------------------
*
Java 6
...
...
@@ -38,7 +37,7 @@ Requirements
Quick Started
---------------------
#####1、在CAT目录下,用maven构建项目
mvn clean install
mvn clean install
-DskipTests
#####2、配置CAT的环境
mvn cat:install
Note:
...
...
cat-broker/src/main/java/com/dianping/cat/broker/api/app/AppDataConsumer.java
浏览文件 @
1a864c3c
...
...
@@ -8,13 +8,18 @@ import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import
org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
;
import
org.unidal.helper.Threads
;
import
org.unidal.helper.Threads.Task
;
import
org.unidal.lookup.annotation.Inject
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.config.app.AppDataService
;
import
com.dianping.cat.service.appData.entity.AppData
;
public
class
AppDataConsumer
implements
Initializable
,
LogEnabled
{
public
static
final
long
DURATION
=
5
*
60
*
1000L
;
@Inject
private
AppDataService
m_appDataService
;
private
AppDataQueue
m_appDataQueue
;
...
...
@@ -45,8 +50,8 @@ public class AppDataConsumer implements Initializable, LogEnabled {
AppDataDispatcherThread
appDataDispatcherThread
=
new
AppDataDispatcherThread
();
BucketThreadController
bucketThreadController
=
new
BucketThreadController
();
Threads
.
forGroup
(
"Cat"
).
start
(
appDataDispatcherThread
);
Threads
.
forGroup
(
"Cat"
).
start
(
bucketThreadController
);
Threads
.
forGroup
(
"Cat"
).
start
(
appDataDispatcherThread
);
}
public
void
setDataLoss
(
long
dataLoss
)
{
...
...
@@ -73,7 +78,7 @@ public class AppDataConsumer implements Initializable, LogEnabled {
timestamp
-=
timestamp
%
DURATION
;
BucketHandler
handler
=
m_tasks
.
get
(
new
Long
(
timestamp
));
if
(
handler
==
null
)
{
if
(
handler
==
null
||
!
handler
.
isActive
()
)
{
m_dataLoss
++;
if
(
m_dataLoss
%
1000
==
0
)
{
...
...
@@ -123,7 +128,7 @@ public class AppDataConsumer implements Initializable, LogEnabled {
try
{
long
currentDuration
=
curTime
-
curTime
%
DURATION
;
removeLastLastTask
(
currentDuration
);
closeLastTask
(
currentDuration
);
startCurrentTask
(
currentDuration
);
...
...
@@ -147,8 +152,8 @@ public class AppDataConsumer implements Initializable, LogEnabled {
private
void
startCurrentTask
(
long
currentDuration
)
{
Long
cur
=
new
Long
(
currentDuration
);
if
(
m_tasks
.
get
(
cur
)
!
=
null
)
{
BucketHandler
curBucketHandler
=
new
BucketHandler
(
cur
);
if
(
m_tasks
.
get
(
cur
)
=
=
null
)
{
BucketHandler
curBucketHandler
=
new
BucketHandler
(
cur
,
m_appDataService
);
Threads
.
forGroup
(
"Cat"
).
start
(
curBucketHandler
);
m_tasks
.
put
(
cur
,
curBucketHandler
);
...
...
@@ -157,8 +162,8 @@ public class AppDataConsumer implements Initializable, LogEnabled {
private
void
startNextTask
(
long
currentDuration
)
{
Long
next
=
new
Long
(
currentDuration
+
DURATION
);
if
(
m_tasks
.
get
(
next
)
!
=
null
)
{
BucketHandler
nextBucketHandler
=
new
BucketHandler
(
next
);
if
(
m_tasks
.
get
(
next
)
=
=
null
)
{
BucketHandler
nextBucketHandler
=
new
BucketHandler
(
next
,
m_appDataService
);
Threads
.
forGroup
(
"Cat"
).
start
(
nextBucketHandler
);
m_tasks
.
put
(
next
,
nextBucketHandler
);
...
...
cat-broker/src/main/java/com/dianping/cat/broker/api/app/BucketHandler.java
浏览文件 @
1a864c3c
...
...
@@ -2,82 +2,73 @@ package com.dianping.cat.broker.api.app;
import
java.io.BufferedWriter
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.Map.Entry
;
import
org.codehaus.plexus.logging.LogEnabled
;
import
org.codehaus.plexus.logging.Logger
;
import
org.unidal.helper.Threads.Task
;
import
org.unidal.lookup.annotation.Inject
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.config.app.AppDataService
;
import
com.dianping.cat.service.appData.entity.AppData
;
public
class
BucketHandler
implements
Task
,
LogEnabled
{
public
class
BucketHandler
implements
Task
{
private
Logger
m_logger
;
private
static
final
String
FILEDIRECTORY
=
"/data/appdatas/cat/app/"
;
private
static
int
ONE_DAY
=
24
*
60
*
60
*
1000
;
private
static
int
ONE_MINUTE
=
60
*
1000
;
private
AppDataQueue
m_appDataQueue
;
private
HashMap
<
Integer
,
HashMap
<
String
,
AppData
>>
m_mergedData
;
@Inject
private
AppDataService
m_appDataService
;
private
long
m_startTime
;
private
boolean
m_isActive
=
true
;
private
static
final
String
FILEDIRECTORY
=
"/data/appdatas/cat/appdata/"
;
private
HashMap
<
Integer
,
HashMap
<
String
,
AppData
>>
m_mergedData
;
public
void
setActive
(
boolean
isActive
)
{
m_isActive
=
isActive
;
}
private
long
m_startTime
;
public
BucketHandler
(
long
startTime
)
{
public
BucketHandler
(
long
startTime
,
AppDataService
appDataService
)
{
m_startTime
=
startTime
;
m_appDataQueue
=
new
AppDataQueue
();
m_mergedData
=
new
LinkedHashMap
<
Integer
,
HashMap
<
String
,
AppData
>>();
m_appDataService
=
appDataService
;
}
@Override
public
void
enableLogging
(
Logger
logger
)
{
m_logger
=
logger
;
}
@Override
public
void
run
()
{
while
(
m_isActive
)
{
AppData
appData
=
m_appDataQueue
.
poll
();
private
void
end
()
{
for
(
Entry
<
Integer
,
HashMap
<
String
,
AppData
>>
outerEntry
:
m_mergedData
.
entrySet
())
{
for
(
Entry
<
String
,
AppData
>
entry
:
outerEntry
.
getValue
().
entrySet
())
{
AppData
appData
=
entry
.
getValue
();
if
(
appData
!=
null
)
{
processEntity
(
appData
);
saveToDataBase
(
appData
);
}
}
}
while
(
true
)
{
AppData
appData
=
m_appDataQueue
.
poll
();
public
void
enqueue
(
AppData
appData
)
{
m_appDataQueue
.
offer
(
appData
);
}
if
(
appData
!=
null
)
{
processEntity
(
appData
);
}
else
{
break
;
}
}
@Override
public
String
getName
()
{
return
"BucketHandler"
;
}
end
();
public
boolean
isActive
()
{
synchronized
(
this
)
{
return
m_isActive
;
}
}
private
void
processEntity
(
AppData
appData
)
{
Integer
command
=
appData
.
getCommand
();
String
key
=
m_startTime
+
":"
+
appData
.
getCity
()
+
":"
+
appData
.
getOperator
()
+
":"
+
appData
.
getC
hannel
()
String
key
=
m_startTime
+
":"
+
appData
.
getCity
()
+
":"
+
appData
.
getOperator
()
+
":"
+
appData
.
getC
onnectType
()
+
":"
+
appData
.
getVersion
()
+
":"
+
appData
.
getNetwork
()
+
":"
+
appData
.
getCode
()
+
":"
+
appData
.
getPlatform
();
HashMap
<
String
,
AppData
>
secondMap
=
m_mergedData
.
get
(
command
);
if
(
secondMap
==
null
)
{
...
...
@@ -99,36 +90,43 @@ public class BucketHandler implements Task, LogEnabled {
}
}
private
void
end
()
{
for
(
Entry
<
Integer
,
HashMap
<
String
,
AppData
>>
outerEntry
:
m_mergedData
.
entrySet
()
)
{
for
(
Entry
<
String
,
AppData
>
entry
:
outerEntry
.
getValue
().
entrySet
())
{
AppData
appData
=
entry
.
getValue
();
@Override
public
void
run
(
)
{
while
(
isActive
())
{
AppData
appData
=
m_appDataQueue
.
poll
();
if
(
saveToDataBase
(
appData
)
==
false
)
{
saveToFile
(
appData
);
}
if
(
appData
!=
null
)
{
processEntity
(
appData
);
}
}
}
@Override
public
String
getName
()
{
return
"BucketHandler"
;
}
while
(
true
)
{
AppData
appData
=
m_appDataQueue
.
poll
();
@Override
public
void
shutdown
()
{
m_isActive
=
false
;
}
if
(
appData
!=
null
)
{
processEntity
(
appData
);
}
else
{
break
;
}
}
public
void
enqueue
(
AppData
appData
)
{
m_appDataQueue
.
offer
(
appData
);
end
();
}
private
boolean
saveToDataBase
(
AppData
appData
)
{
m_appDataService
.
insert
();
return
true
;
private
void
saveToDataBase
(
AppData
appData
)
{
int
minute
=
(
int
)
(
m_startTime
%
ONE_DAY
/
ONE_MINUTE
);
Date
period
=
new
Date
(
m_startTime
-
minute
*
ONE_MINUTE
);
try
{
m_appDataService
.
insert
(
period
,
minute
,
appData
.
getCommand
(),
appData
.
getCity
(),
appData
.
getOperator
(),
appData
.
getNetwork
(),
appData
.
getVersion
(),
appData
.
getConnectType
(),
appData
.
getCode
(),
appData
.
getPlatform
(),
appData
.
getCount
(),
appData
.
getResponseTime
(),
appData
.
getResponseByte
(),
appData
.
getResponseByte
());
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
saveToFile
(
appData
);
}
}
private
void
saveToFile
(
AppData
appData
)
{
...
...
@@ -140,14 +138,22 @@ public class BucketHandler implements Task, LogEnabled {
try
{
BufferedWriter
writer
=
new
BufferedWriter
(
new
FileWriter
(
filePath
));
String
content
=
appData
.
getTimestamp
()
+
"\t"
+
appData
.
getCity
()
+
"\t"
+
appData
.
getOperator
()
+
"\t"
+
appData
.
getNetwork
()
+
"\t"
+
appData
.
getVersion
()
+
"\t"
+
appData
.
getC
hannel
()
+
"\t"
+
appData
.
getNetwork
()
+
"\t"
+
appData
.
getVersion
()
+
"\t"
+
appData
.
getC
onnectType
()
+
"\t"
+
appData
.
getCommand
()
+
"\t"
+
appData
.
getCode
()
+
"\t"
+
appData
.
getPlatform
()
+
"\t"
+
appData
.
getRequestByte
()
+
"\t"
+
appData
.
getResponseByte
()
+
"\t"
+
appData
.
getResponseTime
()
+
"\n"
;
writer
.
append
(
content
);
writer
.
close
();
}
catch
(
IO
Exception
e
)
{
m_logger
.
error
(
"save appdata to file "
+
filePath
+
" failed. "
+
e
.
getMessage
()
);
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
}
@Override
public
void
shutdown
()
{
synchronized
(
this
)
{
m_isActive
=
false
;
}
}
}
cat-broker/src/main/java/com/dianping/cat/broker/api/page/IpService.java
浏览文件 @
1a864c3c
...
...
@@ -35,12 +35,10 @@ public class IpService implements Initializable {
Area
area
=
m_areas
.
get
(
m_areaIds
[
mid
]);
if
(
area
!=
null
)
{
ipInfo
.
setAreaId
(
area
.
getAreaId
());
ipInfo
.
setNation
(
area
.
getNation
());
ipInfo
.
setProvince
(
area
.
getProvince
());
ipInfo
.
setCity
(
area
.
getCity
());
}
else
{
ipInfo
.
setAreaId
(
0
);
ipInfo
.
setNation
(
"未知"
);
ipInfo
.
setProvince
(
"未知"
);
ipInfo
.
setCity
(
"未知"
);
...
...
@@ -49,10 +47,8 @@ public class IpService implements Initializable {
Corporation
corp
=
m_corps
.
get
(
m_corpIds
[
mid
]);
if
(
corp
!=
null
)
{
ipInfo
.
setCorpId
(
corp
.
getCorporationId
());
ipInfo
.
setChannel
(
corp
.
getName
());
}
else
{
ipInfo
.
setCorpId
(
0
);
ipInfo
.
setChannel
(
"其他"
);
}
return
ipInfo
;
...
...
@@ -244,22 +240,14 @@ public class IpService implements Initializable {
}
public
static
class
IpInfo
{
private
Integer
m_areaId
;
private
String
m_channel
;
private
String
m_city
;
private
Integer
m_corpId
;
private
String
m_nation
;
private
String
m_province
;
public
Integer
getAreaId
()
{
return
m_areaId
;
}
public
String
getChannel
()
{
return
m_channel
;
}
...
...
@@ -268,10 +256,6 @@ public class IpService implements Initializable {
return
m_city
;
}
public
Integer
getCorpId
()
{
return
m_corpId
;
}
public
String
getNation
()
{
return
m_nation
;
}
...
...
@@ -280,10 +264,6 @@ public class IpService implements Initializable {
return
m_province
;
}
public
void
setAreaId
(
Integer
areaId
)
{
m_areaId
=
areaId
;
}
public
void
setChannel
(
String
name
)
{
m_channel
=
name
;
}
...
...
@@ -292,10 +272,6 @@ public class IpService implements Initializable {
m_city
=
city
;
}
public
void
setCorpId
(
Integer
corpId
)
{
m_corpId
=
corpId
;
}
public
void
setNation
(
String
nation
)
{
m_nation
=
nation
;
}
...
...
cat-broker/src/main/java/com/dianping/cat/broker/api/page/batch/Handler.java
浏览文件 @
1a864c3c
package
com.dianping.cat.broker.api.page.batch
;
import
java.io.IOException
;
import
java.util.List
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -23,6 +24,7 @@ import com.dianping.cat.broker.api.page.MonitorEntity;
import
com.dianping.cat.broker.api.page.MonitorManager
;
import
com.dianping.cat.broker.api.page.RequestUtils
;
import
com.dianping.cat.config.app.AppConfigManager
;
import
com.dianping.cat.configuration.app.entity.Item
;
import
com.dianping.cat.service.appData.entity.AppData
;
public
class
Handler
implements
PageHandler
<
Context
>,
LogEnabled
{
...
...
@@ -121,7 +123,25 @@ public class Handler implements PageHandler<Context>, LogEnabled {
String
records
[]
=
content
.
split
(
"\n"
);
IpInfo
ipInfo
=
m_ipService
.
findIpInfoByString
(
userIp
);
String
cityStr
=
ipInfo
.
getProvince
();
String
operatorStr
=
ipInfo
.
getChannel
();
int
cityId
=
0
,
operatorId
=
0
;
List
<
Item
>
cityList
=
m_appConfigManager
.
queryConfigItem
(
AppConfigManager
.
CITY
);
List
<
Item
>
operatorList
=
m_appConfigManager
.
queryConfigItem
(
AppConfigManager
.
OPERATOR
);
for
(
Item
item
:
cityList
)
{
if
(
item
.
getName
().
equals
(
cityStr
))
{
cityId
=
item
.
getId
();
break
;
}
}
for
(
Item
item
:
operatorList
)
{
if
(
item
.
getName
().
equals
(
operatorStr
))
{
operatorId
=
item
.
getId
();
break
;
}
}
for
(
String
record
:
records
)
{
String
items
[]
=
record
.
split
(
"\t"
);
...
...
@@ -140,14 +160,15 @@ public class Handler implements PageHandler<Context>, LogEnabled {
appData
.
setCommand
(
command
);
appData
.
setNetwork
(
Integer
.
parseInt
(
items
[
2
]));
appData
.
setVersion
(
Integer
.
parseInt
(
items
[
3
]));
appData
.
setC
hannel
(
Integer
.
parseInt
(
items
[
4
]));
appData
.
setC
onnectType
(
Integer
.
parseInt
(
items
[
4
]));
appData
.
setCode
(
Integer
.
parseInt
(
items
[
5
]));
appData
.
setPlatform
(
Integer
.
parseInt
(
items
[
6
]));
appData
.
setRequestByte
(
Integer
.
parseInt
(
items
[
7
]));
appData
.
setResponseByte
(
Integer
.
parseInt
(
items
[
8
]));
appData
.
setResponseTime
(
Integer
.
parseInt
(
items
[
9
]));
appData
.
setCity
(
ipInfo
.
getAreaId
());
appData
.
setOperator
(
ipInfo
.
getCorpId
());
appData
.
setCity
(
cityId
);
appData
.
setOperator
(
operatorId
);
appData
.
setCount
(
1
);
}
catch
(
Exception
e
)
{
m_logger
.
error
(
e
.
getMessage
(),
e
);
}
...
...
cat-broker/src/main/java/com/dianping/cat/broker/build/ComponentsConfigurator.java
浏览文件 @
1a864c3c
...
...
@@ -4,12 +4,17 @@ import java.util.ArrayList;
import
java.util.List
;
import
org.unidal.dal.jdbc.datasource.JdbcDataSourceDescriptorManager
;
import
org.unidal.dal.jdbc.mapping.TableProvider
;
import
org.unidal.lookup.configuration.AbstractResourceConfigurator
;
import
org.unidal.lookup.configuration.Component
;
import
com.dianping.cat.broker.api.app.AppDataConsumer
;
import
com.dianping.cat.broker.api.page.IpService
;
import
com.dianping.cat.broker.api.page.MonitorManager
;
import
com.dianping.cat.broker.api.page.RequestUtils
;
import
com.dianping.cat.build.AppDatabaseConfigurator
;
import
com.dianping.cat.config.app.AppDataCommandTableProvider
;
import
com.dianping.cat.config.app.AppDataService
;
import
com.dianping.cat.config.url.UrlPatternConfigManager
;
public
class
ComponentsConfigurator
extends
AbstractResourceConfigurator
{
...
...
@@ -21,10 +26,16 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
all
.
add
(
C
(
RequestUtils
.
class
));
all
.
add
(
C
(
MonitorManager
.
class
).
req
(
UrlPatternConfigManager
.
class
,
IpService
.
class
));
all
.
add
(
C
(
AppDataConsumer
.
class
).
req
(
AppDataService
.
class
));
all
.
add
(
C
(
TableProvider
.
class
,
"app-data-command"
,
AppDataCommandTableProvider
.
class
));
// database
all
.
add
(
C
(
JdbcDataSourceDescriptorManager
.
class
)
//
.
config
(
E
(
"datasourceFile"
).
value
(
"/data/appdatas/cat/datasources.xml"
)));
all
.
addAll
(
new
AppDatabaseConfigurator
().
defineComponents
());
// Please keep it as last
all
.
addAll
(
new
WebComponentConfigurator
().
defineComponents
());
...
...
cat-broker/src/main/resources/META-INF/dal/model/appData-codegen.xml
浏览文件 @
1a864c3c
...
...
@@ -6,7 +6,7 @@
<attribute
name=
"operator"
value-type=
"int"
/>
<attribute
name=
"network"
value-type=
"int"
/>
<attribute
name=
"version"
value-type=
"int"
/>
<attribute
name=
"c
hannel
"
value-type=
"int"
/>
<attribute
name=
"c
onnectType
"
value-type=
"int"
/>
<attribute
name=
"command"
value-type=
"int"
/>
<attribute
name=
"code"
value-type=
"int"
/>
<attribute
name=
"platform"
value-type=
"int"
/>
...
...
cat-broker/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
1a864c3c
...
...
@@ -20,6 +20,20 @@
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.broker.api.app.AppDataConsumer
</role>
<implementation>
com.dianping.cat.broker.api.app.AppDataConsumer
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.config.app.AppDataService
</role>
</requirement>
</requirements>
</component>
<component>
<role>
org.unidal.dal.jdbc.mapping.TableProvider
</role>
<role-hint>
app-data-command
</role-hint>
<implementation>
com.dianping.cat.config.app.AppDataCommandTableProvider
</implementation>
</component>
<component>
<role>
org.unidal.dal.jdbc.datasource.JdbcDataSourceDescriptorManager
</role>
<implementation>
org.unidal.dal.jdbc.datasource.JdbcDataSourceDescriptorManager
</implementation>
...
...
@@ -27,6 +41,25 @@
<datasourceFile>
/data/appdatas/cat/datasources.xml
</datasourceFile>
</configuration>
</component>
<component>
<role>
org.unidal.dal.jdbc.mapping.TableProvider
</role>
<role-hint>
app-data-command
</role-hint>
<implementation>
org.unidal.dal.jdbc.mapping.SimpleTableProvider
</implementation>
<configuration>
<logical-table-name>
app-data-command
</logical-table-name>
<physical-table-name>
app_data_command
</physical-table-name>
<data-source-name>
app
</data-source-name>
</configuration>
</component>
<component>
<role>
com.dianping.cat.app.AppDataCommandDao
</role>
<implementation>
com.dianping.cat.app.AppDataCommandDao
</implementation>
<requirements>
<requirement>
<role>
org.unidal.dal.jdbc.QueryEngine
</role>
</requirement>
</requirements>
</component>
<component>
<role>
org.unidal.web.mvc.model.ModuleRegistry
</role>
<implementation>
org.unidal.web.mvc.model.ModuleRegistry
</implementation>
...
...
@@ -97,6 +130,15 @@
<role>
com.dianping.cat.broker.api.page.batch.Handler
</role>
<implementation>
com.dianping.cat.broker.api.page.batch.Handler
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.broker.api.app.AppDataConsumer
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.broker.api.page.IpService
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.config.app.AppConfigManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.broker.api.page.MonitorManager
</role>
</requirement>
...
...
@@ -106,62 +148,73 @@
</requirements>
</component>
<component>
<role>
com.dianping.cat.broker.api.
page.js.Handl
er
</role>
<implementation>
com.dianping.cat.broker.api.
page.js.Handl
er
</implementation>
<role>
com.dianping.cat.broker.api.
app.AppDataConsum
er
</role>
<implementation>
com.dianping.cat.broker.api.
app.AppDataConsum
er
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.config.a
ggregation.AggregationConfigManager
</role>
<role>
com.dianping.cat.config.a
pp.AppDataService
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.config.a
ggregation.AggregationConfigManager
</role>
<implementation>
com.dianping.cat.config.a
ggregation.AggregationConfigManager
</implementation>
<role>
com.dianping.cat.config.a
pp.AppDataService
</role>
<implementation>
com.dianping.cat.config.a
pp.AppDataService
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.
core.config.Config
Dao
</role>
<role>
com.dianping.cat.
app.AppDataCommand
Dao
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.app.AppDataCommandDao
</role>
<implementation>
com.dianping.cat.app.AppDataCommandDao
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.config.aggregation.AggregationHandler
</role>
<role>
org.unidal.dal.jdbc.QueryEngine
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.
broker.api.page.cdn.Handl
er
</role>
<implementation>
com.dianping.cat.
broker.api.page.cdn.Handl
er
</implementation>
<role>
com.dianping.cat.
config.app.AppConfigManag
er
</role>
<implementation>
com.dianping.cat.
config.app.AppConfigManag
er
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.
broker.api.page.MonitorManager
</role>
<role>
com.dianping.cat.
core.config.ConfigDao
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.broker.api.page.js.Handler
</role>
<implementation>
com.dianping.cat.broker.api.page.js.Handler
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.
broker.api.page.RequestUtils
</role>
<role>
com.dianping.cat.
config.aggregation.AggregationConfigManager
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.
broker.api.page.app.Handl
er
</role>
<implementation>
com.dianping.cat.
broker.api.page.app.Handl
er
</implementation>
<role>
com.dianping.cat.
config.aggregation.AggregationConfigManag
er
</role>
<implementation>
com.dianping.cat.
config.aggregation.AggregationConfigManag
er
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.
broker.api.page.app.JspViewer
</role>
<role>
com.dianping.cat.
core.config.ConfigDao
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.
broker.api.page.app.appdata.AppDataDispatch
er
</role>
<role>
com.dianping.cat.
config.aggregation.AggregationHandl
er
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.broker.api.page.
app.JspView
er
</role>
<implementation>
com.dianping.cat.broker.api.page.
app.JspView
er
</implementation>
<role>
com.dianping.cat.broker.api.page.
cdn.Handl
er
</role>
<implementation>
com.dianping.cat.broker.api.page.
cdn.Handl
er
</implementation>
<requirements>
<requirement>
<role>
org.unidal.web.mvc.view.model.ModelHandler
</role>
<role>
com.dianping.cat.broker.api.page.MonitorManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.broker.api.page.RequestUtils
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.broker.api.page.app.appdata.AppDataDispatcher
</role>
<implementation>
com.dianping.cat.broker.api.page.app.appdata.AppDataDispatcher
</implementation>
</component>
</components>
</plexus>
cat-broker/src/test/java/com/dianping/cat/broker/AppTest.java
0 → 100644
浏览文件 @
1a864c3c
package
com.dianping.cat.broker
;
import
java.io.BufferedReader
;
import
java.io.InputStreamReader
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
AppTest
{
public
static
void
main
(
String
[]
args
)
{
List
<
String
>
urls
=
new
ArrayList
<
String
>();
String
url_pre
=
"http://localhost:2765/broker-service/api/batch"
;
long
timestamp
=
System
.
currentTimeMillis
();
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
urls
.
add
(
url_pre
+
"?v=2&c="
+
timestamp
+
URLEncoder
.
encode
(
"\tshop.bin\t1\t1\t1\t1\t1\t1\t1\t1\n"
));
}
for
(
String
url
:
urls
)
{
System
.
out
.
println
(
url
);
sendGet
(
url
);
}
}
public
static
String
sendGet
(
String
url
)
{
String
result
=
""
;
BufferedReader
in
=
null
;
try
{
URL
realUrl
=
new
URL
(
url
);
URLConnection
connection
=
realUrl
.
openConnection
();
connection
.
connect
();
in
=
new
BufferedReader
(
new
InputStreamReader
(
connection
.
getInputStream
()));
String
line
;
while
((
line
=
in
.
readLine
())
!=
null
)
{
result
+=
line
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
in
!=
null
)
{
in
.
close
();
}
}
catch
(
Exception
e2
)
{
e2
.
printStackTrace
();
}
}
return
result
;
}
}
cat-core/pom.xml
浏览文件 @
1a864c3c
...
...
@@ -27,7 +27,7 @@
<dependency>
<groupId>
org.unidal.framework
</groupId>
<artifactId>
dal-jdbc
</artifactId>
<version>
2.
0.4
</version>
<version>
2.
1.1
</version>
</dependency>
<dependency>
<groupId>
org.jboss.netty
</groupId>
...
...
cat-core/src/main/java/com/dianping/cat/build/AppDatabaseConfigurator.java
浏览文件 @
1a864c3c
...
...
@@ -6,12 +6,12 @@ import java.util.List;
import
org.unidal.dal.jdbc.configuration.AbstractJdbcResourceConfigurator
;
import
org.unidal.lookup.configuration.Component
;
final
class
AppDatabaseConfigurator
extends
AbstractJdbcResourceConfigurator
{
final
public
class
AppDatabaseConfigurator
extends
AbstractJdbcResourceConfigurator
{
@Override
public
List
<
Component
>
defineComponents
()
{
List
<
Component
>
all
=
new
ArrayList
<
Component
>();
// all.add(defineJdbcDataSourceComponent("app", "com.mysql.jdbc.Driver", "jdbc:mysql://127.0.0.1:3306/
app
", "root", "***", "<![CDATA[useUnicode=true&autoReconnect=true]]>"));
// all.add(defineJdbcDataSourceComponent("app", "com.mysql.jdbc.Driver", "jdbc:mysql://127.0.0.1:3306/
cat
", "root", "***", "<![CDATA[useUnicode=true&autoReconnect=true]]>"));
defineSimpleTableProviderComponents
(
all
,
"app"
,
com
.
dianping
.
cat
.
app
.
_INDEX
.
getEntityClasses
());
defineDaoComponents
(
all
,
com
.
dianping
.
cat
.
app
.
_INDEX
.
getDaoClasses
());
...
...
cat-core/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
浏览文件 @
1a864c3c
...
...
@@ -12,10 +12,13 @@ import com.dianping.cat.DomainManager;
import
com.dianping.cat.ServerConfigManager
;
import
com.dianping.cat.analysis.DefaultMessageAnalyzerManager
;
import
com.dianping.cat.analysis.MessageAnalyzerManager
;
import
com.dianping.cat.app.AppDataCommand
;
import
com.dianping.cat.app.AppDataCommandDao
;
import
com.dianping.cat.config.aggregation.AggregationConfigManager
;
import
com.dianping.cat.config.aggregation.AggregationHandler
;
import
com.dianping.cat.config.aggregation.DefaultAggregationHandler
;
import
com.dianping.cat.config.app.AppConfigManager
;
import
com.dianping.cat.config.app.AppDataService
;
import
com.dianping.cat.config.url.DefaultUrlPatternHandler
;
import
com.dianping.cat.config.url.UrlPatternConfigManager
;
import
com.dianping.cat.config.url.UrlPatternHandler
;
...
...
@@ -63,6 +66,8 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
all
.
add
(
C
(
AggregationConfigManager
.
class
).
req
(
AggregationHandler
.
class
,
ConfigDao
.
class
));
all
.
add
(
C
(
AppConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
AppDataService
.
class
).
req
(
AppDataCommandDao
.
class
));
all
.
add
(
C
(
UrlPatternHandler
.
class
,
DefaultUrlPatternHandler
.
class
));
...
...
@@ -75,7 +80,7 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
.
req
(
ServerConfigManager
.
class
,
MessagePathBuilder
.
class
,
ServerStatisticManager
.
class
));
all
.
add
(
C
(
Module
.
class
,
CatCoreModule
.
ID
,
CatCoreModule
.
class
));
all
.
addAll
(
new
CatCoreDatabaseConfigurator
().
defineComponents
());
all
.
addAll
(
new
CodecComponentConfigurator
().
defineComponents
());
all
.
addAll
(
new
StorageComponentConfigurator
().
defineComponents
());
...
...
cat-core/src/main/java/com/dianping/cat/config/app/AppDataCommandTableProvider.java
0 → 100644
浏览文件 @
1a864c3c
package
com.dianping.cat.config.app
;
import
java.util.Map
;
import
org.unidal.dal.jdbc.QueryEngine
;
import
org.unidal.dal.jdbc.mapping.TableProvider
;
import
com.dianping.cat.app.AppDataCommand
;
public
class
AppDataCommandTableProvider
implements
TableProvider
{
private
String
m_logicalTableName
=
"app-data-command"
;
private
String
m_physicalTableName
=
"app_data_command"
;
private
String
m_dataSourceName
=
"app"
;
@Override
public
String
getDataSourceName
(
Map
<
String
,
Object
>
hints
)
{
return
m_dataSourceName
;
}
@Override
public
String
getLogicalTableName
()
{
return
m_logicalTableName
;
}
@Override
public
String
getPhysicalTableName
(
Map
<
String
,
Object
>
hints
)
{
AppDataCommand
command
=
(
AppDataCommand
)
hints
.
get
(
QueryEngine
.
HINT_DATA_OBJECT
);
return
m_physicalTableName
+
"_"
+
command
.
getCommandId
();
}
public
void
setDataSourceName
(
String
dataSourceName
)
{
m_dataSourceName
=
dataSourceName
;
}
public
void
setLogicalTableName
(
String
logicalTableName
)
{
m_logicalTableName
=
logicalTableName
;
}
}
\ No newline at end of file
cat-core/src/main/java/com/dianping/cat/config/app/AppDataService.java
浏览文件 @
1a864c3c
package
com.dianping.cat.config.app
;
import
java.util.Date
;
import
java.util.List
;
import
org.unidal.dal.jdbc.DalException
;
import
org.unidal.lookup.annotation.Inject
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.app.AppDataCommand
;
import
com.dianping.cat.app.AppDataCommandDao
;
import
com.dianping.cat.app.AppDataCommandEntity
;
public
class
AppDataService
{
public
void
insert
(){
@Inject
private
AppDataCommandDao
m_dao
;
public
void
insert
(
Date
period
,
int
minute
,
int
commandId
,
int
city
,
int
operator
,
int
network
,
int
appVersion
,
int
connectType
,
int
code
,
int
platform
,
int
count
,
int
responseSumTime
,
int
requestPackage
,
int
responsePackage
)
throws
DalException
{
AppDataCommand
proto
=
new
AppDataCommand
();
proto
.
setPeriod
(
period
);
proto
.
setMinuteOrder
(
minute
);
proto
.
setCommandId
(
commandId
);
proto
.
setCity
(
city
);
proto
.
setOperator
(
operator
);
proto
.
setNetwork
(
network
);
proto
.
setAppVersion
(
appVersion
);
proto
.
setConnnectType
(
connectType
);
proto
.
setCode
(
code
);
proto
.
setPlatform
(
platform
);
proto
.
setAccessNumber
(
count
);
proto
.
setResponseSumTime
(
responseSumTime
);
proto
.
setRequestPackage
(
requestPackage
);
proto
.
setResponsePackage
(
responsePackage
);
proto
.
setCreationDate
(
new
Date
());
m_dao
.
insertData
(
proto
);
}
public
void
queryAvg
(
QueryEntity
entity
)
{
int
commandId
=
entity
.
getCommand
();
Date
period
=
entity
.
getDate
();
int
city
=
entity
.
getCity
();
int
operator
=
entity
.
getOperator
();
int
network
=
entity
.
getNetwork
();
int
appVersion
=
entity
.
getVersion
();
int
connnectType
=
entity
.
getChannel
();
int
code
=
entity
.
getCode
();
int
platform
=
entity
.
getPlatfrom
();
try
{
List
<
AppDataCommand
>
datas
=
m_dao
.
findData
(
commandId
,
period
,
city
,
operator
,
network
,
appVersion
,
connnectType
,
code
,
platform
,
AppDataCommandEntity
.
READSET_DATA
);
for
(
AppDataCommand
data
:
datas
)
{
int
minuteOrder
=
data
.
getMinuteOrder
();
long
count
=
data
.
getAccessNumberSum
();
long
sum
=
data
.
getResponseSumTimeSum
();
double
avg
=
sum
/
count
;
}
}
catch
(
DalException
e
)
{
Cat
.
logError
(
e
);
}
}
public
void
queryCount
(
QueryEntity
entity
)
{
}
public
void
querySuccessRate
(
QueryEntity
entity
)
{
}
public
static
class
Statistics
{
...
...
@@ -50,5 +105,5 @@ public class AppDataService {
m_avg
=
avg
;
}
}
}
cat-core/src/main/resources/META-INF/dal/jdbc/app-codegen.xml
浏览文件 @
1a864c3c
...
...
@@ -12,10 +12,10 @@
<member
name=
"connnect-type"
field=
"connnect_type"
value-type=
"int"
length=
"3"
nullable=
"false"
/>
<member
name=
"code"
field=
"code"
value-type=
"int"
length=
"5"
nullable=
"false"
/>
<member
name=
"platform"
field=
"platform"
value-type=
"int"
length=
"3"
nullable=
"false"
/>
<member
name=
"access-number"
field=
"access_number"
value-type=
"
String"
length=
"16777215
"
nullable=
"false"
/>
<member
name=
"response-sum-time"
field=
"response_sum_time"
value-type=
"
String"
length=
"16777215
"
nullable=
"false"
/>
<member
name=
"request-package"
field=
"request_package"
value-type=
"
String"
length=
"16777215
"
nullable=
"false"
/>
<member
name=
"response-package"
field=
"response_package"
value-type=
"
String"
length=
"16777215
"
nullable=
"false"
/>
<member
name=
"access-number"
field=
"access_number"
value-type=
"
long"
length=
"19
"
nullable=
"false"
/>
<member
name=
"response-sum-time"
field=
"response_sum_time"
value-type=
"
long"
length=
"19
"
nullable=
"false"
/>
<member
name=
"request-package"
field=
"request_package"
value-type=
"
long"
length=
"19
"
nullable=
"false"
/>
<member
name=
"response-package"
field=
"response_package"
value-type=
"
long"
length=
"19
"
nullable=
"false"
/>
<member
name=
"creation-date"
field=
"creation_date"
value-type=
"Date"
nullable=
"false"
/>
<var
name=
"key-id"
value-type=
"int"
key-member=
"id"
/>
<primary-key
name=
"PRIMARY"
members=
"id"
/>
...
...
cat-core/src/main/resources/META-INF/dal/jdbc/app-dal.xml
浏览文件 @
1a864c3c
<?xml version="1.0" encoding="UTF-8"?>
<entities
do-package=
"com.dianping.cat.app"
gen=
"true"
/>
<entities
do-package=
"com.dianping.cat.app"
gen=
"true"
>
<entity
name=
"app-data-command"
table=
"app_data_command"
alias=
"adc"
>
<member
name=
"access-number"
field=
"access_number"
value-type=
"long"
length=
"19"
nullable=
"false"
/>
<member
name=
"response-sum-time"
field=
"response_sum_time"
value-type=
"long"
length=
"19"
nullable=
"false"
/>
<member
name=
"request-package"
field=
"request_package"
value-type=
"long"
length=
"19"
nullable=
"false"
/>
<member
name=
"response-package"
field=
"response_package"
value-type=
"long"
length=
"19"
nullable=
"false"
/>
<member
name=
"creation-date"
field=
"creation_date"
value-type=
"Date"
nullable=
"false"
/>
<member
name=
"access-number-sum"
value-type=
"long"
all=
"false"
select-expr=
"sum(access_number)"
length=
"19"
nullable=
"false"
/>
<member
name=
"response-sum-time-sum"
value-type=
"long"
all=
"false"
select-expr=
"sum(response-sum-time)"
length=
"19"
nullable=
"false"
/>
<var
name=
"key-id"
value-type=
"int"
key-member=
"id"
/>
<var
name=
"command-id"
value-type=
"int"
/>
<readsets>
<readset
name=
"DATA"
>
<member
name=
"minute-order"
/>
<member
name=
"access-number-sum"
/>
<member
name=
"response-sum-time-sum"
/>
</readset>
<readset
name=
"SUCCESS-DATA"
>
<member
name=
"minute-order"
/>
<member
name=
"code"
/>
<member
name=
"access-number-sum"
/>
</readset>
</readsets>
<query-defs>
<query
name=
"insert-data"
type=
"INSERT"
>
<param
name=
"command-id"
/>
<statement>
<![CDATA[INSERT INTO <TABLE/>
(
<FIELDS/>
)
VALUES(
<VALUES/>
)]]>
</statement>
</query>
<query
name=
"find-data"
type=
"SELECT"
multiple=
"true"
>
<param
name=
"command-id"
/><param
name=
"period"
/>
<param
name=
"period"
/>
<param
name=
"city"
/>
<param
name=
"operator"
/>
<param
name=
"network"
/>
<param
name=
"app-version"
/>
<param
name=
"connnect-type"
/>
<param
name=
"code"
/>
<param
name=
"platform"
/>
<statement>
<![CDATA[SELECT <FIELDS/>
FROM
<TABLE/>
WHERE
<FIELD
name=
'period'
/>
= ${period}
<IF
type=
'NOT_ZERO'
field=
'city'
>
AND
<FIELD
name=
'city'
/>
= ${city}
</IF>
<IF
type=
'NOT_ZERO'
field=
'operator'
>
AND
<FIELD
name=
'operator'
/>
= ${operator}
</IF>
<IF
type=
'NOT_ZERO'
field=
'network'
>
AND
<FIELD
name=
'network'
/>
= ${network}
</IF>
<IF
type=
'NOT_ZERO'
field=
'app-version'
>
AND
<FIELD
name=
'app-version'
/>
= ${app-version}
</IF>
<IF
type=
'NOT_ZERO'
field=
'connnect-type'
>
AND
<FIELD
name=
'connnect-type'
/>
= ${connnect-type}
</IF>
<IF
type=
'NOT_ZERO'
field=
'code'
>
AND
<FIELD
name=
'code'
/>
= ${code}
</IF>
<IF
type=
'NOT_ZERO'
field=
'platform'
>
AND
<FIELD
name=
'platform'
/>
= ${platform}
</IF>
group by
<FIELD
name=
'minute-order'
/>
]]>
</statement>
</query>
<query
name=
"find-success-data"
type=
"SELECT"
multiple=
"true"
>
<param
name=
"command-id"
/><param
name=
"period"
/>
<param
name=
"period"
/>
<param
name=
"city"
/>
<param
name=
"operator"
/>
<param
name=
"network"
/>
<param
name=
"app-version"
/>
<param
name=
"connnect-type"
/>
<param
name=
"code"
/>
<param
name=
"platform"
/>
<statement>
<![CDATA[SELECT <FIELDS/>
FROM
<TABLE/>
WHERE
<FIELD
name=
'period'
/>
= ${period}
<IF
type=
'NOT_ZERO'
field=
'city'
>
AND
<FIELD
name=
'city'
/>
= ${city}
</IF>
<IF
type=
'NOT_ZERO'
field=
'operator'
>
AND
<FIELD
name=
'operator'
/>
= ${operator}
</IF>
<IF
type=
'NOT_ZERO'
field=
'network'
>
AND
<FIELD
name=
'network'
/>
= ${network}
</IF>
<IF
type=
'NOT_ZERO'
field=
'app-version'
>
AND
<FIELD
name=
'app-version'
/>
= ${app-version}
</IF>
<IF
type=
'NOT_ZERO'
field=
'connnect-type'
>
AND
<FIELD
name=
'connnect-type'
/>
= ${connnect-type}
</IF>
<IF
type=
'NOT_ZERO'
field=
'code'
>
AND
<FIELD
name=
'code'
/>
= ${code}
</IF>
<IF
type=
'NOT_ZERO'
field=
'platform'
>
AND
<FIELD
name=
'platform'
/>
= ${platform}
</IF>
group by
<FIELD
name=
'minute-order'
/>
,
<FIELD
name=
'code'
/>
]]>
</statement>
</query>
</query-defs>
</entity>
</entities>
cat-core/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
1a864c3c
...
...
@@ -88,6 +88,15 @@
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.config.app.AppDataService
</role>
<implementation>
com.dianping.cat.config.app.AppDataService
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.app.AppDataCommandDao
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.config.url.UrlPatternHandler
</role>
<implementation>
com.dianping.cat.config.url.DefaultUrlPatternHandler
</implementation>
...
...
cat-core/src/main/resources/META-INF/wizard/jdbc/wizard.xml
浏览文件 @
1a864c3c
...
...
@@ -27,7 +27,7 @@
<jdbc
package=
"com.dianping.cat.app"
name=
"app"
>
<datasource>
<driver>
com.mysql.jdbc.Driver
</driver>
<url>
jdbc:mysql://127.0.0.1:3306/
app
</url>
<url>
jdbc:mysql://127.0.0.1:3306/
cat
</url>
<user>
root
</user>
<password>
password
</password>
<properties>
useUnicode=true
&
autoReconnect=true
</properties>
...
...
cat-home/pom.xml
浏览文件 @
1a864c3c
...
...
@@ -96,11 +96,6 @@
<version>
2.0.4
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.unidal.framework
</groupId>
<artifactId>
dal-jdbc
</artifactId>
<version>
2.0.4
</version>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-email
</artifactId>
...
...
cat-home/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
浏览文件 @
1a864c3c
...
...
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import
java.util.List
;
import
org.unidal.dal.jdbc.datasource.JdbcDataSourceDescriptorManager
;
import
org.unidal.dal.jdbc.mapping.TableProvider
;
import
org.unidal.initialization.DefaultModuleManager
;
import
org.unidal.initialization.Module
;
import
org.unidal.initialization.ModuleManager
;
...
...
@@ -12,6 +13,7 @@ import org.unidal.lookup.configuration.Component;
import
com.dianping.cat.CatHomeModule
;
import
com.dianping.cat.ServerConfigManager
;
import
com.dianping.cat.config.app.AppDataCommandTableProvider
;
import
com.dianping.cat.consumer.dependency.DependencyAnalyzer
;
import
com.dianping.cat.consumer.metric.MetricAnalyzer
;
import
com.dianping.cat.consumer.metric.MetricConfigManager
;
...
...
@@ -83,9 +85,42 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
public
static
void
main
(
String
[]
args
)
{
generatePlexusComponentsXmlFile
(
new
ComponentsConfigurator
());
}
private
List
<
Component
>
defineAlertComponents
()
{
List
<
Component
>
all
=
new
ArrayList
<
Component
>();
@Override
public
List
<
Component
>
defineComponents
()
{
all
.
add
(
C
(
BusinessAlertConfig
.
class
).
req
(
AlertConfigManager
.
class
));
all
.
add
(
C
(
NetworkAlertConfig
.
class
).
req
(
AlertConfigManager
.
class
));
all
.
add
(
C
(
SystemAlertConfig
.
class
).
req
(
AlertConfigManager
.
class
));
all
.
add
(
C
(
ExceptionAlertConfig
.
class
).
req
(
AlertConfigManager
.
class
));
all
.
add
(
C
(
AlertInfo
.
class
));
all
.
add
(
C
(
DefaultMailImpl
.
class
).
req
(
ServerConfigManager
.
class
));
all
.
add
(
C
(
DataChecker
.
class
,
DefaultDataChecker
.
class
));
all
.
add
(
C
(
RemoteMetricReportService
.
class
).
req
(
ServerConfigManager
.
class
));
all
.
add
(
C
(
BusinessAlert
.
class
).
req
(
MetricConfigManager
.
class
,
ProductLineConfigManager
.
class
,
BaselineService
.
class
,
MailSMS
.
class
,
BusinessAlertConfig
.
class
,
AlertInfo
.
class
,
AlertDao
.
class
)
//
.
req
(
RemoteMetricReportService
.
class
,
BusinessRuleConfigManager
.
class
,
DataChecker
.
class
));
all
.
add
(
C
(
NetworkAlert
.
class
).
req
(
MetricConfigManager
.
class
,
ProductLineConfigManager
.
class
,
BaselineService
.
class
,
MailSMS
.
class
,
NetworkAlertConfig
.
class
,
AlertInfo
.
class
,
AlertDao
.
class
)
//
.
req
(
RemoteMetricReportService
.
class
,
NetworkRuleConfigManager
.
class
,
DataChecker
.
class
));
all
.
add
(
C
(
SystemAlert
.
class
).
req
(
MetricConfigManager
.
class
,
ProductLineConfigManager
.
class
,
BaselineService
.
class
,
MailSMS
.
class
,
SystemAlertConfig
.
class
,
AlertInfo
.
class
,
AlertDao
.
class
)
//
.
req
(
RemoteMetricReportService
.
class
,
SystemRuleConfigManager
.
class
,
DataChecker
.
class
));
all
.
add
(
C
(
AlertExceptionBuilder
.
class
).
req
(
ExceptionConfigManager
.
class
));
all
.
add
(
C
(
ExceptionAlert
.
class
).
req
(
ProjectDao
.
class
,
ExceptionAlertConfig
.
class
,
MailSMS
.
class
,
ExceptionConfigManager
.
class
,
AlertExceptionBuilder
.
class
,
AlertDao
.
class
).
req
(
ModelService
.
class
,
TopAnalyzer
.
ID
));
return
all
;
}
private
List
<
Component
>
defineCommonComponents
()
{
List
<
Component
>
all
=
new
ArrayList
<
Component
>();
all
.
add
(
C
(
JsonBuilder
.
class
));
...
...
@@ -98,127 +133,106 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
all
.
add
(
C
(
StateGraphs
.
class
,
StateGraphs
.
class
).
//
req
(
ReportService
.
class
));
all
.
add
(
C
(
Module
.
class
,
CatHomeModule
.
ID
,
CatHomeModule
.
class
));
all
.
add
(
C
(
ModuleManager
.
class
,
DefaultModuleManager
.
class
)
//
.
config
(
E
(
"topLevelModules"
).
value
(
CatHomeModule
.
ID
)));
all
.
add
(
C
(
DomainNavManager
.
class
).
req
(
ProjectDao
.
class
));
all
.
add
(
C
(
EventCollectManager
.
class
).
req
(
EventDao
.
class
,
ServerConfigManager
.
class
));
all
.
add
(
C
(
TopologyGraphConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
ExceptionConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
TopologyGraphItemBuilder
.
class
).
req
(
TopologyGraphConfigManager
.
class
));
all
.
add
(
C
(
DomainGroupConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
TopologyGraphBuilder
.
class
).
req
(
TopologyGraphItemBuilder
.
class
).
is
(
PER_LOOKUP
));
all
.
add
(
C
(
BugConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
TopologyGraphManager
.
class
).
req
(
TopologyGraphBuilder
.
class
,
ServerConfigManager
.
class
)
//
.
req
(
ProductLineConfigManager
.
class
,
TopologyGraphDao
.
class
,
DomainNavManager
.
class
)
//
.
req
(
ModelService
.
class
,
DependencyAnalyzer
.
ID
));
all
.
add
(
C
(
MetricGroupConfigManager
.
class
).
req
(
ConfigDao
.
class
));
// update project database
all
.
add
(
C
(
ProjectUpdateTask
.
class
)
//
.
req
(
ProjectDao
.
class
,
HostinfoDao
.
class
));
return
all
;
}
all
.
add
(
C
(
NetworkRuleConfigManager
.
class
).
req
(
ConfigDao
.
class
));
@Override
public
List
<
Component
>
defineComponents
()
{
List
<
Component
>
all
=
new
ArrayList
<
Component
>();
all
.
add
(
C
(
BusinessRuleConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
addAll
(
defineCommonComponents
());
all
.
addAll
(
defineConfigComponents
());
all
.
addAll
(
defineMetricComponents
());
all
.
addAll
(
defineAlertComponents
());
all
.
add
(
C
(
Module
.
class
,
CatHomeModule
.
ID
,
CatHomeModule
.
class
));
all
.
add
(
C
(
ModuleManager
.
class
,
DefaultModuleManager
.
class
)
//
.
config
(
E
(
"topLevelModules"
).
value
(
CatHomeModule
.
ID
)));
// report serivce
all
.
addAll
(
new
ReportServiceComponentConfigurator
().
defineComponents
());
// task
all
.
addAll
(
new
TaskComponentConfigurator
().
defineComponents
());
all
.
add
(
C
(
AlertConfigManager
.
class
).
req
(
ConfigDao
.
class
));
// model service
all
.
addAll
(
new
ServiceComponentConfigurator
().
defineComponents
());
all
.
add
(
C
(
TopologyGraphItemBuilder
.
class
).
req
(
TopologyGraphConfigManager
.
class
));
all
.
add
(
C
(
TableProvider
.
class
,
"app-data-command"
,
AppDataCommandTableProvider
.
class
));
// database
all
.
add
(
C
(
JdbcDataSourceDescriptorManager
.
class
)
//
.
config
(
E
(
"datasourceFile"
).
value
(
"/data/appdatas/cat/datasources.xml"
)));
all
.
addAll
(
new
CatDatabaseConfigurator
().
defineComponents
());
all
.
addAll
(
new
AppDatabaseConfigurator
().
defineComponents
());
all
.
addAll
(
new
UserDatabaseConfigurator
().
defineComponents
());
all
.
add
(
C
(
TopologyGraphBuilder
.
class
).
req
(
TopologyGraphItemBuilder
.
class
).
is
(
PER_LOOKUP
));
// web, please keep it last
all
.
addAll
(
new
WebComponentConfigurator
().
defineComponents
());
all
.
add
(
C
(
TopologyGraphManager
.
class
).
req
(
TopologyGraphBuilder
.
class
,
ServerConfigManager
.
class
)
//
.
req
(
ProductLineConfigManager
.
class
,
TopologyGraphDao
.
class
,
DomainNavManager
.
class
)
//
.
req
(
ModelService
.
class
,
DependencyAnalyzer
.
ID
));
// for alarm module
all
.
addAll
(
new
AlarmComponentConfigurator
().
defineComponents
());
return
all
;
}
private
List
<
Component
>
defineConfigComponents
(){
List
<
Component
>
all
=
new
ArrayList
<
Component
>();
all
.
add
(
C
(
TopologyGraphConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
ExceptionConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
DomainGroupConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
BugConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
MetricGroupConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
NetworkRuleConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
BusinessRuleConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
AlertConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
NetGraphConfigManager
.
class
).
req
(
ConfigDao
.
class
));
all
.
add
(
C
(
ConfigReloadTask
.
class
).
req
(
MetricConfigManager
.
class
,
ProductLineConfigManager
.
class
));
return
all
;
}
private
List
<
Component
>
defineMetricComponents
(){
List
<
Component
>
all
=
new
ArrayList
<
Component
>();
all
.
add
(
C
(
IpService
.
class
));
all
.
add
(
C
(
CdnGraphCreator
.
class
).
req
(
BaselineService
.
class
,
DataExtractor
.
class
,
MetricDataFetcher
.
class
,
CachedMetricReportService
.
class
,
MetricConfigManager
.
class
,
ProductLineConfigManager
.
class
,
MetricGroupConfigManager
.
class
,
AlertInfo
.
class
));
all
.
add
(
C
(
CachedMetricReportService
.
class
,
CachedMetricReportServiceImpl
.
class
)
.
req
(
ModelService
.
class
,
MetricAnalyzer
.
ID
).
req
(
ReportService
.
class
).
req
(
IpService
.
class
));
all
.
add
(
C
(
DataExtractor
.
class
,
DataExtractorImpl
.
class
));
all
.
add
(
C
(
MetricDataFetcher
.
class
,
MetricDataFetcherImpl
.
class
));
all
.
add
(
C
(
AlertInfo
.
class
).
req
(
MetricConfigManager
.
class
));
all
.
add
(
C
(
CdnGraphCreator
.
class
).
req
(
BaselineService
.
class
,
DataExtractor
.
class
,
MetricDataFetcher
.
class
,
CachedMetricReportService
.
class
,
MetricConfigManager
.
class
,
ProductLineConfigManager
.
class
,
MetricGroupConfigManager
.
class
,
AlertInfo
.
class
));
all
.
add
(
C
(
MetricGraphCreator
.
class
).
req
(
CachedMetricReportService
.
class
,
DataExtractor
.
class
,
MetricDataFetcher
.
class
).
req
(
BaselineService
.
class
,
MetricConfigManager
.
class
,
ProductLineConfigManager
.
class
,
MetricGroupConfigManager
.
class
,
AlertInfo
.
class
));
all
.
add
(
C
(
SystemGraphCreator
.
class
).
req
(
CachedMetricReportService
.
class
,
DataExtractor
.
class
,
MetricDataFetcher
.
class
).
req
(
BaselineService
.
class
,
MetricConfigManager
.
class
,
ProductLineConfigManager
.
class
,
MetricGroupConfigManager
.
class
,
AlertInfo
.
class
));
all
.
add
(
C
(
UserMonitorGraphCreator
.
class
,
DefaultUserMonitGraphCreator
.
class
).
req
(
CachedMetricReportService
.
class
,
DataExtractor
.
class
,
MetricDataFetcher
.
class
).
req
(
BaselineService
.
class
,
MetricConfigManager
.
class
,
ProductLineConfigManager
.
class
,
MetricGroupConfigManager
.
class
,
AlertInfo
.
class
));
all
.
add
(
C
(
NetworkGraphCreator
.
class
).
req
(
CachedMetricReportService
.
class
,
DataExtractor
.
class
,
MetricDataFetcher
.
class
).
req
(
BaselineService
.
class
,
MetricConfigManager
.
class
,
ProductLineConfigManager
.
class
,
MetricGroupConfigManager
.
class
,
AlertInfo
.
class
));
// report serivce
all
.
addAll
(
new
ReportServiceComponentConfigurator
().
defineComponents
());
// task
all
.
addAll
(
new
TaskComponentConfigurator
().
defineComponents
());
// model service
all
.
addAll
(
new
ServiceComponentConfigurator
().
defineComponents
());
all
.
add
(
C
(
RemoteMetricReportService
.
class
).
req
(
ServerConfigManager
.
class
));
all
.
add
(
C
(
BusinessAlertConfig
.
class
).
req
(
AlertConfigManager
.
class
));
all
.
add
(
C
(
NetworkAlertConfig
.
class
).
req
(
AlertConfigManager
.
class
));
all
.
add
(
C
(
SystemAlertConfig
.
class
).
req
(
AlertConfigManager
.
class
));
all
.
add
(
C
(
ExceptionAlertConfig
.
class
).
req
(
AlertConfigManager
.
class
));
all
.
add
(
C
(
AlertInfo
.
class
));
all
.
add
(
C
(
DefaultMailImpl
.
class
).
req
(
ServerConfigManager
.
class
));
all
.
add
(
C
(
DataChecker
.
class
,
DefaultDataChecker
.
class
));
all
.
add
(
C
(
BusinessAlert
.
class
).
req
(
MetricConfigManager
.
class
,
ProductLineConfigManager
.
class
,
BaselineService
.
class
,
MailSMS
.
class
,
BusinessAlertConfig
.
class
,
AlertInfo
.
class
,
AlertDao
.
class
)
//
.
req
(
RemoteMetricReportService
.
class
,
BusinessRuleConfigManager
.
class
,
DataChecker
.
class
));
all
.
add
(
C
(
NetworkAlert
.
class
).
req
(
MetricConfigManager
.
class
,
ProductLineConfigManager
.
class
,
BaselineService
.
class
,
MailSMS
.
class
,
NetworkAlertConfig
.
class
,
AlertInfo
.
class
,
AlertDao
.
class
)
//
.
req
(
RemoteMetricReportService
.
class
,
NetworkRuleConfigManager
.
class
,
DataChecker
.
class
));
all
.
add
(
C
(
SystemAlert
.
class
).
req
(
MetricConfigManager
.
class
,
ProductLineConfigManager
.
class
,
BaselineService
.
class
,
MailSMS
.
class
,
SystemAlertConfig
.
class
,
AlertInfo
.
class
,
AlertDao
.
class
)
//
.
req
(
RemoteMetricReportService
.
class
,
SystemRuleConfigManager
.
class
,
DataChecker
.
class
));
all
.
add
(
C
(
AlertExceptionBuilder
.
class
).
req
(
ExceptionConfigManager
.
class
));
all
.
add
(
C
(
ExceptionAlert
.
class
).
req
(
ProjectDao
.
class
,
ExceptionAlertConfig
.
class
,
MailSMS
.
class
,
ExceptionConfigManager
.
class
,
AlertExceptionBuilder
.
class
,
AlertDao
.
class
).
req
(
ModelService
.
class
,
TopAnalyzer
.
ID
));
all
.
add
(
C
(
NetGraphConfigManager
.
class
).
req
(
ConfigDao
.
class
));
// database
all
.
add
(
C
(
JdbcDataSourceDescriptorManager
.
class
)
//
.
config
(
E
(
"datasourceFile"
).
value
(
"/data/appdatas/cat/datasources.xml"
)));
all
.
addAll
(
new
CatDatabaseConfigurator
().
defineComponents
());
all
.
addAll
(
new
UserDatabaseConfigurator
().
defineComponents
());
// update project database
all
.
add
(
C
(
ProjectUpdateTask
.
class
)
//
.
req
(
ProjectDao
.
class
,
HostinfoDao
.
class
));
// web, please keep it last
all
.
addAll
(
new
WebComponentConfigurator
().
defineComponents
());
// for alarm module
all
.
addAll
(
new
AlarmComponentConfigurator
().
defineComponents
());
return
all
;
}
...
...
cat-home/src/main/java/com/dianping/cat/report/view/NavigationBar.java
浏览文件 @
1a864c3c
...
...
@@ -27,6 +27,8 @@ public class NavigationBar {
ReportPage
.
USERMONITOR
,
ReportPage
.
APP
,
ReportPage
.
TRANSACTION
,
ReportPage
.
EVENT
,
...
...
cat-home/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
1a864c3c
此差异已折叠。
点击以展开。
cat-home/src/test/java/com/dianping/cat/report/analyzer/TopologyGraphTest.java
浏览文件 @
1a864c3c
package
com.dianping.cat.report.analyzer
;
import
java.
text.ParseException
;
import
java.
io.File
;
import
java.text.SimpleDateFormat
;
import
org.junit.Test
;
import
org.unidal.eunit.helper.Files
;
import
org.unidal.lookup.ComponentTestCase
;
import
com.dianping.cat.consumer.metric.ProductLineConfigManager
;
import
com.dianping.cat.home.dependency.graph.entity.TopologyGraph
;
import
com.dianping.cat.report.page.dependency.graph.TopologyGraphManager
;
public
class
TopologyGraphTest
extends
ComponentTestCase
{
public
class
TopologyGraphTest
extends
ComponentTestCase
{
@Test
public
void
test
()
throws
ParseException
{
public
void
test
()
throws
Exception
{
build
(
"2014-07-06 18:00"
);
build
(
"2014-07-06 18:01"
);
build
(
"2014-07-06 18:02"
);
build
(
"2014-07-06 18:03"
);
build
(
"2014-07-06 18:04"
);
build
(
"2014-07-06 18:05"
);
build
(
"2014-07-06 18:06"
);
build
(
"2014-07-06 18:07"
);
build
(
"2014-07-06 18:08"
);
build
(
"2014-07-06 18:09"
);
}
public
void
build
(
String
date
)
throws
Exception
{
TopologyGraphManager
manager
=
lookup
(
TopologyGraphManager
.
class
);
String
date
=
"2014-07-06 18:00"
;
SimpleDateFormat
formate
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
);
TopologyGraph
graph
=
manager
.
queryGraphFromDB
(
formate
.
parse
(
date
).
getTime
());
System
.
out
.
println
(
graph
);
}
@Test
public
void
test1
(){
ProductLineConfigManager
manager
=
lookup
(
ProductLineConfigManager
.
class
);
System
.
out
.
println
(
manager
.
getCompany
());
try
{
TopologyGraph
graph
=
manager
.
queryGraphFromDB
(
formate
.
parse
(
date
).
getTime
());
if
(
graph
!=
null
)
{
File
file
=
new
File
(
"/tmp/"
+
date
+
".txt"
);
if
(!
file
.
exists
())
{
file
.
createNewFile
();
}
Files
.
forIO
().
writeTo
(
file
,
graph
.
toString
());
}
else
{
System
.
err
.
println
(
date
+
" is null1"
);
}
}
catch
(
Exception
e
)
{
System
.
err
.
println
(
date
+
" is null1"
);
}
}
}
cat-maven-plugin/src/main/java/com/dianping/cat/plugin/InstallMojo.java
浏览文件 @
1a864c3c
...
...
@@ -217,7 +217,7 @@ public class InstallMojo extends AbstractMojo {
}
});
m_user
=
PropertyProviders
.
fromConsole
().
forString
(
"jdbc.user"
,
"Please input username:"
,
null
,
null
,
null
);
m_password
=
PropertyProviders
.
fromConsole
().
forString
(
"jdbc.password"
,
"Please input password:"
,
null
,
null
,
m_password
=
PropertyProviders
.
fromConsole
().
forString
(
"jdbc.password"
,
"Please input password:"
,
null
,
""
,
null
);
}
}
\ No newline at end of file
cat-maven-plugin/src/main/resources/com/dianping/cat/plugin/Cat.sql
浏览文件 @
1a864c3c
use
cat
;
CREATE
TABLE
`DP_AdminLogin`
(
`LoginID`
int
(
10
)
unsigned
NOT
NULL
AUTO_INCREMENT
,
`AdminID`
int
(
10
)
DEFAULT
NULL
,
`LoginName`
varchar
(
128
)
DEFAULT
NULL
COMMENT
'登陆名'
,
`Password`
varchar
(
128
)
DEFAULT
NULL
COMMENT
'密码'
,
`Email`
varchar
(
128
)
DEFAULT
NULL
COMMENT
'邮箱'
,
`RealName`
varchar
(
128
)
DEFAULT
NULL
COMMENT
'真实姓名'
,
`MobileNo`
varchar
(
128
)
DEFAULT
NULL
COMMENT
'手机号码'
,
PRIMARY
KEY
(
`LoginID`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'用户信息表'
;
CREATE
TABLE
`dailygraph`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`name`
varchar
(
20
)
NOT
NULL
COMMENT
'报表名称'
,
`ip`
varchar
(
2
0
)
NULL
COMMENT
'报表来自于哪台cat-client机器ip, 空串表示合并同domain所有ip'
,
`ip`
varchar
(
5
0
)
NULL
COMMENT
'报表来自于哪台cat-client机器ip, 空串表示合并同domain所有ip'
,
`domain`
varchar
(
50
)
NOT
NULL
COMMENT
'报表处理的Domain信息'
,
`period`
datetime
NOT
NULL
COMMENT
'报表时间段'
,
`type`
tinyint
(
4
)
NOT
NULL
COMMENT
'报表数据格式, 1/xml, 2/json, 3/csv, 默认3'
,
...
...
@@ -28,7 +17,7 @@ CREATE TABLE `dailygraph` (
CREATE
TABLE
`dailyreport`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`name`
varchar
(
20
)
NOT
NULL
COMMENT
'报表名称, transaction, problem...'
,
`ip`
varchar
(
2
0
)
NOT
NULL
COMMENT
'报表来自于哪台cat-consumer机器'
,
`ip`
varchar
(
5
0
)
NOT
NULL
COMMENT
'报表来自于哪台cat-consumer机器'
,
`domain`
varchar
(
50
)
NOT
NULL
COMMENT
'报表处理的Domain信息'
,
`period`
datetime
NOT
NULL
COMMENT
'报表时间段'
,
`type`
tinyint
(
4
)
NOT
NULL
COMMENT
'报表数据格式, 1/xml, 2/json, 默认1'
,
...
...
@@ -41,7 +30,7 @@ CREATE TABLE `dailyreport` (
CREATE
TABLE
`weeklyreport`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`name`
varchar
(
20
)
NOT
NULL
COMMENT
'报表名称, transaction, problem...'
,
`ip`
varchar
(
2
0
)
NOT
NULL
COMMENT
'报表来自于哪台cat-consumer机器'
,
`ip`
varchar
(
5
0
)
NOT
NULL
COMMENT
'报表来自于哪台cat-consumer机器'
,
`domain`
varchar
(
50
)
NOT
NULL
COMMENT
'报表处理的Domain信息'
,
`period`
datetime
NOT
NULL
COMMENT
'报表时间段'
,
`type`
tinyint
(
4
)
NOT
NULL
COMMENT
'报表数据格式, 1/xml, 2/json, 默认1'
,
...
...
@@ -54,7 +43,7 @@ CREATE TABLE `weeklyreport` (
CREATE
TABLE
`monthreport`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`name`
varchar
(
20
)
NOT
NULL
COMMENT
'报表名称, transaction, problem...'
,
`ip`
varchar
(
2
0
)
NOT
NULL
COMMENT
'报表来自于哪台cat-consumer机器'
,
`ip`
varchar
(
5
0
)
NOT
NULL
COMMENT
'报表来自于哪台cat-consumer机器'
,
`domain`
varchar
(
50
)
NOT
NULL
COMMENT
'报表处理的Domain信息'
,
`period`
datetime
NOT
NULL
COMMENT
'报表时间段'
,
`type`
tinyint
(
4
)
NOT
NULL
COMMENT
'报表数据格式, 1/xml, 2/json, 默认1'
,
...
...
@@ -67,7 +56,7 @@ CREATE TABLE `monthreport` (
CREATE
TABLE
`graph`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`name`
varchar
(
20
)
NOT
NULL
COMMENT
'报表名称'
,
`ip`
varchar
(
2
0
)
NULL
COMMENT
'报表来自于哪台cat-client机器ip, NULL表示合并同domain所有ip'
,
`ip`
varchar
(
5
0
)
NULL
COMMENT
'报表来自于哪台cat-client机器ip, NULL表示合并同domain所有ip'
,
`domain`
varchar
(
50
)
NOT
NULL
COMMENT
'报表处理的Domain信息'
,
`period`
datetime
NOT
NULL
COMMENT
'报表时间段'
,
`type`
tinyint
(
4
)
NOT
NULL
COMMENT
'报表数据格式, 1/xml, 2/json, 3/csv, 默认3'
,
...
...
@@ -81,33 +70,23 @@ CREATE TABLE `graph` (
CREATE
TABLE
`hostinfo`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`ip`
varchar
(
50
)
NOT
NULL
COMMENT
'部署机器IP'
,
`domain`
varchar
(
50
)
NOT
NULL
COMMENT
'部署机器对应的项目名'
,
`domain`
varchar
(
256
)
NOT
NULL
COMMENT
'部署机器对应的项目名'
,
`hostname`
varchar
(
256
)
DEFAULT
NULL
COMMENT
'机器域名'
,
`creation_date`
datetime
NOT
NULL
,
`last_modified_date`
datetime
NOT
NULL
,
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`ip_index`
(
`ip`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'IP和项目名的对应关系'
;
CREATE
TABLE
`location`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`lat`
double
NOT
NULL
,
`lng`
double
NOT
NULL
,
`total`
int
(
11
)
NOT
NULL
,
`transaction_date`
datetime
NOT
NULL
,
`creation_date`
datetime
NOT
NULL
,
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`transaction_date_lat_lng`
(
`transaction_date`
,
`lat`
,
`lng`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'用于热点图地理位置表'
;
CREATE
TABLE
`report`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`type`
tinyint
(
4
)
NOT
NULL
COMMENT
'报表类型, 1/xml, 9/binary 默认1'
,
`name`
varchar
(
20
)
NOT
NULL
COMMENT
'报表名称'
,
`ip`
varchar
(
2
0
)
DEFAULT
NULL
COMMENT
'报表来自于哪台机器'
,
`ip`
varchar
(
5
0
)
DEFAULT
NULL
COMMENT
'报表来自于哪台机器'
,
`domain`
varchar
(
50
)
NOT
NULL
COMMENT
'报表项目'
,
`period`
timestamp
NOT
NULL
COMMENT
'报表时间段'
,
`content`
longtext
NULL
,
`creation_date`
timestamp
NOT
NULL
DEFAULT
'0000-00-00 00:00:00'
COMMENT
'报表创建时间'
,
`creation_date`
timestamp
NOT
NULL
COMMENT
'报表创建时间'
,
PRIMARY
KEY
(
`id`
),
KEY
`IX_Domain_Name_Period`
(
`domain`
,
`name`
,
`period`
),
KEY
`IX_Name_Period`
(
`name`
,
`period`
),
...
...
@@ -146,39 +125,16 @@ CREATE TABLE `businessReport` (
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`type`
tinyint
(
4
)
NOT
NULL
COMMENT
'报表类型 报表数据格式, 1/Binary, 2/xml , 3/json'
,
`name`
varchar
(
20
)
NOT
NULL
COMMENT
'报表名称'
,
`ip`
varchar
(
2
0
)
NOT
NULL
COMMENT
'报表来自于哪台机器'
,
`ip`
varchar
(
5
0
)
NOT
NULL
COMMENT
'报表来自于哪台机器'
,
`productLine`
varchar
(
50
)
NOT
NULL
COMMENT
'指标来源于哪个产品组'
,
`period`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
COMMENT
'报表时间段'
,
`content`
longblob
COMMENT
'用于存放报表的具体内容'
,
`creation_date`
timestamp
NOT
NULL
DEFAULT
'0000-00-00 00:00:00'
COMMENT
'报表创建时间'
,
`creation_date`
timestamp
NOT
NULL
COMMENT
'报表创建时间'
,
PRIMARY
KEY
(
`id`
),
KEY
`IX_Group_Name_Period`
(
`productLine`
,
`name`
,
`period`
),
KEY
`IX_Name_Period`
(
`name`
,
`period`
),
KEY
`IX_Period`
(
`period`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
106
DEFAULT
CHARSET
=
utf8
ROW_FORMAT
=
COMPRESSED
COMMENT
=
'用于存放业务监控实时报表信息,处理之后的结果'
;
CREATE
TABLE
`sqlreport`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`domain`
varchar
(
50
)
NOT
NULL
,
`name`
varchar
(
100
)
NOT
NULL
COMMENT
'SQL的名称'
,
`statement`
varchar
(
3000
)
NOT
NULL
COMMENT
'SQL的具体描述'
,
`total_count`
int
(
11
)
NOT
NULL
COMMENT
'总数'
,
`failure_count`
int
(
11
)
NOT
NULL
COMMENT
'错误数目'
,
`long_sqls`
int
(
11
)
NOT
NULL
COMMENT
'longsql的数目'
,
`min_value`
double
NOT
NULL
COMMENT
'最小值'
,
`max_value`
double
NOT
NULL
COMMENT
'最大值'
,
`avg2_value`
double
NOT
NULL
COMMENT
'90%的平均值'
,
`sum_value`
double
NOT
NULL
COMMENT
'和'
,
`sum2_value`
double
NOT
NULL
COMMENT
'平方和'
,
`sample_link`
varchar
(
64
)
NOT
NULL
COMMENT
'链接'
,
`transaction_date`
datetime
NOT
NULL
COMMENT
'SQL的时间段'
,
`creation_date`
datetime
NOT
NULL
COMMENT
'数据库创建时间'
,
`duration_distribution`
varchar
(
512
)
NOT
NULL
COMMENT
'SQL处理的时间分布信息'
,
`hits_over_time`
varchar
(
512
)
NOT
NULL
COMMENT
'SQL在当前一个小时处理信息'
,
`duration_over_time`
varchar
(
512
)
NOT
NULL
COMMENT
'SQL处理时间的信息'
,
`failure_over_time`
varchar
(
512
)
NOT
NULL
COMMENT
'在一个小时内的错误分布'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'用于存放Hadoop处理的SQL报表信息'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
ROW_FORMAT
=
COMPRESSED
COMMENT
=
'用于存放业务监控实时报表信息,处理之后的结果'
;
CREATE
TABLE
`sqltable`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
...
...
@@ -276,29 +232,29 @@ CREATE TABLE `scheduledReportSubscription` (
CREATE
TABLE
`project`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`domain`
varchar
(
50
)
NOT
NULL
COMMENT
'项目名称'
,
`domain`
varchar
(
256
)
NOT
NULL
COMMENT
'项目名称'
,
`cmdb_domain`
varchar
(
256
)
DEFAULT
NULL
COMMENT
'cmdb项目名称'
,
`project_line`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'关联产品线名称'
,
`department`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'关联项目组名称'
,
`owner`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'项目负责人'
,
`email`
varchar
(
200
)
DEFAULT
NULL
COMMENT
'项目组邮件'
,
`email`
varchar
(
256
)
DEFAULT
NULL
COMMENT
'项目组邮件'
,
`phone`
varchar
(
256
)
DEFAULT
NULL
COMMENT
'联系电话'
,
`creation_date`
datetime
DEFAULT
NULL
COMMENT
'创建时间'
,
`modify_date`
datetime
DEFAULT
NULL
COMMENT
'修改时间'
,
PRIMARY
KEY
(
`id`
)
PRIMARY
KEY
(
`id`
),
KEY
`domain`
(
`domain`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'项目基本信息'
;
CREATE
TABLE
`
event
`
(
CREATE
TABLE
`
topologyGraph
`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`type`
int
(
11
)
NOT
NULL
COMMENT
'1、运维系统告警,2、DB告警,3、CAT内容告警'
,
`link`
varchar
(
500
)
DEFAULT
NULL
COMMENT
'详细信息link'
,
`domain`
varchar
(
50
)
CHARACTER
SET
utf8
COLLATE
utf8_bin
DEFAULT
NULL
,
`ip`
varchar
(
32
)
DEFAULT
NULL
COMMENT
'错误机器IP'
,
`subject`
varchar
(
200
)
DEFAULT
NULL
COMMENT
'事件标题'
,
`content`
text
COMMENT
'事件内容'
,
`date`
datetime
NOT
NULL
COMMENT
'事件发生时间'
,
`creation_date`
datetime
NOT
NULL
COMMENT
'记录创建时间'
,
`ip`
varchar
(
50
)
NOT
NULL
COMMENT
'报表来自于哪台cat-client机器ip'
,
`period`
datetime
NOT
NULL
COMMENT
'报表时间段,精确到分钟'
,
`type`
tinyint
(
4
)
NOT
NULL
COMMENT
'报表数据格式, 1/xml, 2/json, 3/binary'
,
`content`
longblob
COMMENT
'用于存放报表的具体内容'
,
`creation_date`
datetime
NOT
NULL
COMMENT
'报表创建时间'
,
PRIMARY
KEY
(
`id`
),
KEY
`
ix_date_domain`
(
`date`
,
`domain
`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
23106
DEFAULT
CHARSET
=
utf8
COMMENT
=
'事件记录表
'
;
KEY
`
period`
(
`period
`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'用于存储历史的拓扑图曲线
'
;
CREATE
TABLE
`config`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
...
...
@@ -310,67 +266,19 @@ CREATE TABLE `config` (
KEY
`name`
(
`name`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'用于存储系统的全局配置信息'
;
CREATE
TABLE
`abtest`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'ID'
,
`name`
varchar
(
45
)
NOT
NULL
COMMENT
'名字'
,
`owner`
varchar
(
45
)
NOT
NULL
COMMENT
'case的Owner'
,
`group_strategy`
int
(
11
)
DEFAULT
NULL
COMMENT
'分组策略ID'
,
`domains`
varchar
(
200
)
DEFAULT
NULL
COMMENT
'Domains,逗号分割'
,
`creation_date`
datetime
DEFAULT
NULL
COMMENT
'创建时间'
,
`modified_date`
datetime
DEFAULT
NULL
COMMENT
'上次修改时间'
,
`description`
varchar
(
512
)
DEFAULT
NULL
COMMENT
'描述'
,
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`idx_name`
(
`name`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'AB测试内容'
;
CREATE
TABLE
`abtest_report`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`run_id`
int
(
11
)
DEFAULT
NULL
,
`period`
datetime
DEFAULT
NULL
,
`content`
text
,
`creation_date`
datetime
DEFAULT
NULL
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'AB测试报表'
;
CREATE
TABLE
`abtest_run`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'ID'
,
`creator`
varchar
(
45
)
DEFAULT
NULL
COMMENT
'Creator'
,
`case_id`
int
(
11
)
NOT
NULL
COMMENT
'Case ID'
,
`start_date`
datetime
DEFAULT
NULL
COMMENT
'开始时间'
,
`end_date`
datetime
DEFAULT
NULL
COMMENT
'结束时间'
,
`disabled`
tinyint
(
4
)
NOT
NULL
COMMENT
'是否有效'
,
`domains`
varchar
(
100
)
NOT
NULL
COMMENT
'属于的domain,用逗号分割'
,
`conditions`
text
,
`java_fragement`
text
,
`conversion_goals`
text
,
`strategy_configuration`
text
COMMENT
'策略配置'
,
`creation_date`
datetime
NOT
NULL
COMMENT
'创建时间'
,
`modified_date`
datetime
NOT
NULL
COMMENT
'上次修改时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'AB测试运行实例'
;
CREATE
TABLE
`group_strategy`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`name`
varchar
(
100
)
NOT
NULL
COMMENT
'GroupStrategy的名字'
,
`class_name`
varchar
(
100
)
NOT
NULL
COMMENT
'GroupStrategy的英文名'
,
`fully_qualified_name`
varchar
(
100
)
NOT
NULL
COMMENT
'GroupStrategy的class名字'
,
`descriptor`
text
COMMENT
'配置的schema'
,
`status`
tinyint
(
4
)
NOT
NULL
COMMENT
'是否开/关,1是开,0是关'
,
`description`
varchar
(
512
)
DEFAULT
NULL
COMMENT
'描述'
,
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`name_UNIQUE`
(
`name`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'用于记录分组策略'
;
CREATE
TABLE
`topologyGraph`
(
CREATE
TABLE
`event`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`ip`
varchar
(
20
)
DEFAULT
NULL
COMMENT
'报表来自于哪台cat-client机器ip'
,
`period`
datetime
NOT
NULL
COMMENT
'报表时间段,精确到分钟'
,
`type`
tinyint
(
4
)
NOT
NULL
COMMENT
'报表数据格式, 1/xml, 2/json, 3/binary'
,
`content`
longblob
COMMENT
'用于存放报表的具体内容'
,
`creation_date`
datetime
NOT
NULL
COMMENT
'报表创建时间'
,
`type`
int
(
11
)
NOT
NULL
COMMENT
'1、运维系统告警,2、DB告警,3、CAT内容告警'
,
`link`
varchar
(
500
)
DEFAULT
NULL
COMMENT
'详细信息link'
,
`domain`
varchar
(
50
)
CHARACTER
SET
utf8
COLLATE
utf8_bin
DEFAULT
NULL
,
`ip`
varchar
(
32
)
DEFAULT
NULL
COMMENT
'错误机器IP'
,
`subject`
varchar
(
200
)
DEFAULT
NULL
COMMENT
'事件标题'
,
`content`
text
COMMENT
'事件内容'
,
`date`
datetime
NOT
NULL
COMMENT
'事件发生时间'
,
`creation_date`
datetime
NOT
NULL
COMMENT
'记录创建时间'
,
PRIMARY
KEY
(
`id`
),
KEY
`
period`
(
`period
`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
21912
DEFAULT
CHARSET
=
utf8
COMMENT
=
'用于存储历史的拓扑图曲线
'
;
KEY
`
ix_date_domain`
(
`date`
,
`domain
`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'事件记录表
'
;
CREATE
TABLE
`baseline`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
...
...
@@ -382,14 +290,69 @@ CREATE TABLE `baseline` (
PRIMARY
KEY
(
`id`
),
KEY
`ix_indexkey_reportperiod`
(
`index_key`
,
`report_period`
),
KEY
`ix_reportperiod`
(
`report_period`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
5062
DEFAULT
CHARSET
=
utf8
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
CREATE
TABLE
`user_agent`
(
`id`
int
(
11
)
unsigned
NOT
NULL
AUTO_INCREMENT
,
`userAgent`
varchar
(
200
)
NOT
NULL
DEFAULT
''
,
`browser`
varchar
(
100
)
DEFAULT
''
,
`version`
varchar
(
100
)
DEFAULT
''
,
`os`
varchar
(
100
)
DEFAULT
''
,
CREATE
TABLE
`alteration`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增长ID'
,
`type`
varchar
(
64
)
NOT
NULL
COMMENT
'分类'
,
`title`
varchar
(
128
)
NOT
NULL
COMMENT
'变更标题'
,
`domain`
varchar
(
128
)
NOT
NULL
COMMENT
'变更项目'
,
`hostname`
varchar
(
128
)
NOT
NULL
COMMENT
'变更机器名'
,
`ip`
varchar
(
128
)
DEFAULT
NULL
COMMENT
'变更机器IP'
,
`date`
datetime
NOT
NULL
COMMENT
'变更时间'
,
`user`
varchar
(
45
)
NOT
NULL
COMMENT
'变更用户'
,
`alt_group`
varchar
(
45
)
DEFAULT
NULL
COMMENT
'变更组别'
,
`content`
text
NOT
NULL
COMMENT
'变更内容'
,
`url`
varchar
(
200
)
DEFAULT
NULL
COMMENT
'变更链接'
,
`creation_date`
datetime
NOT
NULL
COMMENT
'数据库创建时间'
,
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`userAgent`
(
`userAgent`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
KEY
`ind_date_domain_host`
(
`date`
,
`domain`
,
`hostname`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
1241
DEFAULT
CHARSET
=
utf8
COMMENT
=
'变更表'
;
CREATE
TABLE
`alert`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增长ID'
,
`domain`
varchar
(
128
)
NOT
NULL
COMMENT
'告警项目'
,
`alert_time`
datetime
NOT
NULL
COMMENT
'告警时间'
,
`category`
varchar
(
64
)
NOT
NULL
COMMENT
'告警分类:network/business/system/exception -alert'
,
`type`
varchar
(
64
)
NOT
NULL
COMMENT
'告警类型:error/warning'
,
`content`
text
NOT
NULL
COMMENT
'告警内容'
,
`metric`
varchar
(
128
)
NOT
NULL
COMMENT
'告警指标'
,
`creation_date`
datetime
NOT
NULL
COMMENT
'数据插入时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'存储告警信息'
;
CREATE
TABLE
`alert_summary`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增长ID'
,
`domain`
varchar
(
128
)
NOT
NULL
COMMENT
'告警项目'
,
`alert_time`
datetime
NOT
NULL
COMMENT
'告警时间'
,
`content`
text
NOT
NULL
COMMENT
'统一告警内容'
,
`creation_date`
datetime
NOT
NULL
COMMENT
'数据插入时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'统一告警信息'
;
CREATE
TABLE
`app_data_command`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增长ID'
,
`period`
date
NOT
NULL
COMMENT
'时间'
,
`minute_order`
smallint
NOT
NULL
COMMENT
'分钟'
,
`city`
smallint
NOT
NULL
COMMENT
'城市'
,
`operator`
tinyint
NOT
NULL
COMMENT
'运营商'
,
`network`
tinyint
NOT
NULL
COMMENT
'网络类型'
,
`app_version`
smallint
NOT
NULL
COMMENT
'版本'
,
`connnect_type`
tinyint
NOT
NULL
COMMENT
'访问类型,是否长连接'
,
`code`
smallint
NOT
NULL
COMMENT
'返回码'
,
`platform`
tinyint
NOT
NULL
COMMENT
'平台'
,
`access_number`
bigint
NOT
NULL
COMMENT
'访问量'
,
`response_sum_time`
bigint
NOT
NULL
COMMENT
'响应时间大小'
,
`request_package`
bigint
NOT
NULL
COMMENT
'请求包大小'
,
`response_package`
bigint
NOT
NULL
COMMENT
'响应包大小'
,
`status`
smallint
NOT
NULL
COMMENT
'数据状态'
,
`creation_date`
datetime
NOT
NULL
COMMENT
'数据插入时间'
,
PRIMARY
KEY
(
`id`
),
KEY
IX_period_city_minute
(
period
,
city
,
minute_order
),
KEY
IX_period_operator_minute
(
period
,
network
,
minute_order
),
KEY
IX_period_network_minute
(
period
,
network
,
minute_order
),
KEY
IX_period_version_minute
(
period
,
app_version
,
minute_order
),
KEY
IX_period_connnect_minute
(
period
,
connnect_type
,
minute_order
),
KEY
IX_period_platform_minute
(
period
,
platform
,
minute_order
),
KEY
IX_period_code_minute
(
period
,
code
,
minute_order
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'app基本数据'
;
\ No newline at end of file
pom.xml
浏览文件 @
1a864c3c
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
parent
</artifactId>
<version>
1.0.5
</version>
<name>
parent
</name>
<description>
Central Application Tracking
</description>
<packaging>
pom
</packaging>
<modules>
<module>
cat-client
</module>
<module>
cat-core
</module>
<module>
cat-consumer
</module>
<module>
cat-hadoop
</module>
<module>
cat-consumer-advanced
</module>
<module>
cat-home
</module>
<module>
cat-broker
</module>
<module>
cat-agent
</module>
<module>
IPService
</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
cat-client
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
cat-core
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
cat-hadoop
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
cat-consumer
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
cat-consumer-advanced
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.8.1
</version>
</dependency>
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
jetty
</artifactId>
<version>
6.1.14
</version>
</dependency>
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
jetty-util
</artifactId>
<version>
6.1.14
</version>
</dependency>
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
jsp-api-2.1
</artifactId>
<version>
6.1.14
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
jsp-2.1
</artifactId>
<version>
6.1.14
</version>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
servlet-api
</artifactId>
<version>
2.5
</version>
</dependency>
<dependency>
<groupId>
javax.servlet.jsp
</groupId>
<artifactId>
jsp-api
</artifactId>
<version>
2.1
</version>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
5.1.20
</version>
</dependency>
<dependency>
<groupId>
org.jboss.netty
</groupId>
<artifactId>
netty
</artifactId>
<version>
3.2.7.Final
</version>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
1.6
</version>
</dependency>
<dependency>
<groupId>
log4j
</groupId>
<artifactId>
log4j
</artifactId>
<version>
1.2.14
</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
2.5.1
</version>
<configuration>
<source>
1.6
</source>
<target>
1.6
</target>
</configuration>
</plugin>
<plugin>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
2.9
</version>
<configuration>
<includes>
<include>
**/AllTests.java
</include>
</includes>
<!-- <debugForkedProcess>-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE</debugForkedProcess> -->
</configuration>
<dependencies>
<dependency>
<groupId>
org.apache.maven.surefire
</groupId>
<artifactId>
surefire-junit47
</artifactId>
<version>
2.9
</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>
maven-eclipse-plugin
</artifactId>
<version>
2.9
</version>
<configuration>
<downloadSources>
true
</downloadSources>
<ajdtVersion>
none
</ajdtVersion>
<additionalConfig>
<file>
<name>
.settings/org.eclipse.jdt.core.prefs
</name>
<content>
<![CDATA[
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
]]>
</content>
</file>
<file>
<name>
.settings/org.eclipse.core.resources.prefs
</name>
<content>
<![CDATA[
eclipse.preferences.version=1
encoding/<project>
=UTF-8
]]>
</content>
</file>
</additionalConfig>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>
maven-source-plugin
</artifactId>
<version>
2.2
</version>
<executions>
<execution>
<id>
attach-sources
</id>
<phase>
package
</phase>
<goals>
<goal>
jar-no-fork
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
cat-maven-plugin
</artifactId>
<version>
1.0.5
</version>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>
central
</id>
<name>
Maven2 Central Repository
</name>
<layout>
default
</layout>
<url>
http://repo1.maven.org/maven2
</url>
</repository>
<repository>
<id>
cat.repo
</id>
<url>
https://raw.github.com/dianping/cat/mvn-repo
</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>
central
</id>
<url>
http://repo1.maven.org/maven2
</url>
</pluginRepository>
<pluginRepository>
<id>
cat.repo
</id>
<url>
https://raw.github.com/dianping/cat/mvn-repo
</url>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>
dianping.repo
</id>
<url>
http://mvn.dianpingoa.com/dianping-releases
</url>
</repository>
<snapshotRepository>
<id>
dianping.repo.snapshots
</id>
<url>
http://mvn.dianpingoa.com/dianping-snapshots
</url>
</snapshotRepository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>
utf-8
</project.build.sourceEncoding>
</properties>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
parent
</artifactId>
<version>
1.0.5
</version>
<name>
parent
</name>
<description>
Central Application Tracking
</description>
<packaging>
pom
</packaging>
<modules>
<module>
cat-client
</module>
<module>
cat-core
</module>
<module>
cat-consumer
</module>
<module>
cat-hadoop
</module>
<module>
cat-consumer-advanced
</module>
<module>
cat-home
</module>
<module>
cat-broker
</module>
<module>
cat-agent
</module>
<module>
cat-maven-plugin
</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
cat-client
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
cat-core
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
cat-hadoop
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
cat-consumer
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
cat-consumer-advanced
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.8.1
</version>
</dependency>
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
jetty
</artifactId>
<version>
6.1.14
</version>
</dependency>
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
jetty-util
</artifactId>
<version>
6.1.14
</version>
</dependency>
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
jsp-api-2.1
</artifactId>
<version>
6.1.14
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
jsp-2.1
</artifactId>
<version>
6.1.14
</version>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
servlet-api
</artifactId>
<version>
2.5
</version>
</dependency>
<dependency>
<groupId>
javax.servlet.jsp
</groupId>
<artifactId>
jsp-api
</artifactId>
<version>
2.1
</version>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
5.1.20
</version>
</dependency>
<dependency>
<groupId>
org.jboss.netty
</groupId>
<artifactId>
netty
</artifactId>
<version>
3.2.7.Final
</version>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
1.6
</version>
</dependency>
<dependency>
<groupId>
log4j
</groupId>
<artifactId>
log4j
</artifactId>
<version>
1.2.14
</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
2.5.1
</version>
<configuration>
<source>
1.6
</source>
<target>
1.6
</target>
</configuration>
</plugin>
<plugin>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
2.9
</version>
<configuration>
<includes>
<include>
**/AllTests.java
</include>
</includes>
<!-- <debugForkedProcess>-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE</debugForkedProcess> -->
</configuration>
<dependencies>
<dependency>
<groupId>
org.apache.maven.surefire
</groupId>
<artifactId>
surefire-junit47
</artifactId>
<version>
2.9
</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>
maven-eclipse-plugin
</artifactId>
<version>
2.9
</version>
<configuration>
<downloadSources>
true
</downloadSources>
<ajdtVersion>
none
</ajdtVersion>
<additionalConfig>
<file>
<name>
.settings/org.eclipse.jdt.core.prefs
</name>
<content>
<![CDATA[
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
]]>
</content>
</file>
<file>
<name>
.settings/org.eclipse.core.resources.prefs
</name>
<content>
<![CDATA[
eclipse.preferences.version=1
encoding/<project>
=UTF-8
]]>
</content>
</file>
</additionalConfig>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>
maven-source-plugin
</artifactId>
<version>
2.2
</version>
<executions>
<execution>
<id>
attach-sources
</id>
<phase>
package
</phase>
<goals>
<goal>
jar-no-fork
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
cat-maven-plugin
</artifactId>
<version>
1.0.5
</version>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>
central
</id>
<name>
Maven2 Central Repository
</name>
<layout>
default
</layout>
<url>
http://repo1.maven.org/maven2
</url>
</repository>
<repository>
<id>
cat.repo
</id>
<url>
https://raw.github.com/dianping/cat/mvn-repo
</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>
central
</id>
<url>
http://repo1.maven.org/maven2
</url>
</pluginRepository>
<pluginRepository>
<id>
cat.repo
</id>
<url>
https://raw.github.com/dianping/cat/mvn-repo
</url>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>
dianping.repo
</id>
<url>
http://mvn.dianpingoa.com/dianping-releases
</url>
</repository>
<snapshotRepository>
<id>
dianping.repo.snapshots
</id>
<url>
http://mvn.dianpingoa.com/dianping-snapshots
</url>
</snapshotRepository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>
utf-8
</project.build.sourceEncoding>
</properties>
</project>
script/Cat.sql
浏览文件 @
1a864c3c
CREATE
DATABASE
cat
;
use
cat
;
CREATE
TABLE
`dailygraph`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`name`
varchar
(
20
)
NOT
NULL
COMMENT
'报表名称'
,
...
...
@@ -244,7 +240,7 @@ CREATE TABLE `project` (
`creation_date`
datetime
DEFAULT
NULL
COMMENT
'创建时间'
,
`modify_date`
datetime
DEFAULT
NULL
COMMENT
'修改时间'
,
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`domain`
(
`domain`
)
KEY
`domain`
(
`domain`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'项目基本信息'
;
CREATE
TABLE
`topologyGraph`
(
...
...
@@ -332,11 +328,10 @@ CREATE TABLE `alert_summary` (
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'统一告警信息'
;
CREATE
TABLE
`app_data_command`
(
CREATE
TABLE
`app_data_command
_1
`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'自增长ID'
,
`period`
date
NOT
NULL
COMMENT
'时间'
,
`minute_order`
smallint
NOT
NULL
COMMENT
'分钟'
,
`status`
smallint
NOT
NULL
COMMENT
'数据状态'
,
`city`
smallint
NOT
NULL
COMMENT
'城市'
,
`operator`
tinyint
NOT
NULL
COMMENT
'运营商'
,
`network`
tinyint
NOT
NULL
COMMENT
'网络类型'
,
...
...
@@ -344,10 +339,11 @@ CREATE TABLE `app_data_command` (
`connnect_type`
tinyint
NOT
NULL
COMMENT
'访问类型,是否长连接'
,
`code`
smallint
NOT
NULL
COMMENT
'返回码'
,
`platform`
tinyint
NOT
NULL
COMMENT
'平台'
,
`access_number`
long
NOT
NULL
COMMENT
'访问量'
,
`response_sum_time`
long
NOT
NULL
COMMENT
'响应时间大小'
,
`request_package`
long
NOT
NULL
COMMENT
'请求包大小'
,
`response_package`
long
NOT
NULL
COMMENT
'响应包大小'
,
`access_number`
bigint
NOT
NULL
COMMENT
'访问量'
,
`response_sum_time`
bigint
NOT
NULL
COMMENT
'响应时间大小'
,
`request_package`
bigint
NOT
NULL
COMMENT
'请求包大小'
,
`response_package`
bigint
NOT
NULL
COMMENT
'响应包大小'
,
`status`
smallint
NOT
NULL
COMMENT
'数据状态'
,
`creation_date`
datetime
NOT
NULL
COMMENT
'数据插入时间'
,
PRIMARY
KEY
(
`id`
),
KEY
IX_period_city_minute
(
period
,
city
,
minute_order
),
...
...
@@ -357,8 +353,4 @@ CREATE TABLE `app_data_command` (
KEY
IX_period_connnect_minute
(
period
,
connnect_type
,
minute_order
),
KEY
IX_period_platform_minute
(
period
,
platform
,
minute_order
),
KEY
IX_period_code_minute
(
period
,
code
,
minute_order
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'app基本数据'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'app基本数据'
;
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录