Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
77a1d759
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,发现更多精彩内容 >>
提交
77a1d759
编写于
11月 01, 2012
作者:
Y
youyong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify the cat nav
上级
f32f8280
变更
40
隐藏空白更改
内联
并排
Showing
40 changed file
with
714 addition
and
297 deletion
+714
-297
cat-consumer/src/main/java/com/dianping/cat/consumer/build/ComponentsConfigurator.java
...m/dianping/cat/consumer/build/ComponentsConfigurator.java
+4
-3
cat-consumer/src/main/java/com/dianping/cat/consumer/common/CommonAnalyzer.java
...java/com/dianping/cat/consumer/common/CommonAnalyzer.java
+128
-0
cat-consumer/src/main/java/com/dianping/cat/consumer/dump/DumpAnalyzer.java
...ain/java/com/dianping/cat/consumer/dump/DumpAnalyzer.java
+2
-3
cat-consumer/src/main/java/com/dianping/cat/consumer/dump/DumpUploader.java
...ain/java/com/dianping/cat/consumer/dump/DumpUploader.java
+6
-0
cat-consumer/src/main/resources/META-INF/dal/jdbc/report-codegen.xml
...r/src/main/resources/META-INF/dal/jdbc/report-codegen.xml
+35
-0
cat-consumer/src/main/resources/META-INF/dal/jdbc/report-dal.xml
...sumer/src/main/resources/META-INF/dal/jdbc/report-dal.xml
+19
-0
cat-consumer/src/main/resources/META-INF/plexus/components.xml
...onsumer/src/main/resources/META-INF/plexus/components.xml
+23
-1
cat-consumer/src/main/resources/META-INF/wizard/jdbc/wizard.xml
...nsumer/src/main/resources/META-INF/wizard/jdbc/wizard.xml
+1
-0
cat-core/src/main/java/com/dianping/cat/storage/dump/LocalMessageBucket.java
...ava/com/dianping/cat/storage/dump/LocalMessageBucket.java
+2
-3
cat-core/src/main/java/com/dianping/cat/storage/dump/LocalMessageBucketManager.java
.../dianping/cat/storage/dump/LocalMessageBucketManager.java
+119
-106
cat-core/src/main/java/com/dianping/cat/storage/dump/MessageBucket.java
...ain/java/com/dianping/cat/storage/dump/MessageBucket.java
+2
-1
cat-core/src/main/java/com/dianping/cat/storage/dump/MessageBucketManager.java
...a/com/dianping/cat/storage/dump/MessageBucketManager.java
+2
-1
cat-core/src/test/java/com/dianping/cat/storage/dump/LocalMessageBucketManagerTest.java
...nping/cat/storage/dump/LocalMessageBucketManagerTest.java
+5
-1
cat-core/src/test/java/com/dianping/cat/storage/dump/LocalMessageBucketTest.java
...com/dianping/cat/storage/dump/LocalMessageBucketTest.java
+6
-2
cat-hadoop/src/main/java/com/dianping/cat/hadoop/hdfs/HdfsMessageBucket.java
.../java/com/dianping/cat/hadoop/hdfs/HdfsMessageBucket.java
+1
-1
cat-hadoop/src/main/java/com/dianping/cat/hadoop/hdfs/HdfsMessageBucketManager.java
...om/dianping/cat/hadoop/hdfs/HdfsMessageBucketManager.java
+1
-1
cat-hadoop/src/test/java/com/dianping/cat/hadoop/hdfs/HdfsMessageBucketManagerTest.java
...ianping/cat/hadoop/hdfs/HdfsMessageBucketManagerTest.java
+4
-1
cat-home/pom.xml
cat-home/pom.xml
+1
-1
cat-home/src/main/java/com/dianping/cat/CatHomeModule.java
cat-home/src/main/java/com/dianping/cat/CatHomeModule.java
+2
-0
cat-home/src/main/java/com/dianping/cat/build/AlarmComponentConfigurator.java
...va/com/dianping/cat/build/AlarmComponentConfigurator.java
+1
-1
cat-home/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
...n/java/com/dianping/cat/build/ComponentsConfigurator.java
+6
-2
cat-home/src/main/java/com/dianping/cat/report/page/AbstractReportModel.java
...ava/com/dianping/cat/report/page/AbstractReportModel.java
+7
-0
cat-home/src/main/java/com/dianping/cat/report/view/DomainNavManager.java
...n/java/com/dianping/cat/report/view/DomainNavManager.java
+157
-0
cat-home/src/main/java/com/dianping/cat/system/alarm/threshold/ThresholdRuleManager.java
...ping/cat/system/alarm/threshold/ThresholdRuleManager.java
+7
-1
cat-home/src/main/resources/META-INF/dal/jdbc/report-dal.xml
cat-home/src/main/resources/META-INF/dal/jdbc/report-dal.xml
+16
-8
cat-home/src/main/resources/META-INF/plexus/components.xml
cat-home/src/main/resources/META-INF/plexus/components.xml
+12
-0
cat-home/src/main/resources/freemaker/event.ftl
cat-home/src/main/resources/freemaker/event.ftl
+1
-8
cat-home/src/main/resources/freemaker/exceptionAlarm.ftl
cat-home/src/main/resources/freemaker/exceptionAlarm.ftl
+1
-14
cat-home/src/main/resources/freemaker/problem.ftl
cat-home/src/main/resources/freemaker/problem.ftl
+1
-7
cat-home/src/main/resources/freemaker/serviceAlarm.ftl
cat-home/src/main/resources/freemaker/serviceAlarm.ftl
+1
-14
cat-home/src/main/resources/freemaker/transaction.ftl
cat-home/src/main/resources/freemaker/transaction.ftl
+1
-7
cat-home/src/main/webapp/WEB-INF/tags/historyReport.tag
cat-home/src/main/webapp/WEB-INF/tags/historyReport.tag
+29
-4
cat-home/src/main/webapp/WEB-INF/tags/hourlyReport.tag
cat-home/src/main/webapp/WEB-INF/tags/hourlyReport.tag
+81
-56
cat-home/src/main/webapp/css/body.css
cat-home/src/main/webapp/css/body.css
+13
-0
cat-home/src/main/webapp/css/report.css
cat-home/src/main/webapp/css/report.css
+1
-0
cat-home/src/test/resources/com/dianping/cat/system/notify/EventRender.txt
.../resources/com/dianping/cat/system/notify/EventRender.txt
+1
-10
cat-home/src/test/resources/com/dianping/cat/system/notify/ProblemRender.txt
...esources/com/dianping/cat/system/notify/ProblemRender.txt
+1
-10
cat-home/src/test/resources/com/dianping/cat/system/notify/TransactionRender.txt
...rces/com/dianping/cat/system/notify/TransactionRender.txt
+1
-8
cat-job/src/main/java/com/dianping/cat/job/joblet/ConversionJoblet.java
...in/java/com/dianping/cat/job/joblet/ConversionJoblet.java
+3
-1
script/Cat.sql
script/Cat.sql
+10
-21
未找到文件。
cat-consumer/src/main/java/com/dianping/cat/consumer/build/ComponentsConfigurator.java
浏览文件 @
77a1d759
...
@@ -4,6 +4,7 @@ import java.util.ArrayList;
...
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.List
;
import
com.dainping.cat.consumer.dal.report.HostinfoDao
;
import
com.dainping.cat.consumer.dal.report.HostinfoDao
;
import
com.dainping.cat.consumer.dal.report.ProjectDao
;
import
com.dainping.cat.consumer.dal.report.ReportDao
;
import
com.dainping.cat.consumer.dal.report.ReportDao
;
import
com.dainping.cat.consumer.dal.report.SqltableDao
;
import
com.dainping.cat.consumer.dal.report.SqltableDao
;
import
com.dainping.cat.consumer.dal.report.TaskDao
;
import
com.dainping.cat.consumer.dal.report.TaskDao
;
...
@@ -56,7 +57,7 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
...
@@ -56,7 +57,7 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
,
E
(
"analyzers"
).
value
(
"problem,transaction,event,heartbeat,matrix,cross,database,sql,dump,common"
)));
,
E
(
"analyzers"
).
value
(
"problem,transaction,event,heartbeat,matrix,cross,database,sql,dump,common"
)));
String
errorTypes
=
"Error,RuntimeException,Exception"
;
String
errorTypes
=
"Error,RuntimeException,Exception"
;
String
failureTypes
=
"URL,SQL,Call,Cache"
;
String
failureTypes
=
"URL,SQL,Call,
PigeonCall,
Cache"
;
all
.
add
(
C
(
Handler
.
class
,
"DefaultHandler"
,
DefaultProblemHandler
.
class
)
//
all
.
add
(
C
(
Handler
.
class
,
"DefaultHandler"
,
DefaultProblemHandler
.
class
)
//
.
config
(
E
(
"failureType"
).
value
(
failureTypes
))
//
.
config
(
E
(
"failureType"
).
value
(
failureTypes
))
//
...
@@ -88,7 +89,7 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
...
@@ -88,7 +89,7 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
.
req
(
BucketManager
.
class
,
ReportDao
.
class
));
.
req
(
BucketManager
.
class
,
ReportDao
.
class
));
all
.
add
(
C
(
CommonAnalyzer
.
class
).
is
(
PER_LOOKUP
)
//
all
.
add
(
C
(
CommonAnalyzer
.
class
).
is
(
PER_LOOKUP
)
//
.
req
(
HostinfoDao
.
class
,
TaskDao
.
class
)
//
.
req
(
HostinfoDao
.
class
,
TaskDao
.
class
,
ProjectDao
.
class
)
//
.
req
(
BucketManager
.
class
));
.
req
(
BucketManager
.
class
));
all
.
add
(
C
(
TopIpAnalyzer
.
class
).
is
(
PER_LOOKUP
)
//
all
.
add
(
C
(
TopIpAnalyzer
.
class
).
is
(
PER_LOOKUP
)
//
...
@@ -113,7 +114,7 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
...
@@ -113,7 +114,7 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
// database
// database
all
.
add
(
C
(
JdbcDataSourceConfigurationManager
.
class
).
config
(
all
.
add
(
C
(
JdbcDataSourceConfigurationManager
.
class
).
config
(
E
(
"datasourceFile"
).
value
(
"/data/appdatas/cat/datasources.xml"
)));
E
(
"datasourceFile"
).
value
(
"/data/appdatas/cat/datasources.xml"
)));
all
.
addAll
(
new
CatDatabaseConfigurator
().
defineComponents
());
all
.
addAll
(
new
CatDatabaseConfigurator
().
defineComponents
());
return
all
;
return
all
;
...
...
cat-consumer/src/main/java/com/dianping/cat/consumer/common/CommonAnalyzer.java
浏览文件 @
77a1d759
...
@@ -10,6 +10,9 @@ import org.codehaus.plexus.logging.Logger;
...
@@ -10,6 +10,9 @@ import org.codehaus.plexus.logging.Logger;
import
com.dainping.cat.consumer.dal.report.Hostinfo
;
import
com.dainping.cat.consumer.dal.report.Hostinfo
;
import
com.dainping.cat.consumer.dal.report.HostinfoDao
;
import
com.dainping.cat.consumer.dal.report.HostinfoDao
;
import
com.dainping.cat.consumer.dal.report.Project
;
import
com.dainping.cat.consumer.dal.report.ProjectDao
;
import
com.dainping.cat.consumer.dal.report.ProjectEntity
;
import
com.dainping.cat.consumer.dal.report.Task
;
import
com.dainping.cat.consumer.dal.report.Task
;
import
com.dainping.cat.consumer.dal.report.TaskDao
;
import
com.dainping.cat.consumer.dal.report.TaskDao
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.Cat
;
...
@@ -21,6 +24,7 @@ import com.dianping.cat.message.spi.AbstractMessageAnalyzer;
...
@@ -21,6 +24,7 @@ import com.dianping.cat.message.spi.AbstractMessageAnalyzer;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.storage.BucketManager
;
import
com.dianping.cat.storage.BucketManager
;
import
com.site.dal.jdbc.DalException
;
import
com.site.dal.jdbc.DalException
;
import
com.site.dal.jdbc.DalNotFoundException
;
import
com.site.lookup.annotation.Inject
;
import
com.site.lookup.annotation.Inject
;
public
class
CommonAnalyzer
extends
AbstractMessageAnalyzer
<
CommonReport
>
implements
LogEnabled
{
public
class
CommonAnalyzer
extends
AbstractMessageAnalyzer
<
CommonReport
>
implements
LogEnabled
{
...
@@ -36,6 +40,9 @@ public class CommonAnalyzer extends AbstractMessageAnalyzer<CommonReport> implem
...
@@ -36,6 +40,9 @@ public class CommonAnalyzer extends AbstractMessageAnalyzer<CommonReport> implem
@Inject
@Inject
private
TaskDao
m_taskDao
;
private
TaskDao
m_taskDao
;
@Inject
private
ProjectDao
m_projectDao
;
@Override
@Override
public
void
doCheckpoint
(
boolean
atEnd
)
{
public
void
doCheckpoint
(
boolean
atEnd
)
{
storeReport
(
atEnd
);
storeReport
(
atEnd
);
...
@@ -108,6 +115,7 @@ public class CommonAnalyzer extends AbstractMessageAnalyzer<CommonReport> implem
...
@@ -108,6 +115,7 @@ public class CommonAnalyzer extends AbstractMessageAnalyzer<CommonReport> implem
t
.
setStatus
(
e
);
t
.
setStatus
(
e
);
}
}
}
}
insetDomainInfo
(
domain
);
}
}
if
(
atEnd
)
{
if
(
atEnd
)
{
Date
period
=
new
Date
(
m_startTime
);
Date
period
=
new
Date
(
m_startTime
);
...
@@ -137,4 +145,124 @@ public class CommonAnalyzer extends AbstractMessageAnalyzer<CommonReport> implem
...
@@ -137,4 +145,124 @@ public class CommonAnalyzer extends AbstractMessageAnalyzer<CommonReport> implem
t
.
complete
();
t
.
complete
();
}
}
}
}
private
void
insetDomainInfo
(
String
domain
)
{
try
{
m_projectDao
.
findByDomain
(
domain
,
ProjectEntity
.
READSET_FULL
);
}
catch
(
DalNotFoundException
e
)
{
Project
project
=
m_projectDao
.
createLocal
();
project
.
setDomain
(
domain
);
project
.
setProjectLine
(
"Default"
);
String
temp
=
domain
.
toLowerCase
();
setProjectInfo
(
project
,
temp
);
try
{
m_projectDao
.
insert
(
project
);
}
catch
(
Exception
ex
)
{
Cat
.
logError
(
ex
);
}
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
}
private
void
setProjectInfo
(
Project
project
,
String
temp
)
{
String
account
=
" magicMirror AccountMQ AccountServer AccountWeb MessageAdminWeb MessageMQ MessageServer MessageWeb DecoratorServer FeedMQ FeedServer SmsServer SocialFeedMQ SocialFeedServer SocialRelationshipServer "
;
String
guanggao
=
"AdwordsWeb PromoWeb OpenWeb "
;
String
group
=
"AuditbackService AuditbackWeb AutoauditMQ GroupService GroupWeb ReviewServer BadgeMQ BaseDataServer UserBaseService UserService UserWeb"
;
String
shop
=
"DPIndexWeb KeywordService KeywordWeb PiccenterDisplay PiccenterService PiccenterUpload PiccenterWeb ShopAccountAdminWeb ShopAccountServer ShopAccountWeb ShopBusinessWeb ShopSearchWeb ShopServer ShopWeb ShoppicService ShoppicWeb"
;
String
tuangouWeb
=
"BCTuangouWeb TuanGouApi TuanGouRemote TuanGouWeb tuangou-paygate"
;
String
tuangouMobile
=
"TuanGouApiMobile TuanGouWap"
;
String
zhifu
=
" PayChannel PayEngine PayOrder Unipay "
;
String
mobile
=
" MConfigAPI MLocationService MYellowPageAPI MapService MobileApi"
;
String
mobileBooking
=
"MBookingCallcenter MBookingService MBookingWeb"
;
String
mobileMembercard
=
"MobileMembercardBcWeb MobileMembercardMainApiWeb MobileMembercardMainServer"
;
String
search
=
"DPSearch"
;
String
middleware
=
" Swallow Cat"
;
if
(
account
.
toLowerCase
().
indexOf
(
temp
)
>
-
1
)
{
project
.
setDepartment
(
Department
.
WWW
);
project
.
setProjectLine
(
Department
.
ACCOUT
);
}
else
if
(
middleware
.
toLowerCase
().
indexOf
(
temp
)
>
-
1
)
{
project
.
setDepartment
(
Department
.
ARCH
);
project
.
setProjectLine
(
Department
.
MIDDLDWARE
);
}
else
if
(
guanggao
.
toLowerCase
().
indexOf
(
temp
)
>
-
1
)
{
project
.
setDepartment
(
Department
.
WWW
);
project
.
setProjectLine
(
Department
.
PROMO
);
}
else
if
(
group
.
toLowerCase
().
indexOf
(
temp
)
>
-
1
)
{
project
.
setDepartment
(
Department
.
WWW
);
project
.
setProjectLine
(
Department
.
GROUP
);
}
else
if
(
shop
.
toLowerCase
().
indexOf
(
temp
)
>
-
1
)
{
project
.
setDepartment
(
Department
.
WWW
);
project
.
setProjectLine
(
Department
.
SHOP
);
}
else
if
(
tuangouWeb
.
toLowerCase
().
indexOf
(
temp
)
>
-
1
)
{
project
.
setDepartment
(
Department
.
TUANGOU
);
project
.
setProjectLine
(
Department
.
TUANGOUTWEB
);
}
else
if
(
tuangouMobile
.
toLowerCase
().
indexOf
(
temp
)
>
-
1
)
{
project
.
setDepartment
(
Department
.
TUANGOU
);
project
.
setProjectLine
(
Department
.
TUANGOUMOBILE
);
}
else
if
(
zhifu
.
toLowerCase
().
indexOf
(
temp
)
>
-
1
)
{
project
.
setDepartment
(
Department
.
TUANGOU
);
project
.
setProjectLine
(
Department
.
TUANGOUZHIFU
);
}
else
if
(
mobile
.
toLowerCase
().
indexOf
(
temp
)
>
-
1
)
{
project
.
setDepartment
(
Department
.
MOBILE
);
project
.
setProjectLine
(
Department
.
MOBILEWEB
);
}
else
if
(
mobileBooking
.
toLowerCase
().
indexOf
(
temp
)
>
-
1
)
{
project
.
setDepartment
(
Department
.
MOBILE
);
project
.
setProjectLine
(
Department
.
MOBILEBOOKING
);
}
else
if
(
mobileMembercard
.
toLowerCase
().
indexOf
(
temp
)
>
-
1
)
{
project
.
setDepartment
(
Department
.
MOBILE
);
project
.
setProjectLine
(
Department
.
MOBILEMEM
);
}
else
if
(
search
.
toLowerCase
().
indexOf
(
temp
)
>
-
1
)
{
project
.
setDepartment
(
Department
.
SEARCH
);
project
.
setProjectLine
(
Department
.
SEARCH
);
}
else
{
project
.
setDepartment
(
"Default"
);
project
.
setProjectLine
(
"Default"
);
}
}
public
class
Department
{
public
static
final
String
MOBILE
=
"手机"
;
public
static
final
String
SEARCH
=
"搜索"
;
public
static
final
String
ARCH
=
"架构"
;
public
static
final
String
WWW
=
"主站"
;
public
static
final
String
TUANGOU
=
"团购"
;
public
static
final
String
ACCOUT
=
"账户、消息"
;
public
static
final
String
USER
=
"用户、社交"
;
public
static
final
String
GROUP
=
"社区、用户"
;
public
static
final
String
SHOP
=
"商户、图片"
;
public
static
final
String
PROMO
=
"广告、优惠"
;
public
static
final
String
TUANGOUTWEB
=
"团购主页"
;
public
static
final
String
TUANGOUMOBILE
=
"团购手机"
;
public
static
final
String
TUANGOUZHIFU
=
"支付中心"
;
public
static
final
String
MIDDLDWARE
=
"基础组建"
;
public
static
final
String
MOBILEWEB
=
"手机后台"
;
public
static
final
String
MOBILEBOOKING
=
"预约预定"
;
public
static
final
String
MOBILEMEM
=
"会员卡"
;
}
}
}
cat-consumer/src/main/java/com/dianping/cat/consumer/dump/DumpAnalyzer.java
浏览文件 @
77a1d759
...
@@ -95,12 +95,11 @@ public class DumpAnalyzer extends AbstractMessageAnalyzer<Object> implements Ini
...
@@ -95,12 +95,11 @@ public class DumpAnalyzer extends AbstractMessageAnalyzer<Object> implements Ini
return
;
return
;
}
}
String
messageId
=
tree
.
getMessageId
();
MessageId
id
=
MessageId
.
parse
(
tree
.
getMessageId
());
MessageId
id
=
MessageId
.
parse
(
messageId
);
if
(
id
.
getVersion
()
==
2
)
{
if
(
id
.
getVersion
()
==
2
)
{
try
{
try
{
m_bucketManager
.
storeMessage
(
tree
);
m_bucketManager
.
storeMessage
(
tree
,
id
);
}
catch
(
IOException
e1
)
{
}
catch
(
IOException
e1
)
{
m_logger
.
error
(
"Error when dumping to local file system, version 2!"
,
e1
);
m_logger
.
error
(
"Error when dumping to local file system, version 2!"
,
e1
);
}
}
...
...
cat-consumer/src/main/java/com/dianping/cat/consumer/dump/DumpUploader.java
浏览文件 @
77a1d759
...
@@ -183,6 +183,12 @@ public class DumpUploader implements Initializable, LogEnabled {
...
@@ -183,6 +183,12 @@ public class DumpUploader implements Initializable, LogEnabled {
}
finally
{
}
finally
{
t
.
complete
();
t
.
complete
();
}
}
try
{
Thread
.
sleep
(
100
);
}
catch
(
InterruptedException
e
)
{
break
;
}
}
}
root
.
complete
();
root
.
complete
();
...
...
cat-consumer/src/main/resources/META-INF/dal/jdbc/report-codegen.xml
浏览文件 @
77a1d759
...
@@ -143,5 +143,40 @@
...
@@ -143,5 +143,40 @@
</query>
</query>
</query-defs>
</query-defs>
</entity>
</entity>
<entity
name=
"project"
table=
"project"
alias=
"p"
>
<member
name=
"id"
field=
"id"
value-type=
"int"
length=
"10"
nullable=
"false"
key=
"true"
auto-increment=
"true"
/>
<member
name=
"domain"
field=
"domain"
value-type=
"String"
length=
"50"
nullable=
"false"
/>
<member
name=
"project-line"
field=
"project_line"
value-type=
"String"
length=
"50"
/>
<member
name=
"department"
field=
"department"
value-type=
"String"
length=
"50"
/>
<member
name=
"owner"
field=
"owner"
value-type=
"String"
length=
"50"
/>
<member
name=
"email"
field=
"email"
value-type=
"String"
length=
"200"
/>
<member
name=
"creation-date"
field=
"creation_date"
value-type=
"Date"
/>
<member
name=
"modify-date"
field=
"modify_date"
value-type=
"Date"
/>
<var
name=
"key-id"
value-type=
"int"
key-member=
"id"
/>
<primary-key
name=
"PRIMARY"
members=
"id"
/>
<readsets>
<readset
name=
"FULL"
all=
"true"
/>
</readsets>
<updatesets>
<updateset
name=
"FULL"
all=
"true"
/>
</updatesets>
<query-defs>
<query
name=
"find-by-PK"
type=
"SELECT"
>
<param
name=
"key-id"
/>
<statement>
<![CDATA[SELECT <FIELDS/> FROM <TABLE/> WHERE <FIELD name='id'/> = ${key-id}]]>
</statement>
</query>
<query
name=
"insert"
type=
"INSERT"
>
<statement>
<![CDATA[INSERT INTO <TABLE/>(<FIELDS/>) VALUES(<VALUES/>)]]>
</statement>
</query>
<query
name=
"update-by-PK"
type=
"UPDATE"
>
<param
name=
"key-id"
/>
<statement>
<![CDATA[UPDATE <TABLE/> SET <FIELDS/> WHERE <FIELD name='id'/> = ${key-id}]]>
</statement>
</query>
<query
name=
"delete-by-PK"
type=
"DELETE"
>
<param
name=
"key-id"
/>
<statement>
<![CDATA[DELETE FROM <TABLE/> WHERE <FIELD name='id'/> = ${key-id}]]>
</statement>
</query>
</query-defs>
</entity>
</entities>
</entities>
cat-consumer/src/main/resources/META-INF/dal/jdbc/report-dal.xml
浏览文件 @
77a1d759
...
@@ -349,4 +349,23 @@
...
@@ -349,4 +349,23 @@
</query>
</query>
</query-defs>
</query-defs>
</entity>
</entity>
<entity
name=
"project"
table=
"project"
alias=
"p"
>
<member
name=
"creation-date"
insert-expr=
"NOW()"
/>
<member
name=
"modify-date"
insert-expr=
"NOW()"
update-expr=
"NOW()"
/>
<query-defs>
<query
name=
"find-all"
type=
"SELECT"
multiple=
"true"
>
<statement>
<![CDATA[
SELECT <FIELDS/>
FROM
<TABLE/>
]]>
</statement>
</query>
<query
name=
"find-by-domain"
type=
"SELECT"
>
<param
name=
"domain"
/>
<statement>
<![CDATA[
SELECT <FIELDS/>
FROM
<TABLE/>
WHERE
<FIELD
name=
'domain'
/>
= ${domain}
]]>
</statement>
</query>
</query-defs>
</entity>
</entities>
</entities>
\ No newline at end of file
cat-consumer/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
77a1d759
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
<role-hint>
DefaultHandler
</role-hint>
<role-hint>
DefaultHandler
</role-hint>
<implementation>
com.dianping.cat.consumer.problem.handler.DefaultProblemHandler
</implementation>
<implementation>
com.dianping.cat.consumer.problem.handler.DefaultProblemHandler
</implementation>
<configuration>
<configuration>
<failureType>
URL,SQL,Call,Cache
</failureType>
<failureType>
URL,SQL,Call,
PigeonCall,
Cache
</failureType>
<errorType>
Error,RuntimeException,Exception
</errorType>
<errorType>
Error,RuntimeException,Exception
</errorType>
</configuration>
</configuration>
</component>
</component>
...
@@ -171,6 +171,9 @@
...
@@ -171,6 +171,9 @@
<requirement>
<requirement>
<role>
com.dainping.cat.consumer.dal.report.TaskDao
</role>
<role>
com.dainping.cat.consumer.dal.report.TaskDao
</role>
</requirement>
</requirement>
<requirement>
<role>
com.dainping.cat.consumer.dal.report.ProjectDao
</role>
</requirement>
<requirement>
<requirement>
<role>
com.dianping.cat.storage.BucketManager
</role>
<role>
com.dianping.cat.storage.BucketManager
</role>
</requirement>
</requirement>
...
@@ -330,6 +333,16 @@
...
@@ -330,6 +333,16 @@
<data-source-name>
cat
</data-source-name>
<data-source-name>
cat
</data-source-name>
</configuration>
</configuration>
</component>
</component>
<component>
<role>
com.site.dal.jdbc.mapping.TableProvider
</role>
<role-hint>
project
</role-hint>
<implementation>
com.site.dal.jdbc.mapping.SimpleTableProvider
</implementation>
<configuration>
<logical-table-name>
project
</logical-table-name>
<physical-table-name></physical-table-name>
<data-source-name>
cat
</data-source-name>
</configuration>
</component>
<component>
<component>
<role>
com.dainping.cat.consumer.dal.report.ReportDao
</role>
<role>
com.dainping.cat.consumer.dal.report.ReportDao
</role>
<implementation>
com.dainping.cat.consumer.dal.report.ReportDao
</implementation>
<implementation>
com.dainping.cat.consumer.dal.report.ReportDao
</implementation>
...
@@ -366,5 +379,14 @@
...
@@ -366,5 +379,14 @@
</requirement>
</requirement>
</requirements>
</requirements>
</component>
</component>
<component>
<role>
com.dainping.cat.consumer.dal.report.ProjectDao
</role>
<implementation>
com.dainping.cat.consumer.dal.report.ProjectDao
</implementation>
<requirements>
<requirement>
<role>
com.site.dal.jdbc.QueryEngine
</role>
</requirement>
</requirements>
</component>
</components>
</components>
</plexus>
</plexus>
cat-consumer/src/main/resources/META-INF/wizard/jdbc/wizard.xml
浏览文件 @
77a1d759
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
<table
name=
"hostinfo"
/>
<table
name=
"hostinfo"
/>
<table
name=
"sqltable"
/>
<table
name=
"sqltable"
/>
<table
name=
"task"
/>
<table
name=
"task"
/>
<table
name=
"project"
/>
</group>
</group>
</jdbc>
</jdbc>
</wizard>
</wizard>
cat-core/src/main/java/com/dianping/cat/storage/dump/LocalMessageBucket.java
浏览文件 @
77a1d759
...
@@ -166,14 +166,13 @@ public class LocalMessageBucket implements MessageBucket {
...
@@ -166,14 +166,13 @@ public class LocalMessageBucket implements MessageBucket {
}
}
@Override
@Override
public
synchronized
MessageBlock
store
(
MessageTree
tree
)
throws
IOException
{
public
MessageBlock
store
(
final
MessageTree
tree
,
final
MessageId
id
)
throws
IOException
{
ChannelBuffer
buf
=
m_bufferManager
.
allocate
();
final
ChannelBuffer
buf
=
m_bufferManager
.
allocate
();
m_lastAccessTime
=
System
.
currentTimeMillis
();
m_lastAccessTime
=
System
.
currentTimeMillis
();
m_codec
.
encode
(
tree
,
buf
);
m_codec
.
encode
(
tree
,
buf
);
int
size
=
buf
.
readableBytes
();
int
size
=
buf
.
readableBytes
();
MessageId
id
=
MessageId
.
parse
(
tree
.
getMessageId
());
m_dirty
.
set
(
true
);
m_dirty
.
set
(
true
);
m_blockSize
+=
size
;
m_blockSize
+=
size
;
...
...
cat-core/src/main/java/com/dianping/cat/storage/dump/LocalMessageBucketManager.java
浏览文件 @
77a1d759
...
@@ -9,6 +9,7 @@ import java.util.HashMap;
...
@@ -9,6 +9,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.locks.LockSupport
;
import
java.util.concurrent.locks.LockSupport
;
...
@@ -38,17 +39,19 @@ public class LocalMessageBucketManager extends ContainerHolder implements Messag
...
@@ -38,17 +39,19 @@ public class LocalMessageBucketManager extends ContainerHolder implements Messag
private
static
final
long
ONE_HOUR
=
60
*
60
*
1000L
;
private
static
final
long
ONE_HOUR
=
60
*
60
*
1000L
;
private
File
m_baseDir
;
private
Map
<
String
,
LocalMessageBucket
>
m_buckets
=
new
HashMap
<
String
,
LocalMessageBucket
>();
@Inject
@Inject
private
ServerConfigManager
m_configManager
;
private
ServerConfigManager
m_configManager
;
private
BlockingQueue
<
MessageBlock
>
m_messageBlocks
=
new
LinkedBlockingQueue
<
MessageBlock
>(
1000
);
@Inject
@Inject
private
MessagePathBuilder
m_pathBuilder
;
private
MessagePathBuilder
m_pathBuilder
;
private
File
m_baseDir
;
private
ExecutorService
m_pool
=
Threads
.
forPool
().
getFixedThreadPool
(
"Cat-Encoder"
,
3
);
private
Map
<
String
,
LocalMessageBucket
>
m_buckets
=
new
HashMap
<
String
,
LocalMessageBucket
>();
private
BlockingQueue
<
MessageBlock
>
m_messageBlocks
=
new
LinkedBlockingQueue
<
MessageBlock
>(
1000
);
public
void
archive
(
long
startTime
)
{
public
void
archive
(
long
startTime
)
{
String
path
=
m_pathBuilder
.
getPath
(
new
Date
(
startTime
),
""
);
String
path
=
m_pathBuilder
.
getPath
(
new
Date
(
startTime
),
""
);
...
@@ -127,6 +130,31 @@ public class LocalMessageBucketManager extends ContainerHolder implements Messag
...
@@ -127,6 +130,31 @@ public class LocalMessageBucketManager extends ContainerHolder implements Messag
Threads
.
forGroup
(
"Cat"
).
start
(
new
OldMessageMover
());
Threads
.
forGroup
(
"Cat"
).
start
(
new
OldMessageMover
());
}
}
private
boolean
isFit
(
String
path
)
{
if
(
path
.
indexOf
(
"draft"
)
>
-
1
||
path
.
indexOf
(
"outbox"
)
>
-
1
)
{
return
false
;
}
long
current
=
System
.
currentTimeMillis
();
long
currentHour
=
current
-
current
%
ONE_HOUR
;
long
lastHour
=
currentHour
-
ONE_HOUR
;
long
nextHour
=
currentHour
+
ONE_HOUR
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyyMMdd/HH"
);
String
currentHourStr
=
sdf
.
format
(
new
Date
(
currentHour
));
String
lastHourStr
=
sdf
.
format
(
new
Date
(
lastHour
));
String
nextHourStr
=
sdf
.
format
(
new
Date
(
nextHour
));
int
indexOf
=
path
.
indexOf
(
currentHourStr
);
int
indexOfLast
=
path
.
indexOf
(
lastHourStr
);
int
indexOfNext
=
path
.
indexOf
(
nextHourStr
);
if
(
indexOf
>
-
1
||
indexOfLast
>
-
1
||
indexOfNext
>
-
1
)
{
return
false
;
}
return
true
;
}
@Override
@Override
public
MessageTree
loadMessage
(
String
messageId
)
throws
IOException
{
public
MessageTree
loadMessage
(
String
messageId
)
throws
IOException
{
MessageProducer
cat
=
Cat
.
getProducer
();
MessageProducer
cat
=
Cat
.
getProducer
();
...
@@ -203,13 +231,57 @@ public class LocalMessageBucketManager extends ContainerHolder implements Messag
...
@@ -203,13 +231,57 @@ public class LocalMessageBucketManager extends ContainerHolder implements Messag
}
}
}
}
private
void
moveOldMessages
()
{
final
List
<
String
>
paths
=
new
ArrayList
<
String
>();
Scanners
.
forDir
().
scan
(
m_baseDir
,
new
FileMatcher
()
{
@Override
public
Direction
matches
(
File
base
,
String
path
)
{
if
(
new
File
(
base
,
path
).
isFile
())
{
if
(
isFit
(
path
))
{
paths
.
add
(
path
);
}
}
return
Direction
.
DOWN
;
}
});
if
(
paths
.
size
()
>
0
)
{
String
ip
=
NetworkInterfaceManager
.
INSTANCE
.
getLocalHostAddress
();
Transaction
t
=
Cat
.
newTransaction
(
"System"
,
"Dump"
+
"-"
+
ip
);
t
.
setStatus
(
Message
.
SUCCESS
);
for
(
String
path
:
paths
)
{
try
{
Cat
.
getProducer
().
logEvent
(
"Dump"
,
"Outbox.Abnormal"
,
Message
.
SUCCESS
,
path
);
File
outbox
=
new
File
(
m_baseDir
,
"outbox"
);
File
from
=
new
File
(
m_baseDir
,
path
);
File
to
=
new
File
(
outbox
,
path
);
to
.
getParentFile
().
mkdirs
();
Files
.
forDir
().
copyFile
(
from
,
to
);
Files
.
forDir
().
delete
(
from
);
File
parentFile
=
from
.
getParentFile
();
parentFile
.
delete
();
// delete it if empty
parentFile
.
getParentFile
().
delete
();
// delete it if empty
}
catch
(
Exception
e
)
{
t
.
setStatus
(
Message
.
SUCCESS
);
Cat
.
logError
(
e
);
}
}
t
.
complete
();
}
}
public
void
setBaseDir
(
File
baseDir
)
{
public
void
setBaseDir
(
File
baseDir
)
{
m_baseDir
=
baseDir
;
m_baseDir
=
baseDir
;
}
}
@Override
@Override
public
void
storeMessage
(
MessageTree
tree
)
throws
IOException
{
public
void
storeMessage
(
final
MessageTree
tree
,
final
MessageId
id
)
throws
IOException
{
MessageId
id
=
MessageId
.
parse
(
tree
.
getMessageId
());
String
localIp
=
NetworkInterfaceManager
.
INSTANCE
.
getLocalHostAddress
();
String
localIp
=
NetworkInterfaceManager
.
INSTANCE
.
getLocalHostAddress
();
String
name
=
id
.
getDomain
()
+
'-'
+
id
.
getIpAddress
()
+
'-'
+
localIp
;
String
name
=
id
.
getDomain
()
+
'-'
+
id
.
getIpAddress
()
+
'-'
+
localIp
;
String
dataFile
=
m_pathBuilder
.
getPath
(
new
Date
(
id
.
getTimestamp
()),
name
);
String
dataFile
=
m_pathBuilder
.
getPath
(
new
Date
(
id
.
getTimestamp
()),
name
);
...
@@ -222,11 +294,22 @@ public class LocalMessageBucketManager extends ContainerHolder implements Messag
...
@@ -222,11 +294,22 @@ public class LocalMessageBucketManager extends ContainerHolder implements Messag
m_buckets
.
put
(
dataFile
,
bucket
);
m_buckets
.
put
(
dataFile
,
bucket
);
}
}
MessageBlock
block
=
bucket
.
store
(
tree
)
;
final
LocalMessageBucket
b
=
bucket
;
if
(
block
!=
null
)
{
m_pool
.
submit
(
new
Runnable
()
{
m_messageBlocks
.
offer
(
block
);
@Override
}
public
void
run
()
{
try
{
MessageBlock
block
=
b
.
store
(
tree
,
id
);
if
(
block
!=
null
)
{
m_messageBlocks
.
offer
(
block
);
}
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
}
});
}
}
class
BlockDumper
implements
Task
{
class
BlockDumper
implements
Task
{
...
@@ -252,7 +335,7 @@ public class LocalMessageBucketManager extends ContainerHolder implements Messag
...
@@ -252,7 +335,7 @@ public class LocalMessageBucketManager extends ContainerHolder implements Messag
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
m_errors
++;
m_errors
++;
if
(
m_errors
==
1
||
m_errors
%
100
0
==
0
)
{
if
(
m_errors
==
1
||
m_errors
%
100
==
0
)
{
Cat
.
getProducer
().
logError
(
Cat
.
getProducer
().
logError
(
new
RuntimeException
(
"Error when dumping for bucket: "
+
dataFile
+
"."
,
e
));
new
RuntimeException
(
"Error when dumping for bucket: "
+
dataFile
+
"."
,
e
));
}
}
...
@@ -269,81 +352,44 @@ public class LocalMessageBucketManager extends ContainerHolder implements Messag
...
@@ -269,81 +352,44 @@ public class LocalMessageBucketManager extends ContainerHolder implements Messag
}
}
}
}
private
boolean
isFit
(
String
path
)
{
class
IdleChecker
implements
Task
{
if
(
path
.
indexOf
(
"draft"
)
>
-
1
||
path
.
indexOf
(
"outbox"
)
>
-
1
)
{
@Override
return
false
;
public
String
getName
()
{
}
return
"LocalMessageBucketManager-IdleChecker"
;
long
current
=
System
.
currentTimeMillis
();
long
currentHour
=
current
-
current
%
ONE_HOUR
;
long
lastHour
=
currentHour
-
ONE_HOUR
;
long
nextHour
=
currentHour
+
ONE_HOUR
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyyMMdd/HH"
);
String
currentHourStr
=
sdf
.
format
(
new
Date
(
currentHour
));
String
lastHourStr
=
sdf
.
format
(
new
Date
(
lastHour
));
String
nextHourStr
=
sdf
.
format
(
new
Date
(
nextHour
));
int
indexOf
=
path
.
indexOf
(
currentHourStr
);
int
indexOfLast
=
path
.
indexOf
(
lastHourStr
);
int
indexOfNext
=
path
.
indexOf
(
nextHourStr
);
if
(
indexOf
>
-
1
||
indexOfLast
>
-
1
||
indexOfNext
>
-
1
)
{
return
false
;
}
}
return
true
;
}
private
void
moveOldMessages
()
{
@Override
final
List
<
String
>
paths
=
new
ArrayList
<
String
>();
public
void
run
()
{
try
{
while
(
true
)
{
Thread
.
sleep
(
60
*
1000L
);
// 1 minute
Scanners
.
forDir
().
scan
(
m_baseDir
,
new
FileMatcher
()
{
try
{
@Override
closeIdleBuckets
();
public
Direction
matches
(
File
base
,
String
path
)
{
}
catch
(
Throwable
e
)
{
if
(
new
File
(
base
,
path
).
isFile
())
{
Cat
.
getProducer
().
logError
(
e
);
if
(
isFit
(
path
))
{
paths
.
add
(
path
);
}
}
}
}
return
Direction
.
DOWN
;
}
catch
(
InterruptedException
e
)
{
}
// ignore it
});
if
(
paths
.
size
()
>
0
)
{
String
ip
=
NetworkInterfaceManager
.
INSTANCE
.
getLocalHostAddress
();
Transaction
t
=
Cat
.
newTransaction
(
"System"
,
"Dump"
+
"-"
+
ip
);
t
.
setStatus
(
Message
.
SUCCESS
);
for
(
String
path
:
paths
)
{
try
{
Cat
.
getProducer
().
logEvent
(
"Dump"
,
"Outbox.Abnormal"
,
Message
.
SUCCESS
,
path
);
File
outbox
=
new
File
(
m_baseDir
,
"outbox"
);
File
from
=
new
File
(
m_baseDir
,
path
);
File
to
=
new
File
(
outbox
,
path
);
to
.
getParentFile
().
mkdirs
();
Files
.
forDir
().
copyFile
(
from
,
to
);
Files
.
forDir
().
delete
(
from
);
File
parentFile
=
from
.
getParentFile
();
parentFile
.
delete
();
// delete it if empty
parentFile
.
getParentFile
().
delete
();
// delete it if empty
}
catch
(
Exception
e
)
{
t
.
setStatus
(
Message
.
SUCCESS
);
Cat
.
logError
(
e
);
}
}
}
}
t
.
complete
();
@Override
public
void
shutdown
()
{
}
}
}
}
class
OldMessageMover
implements
Task
{
class
OldMessageMover
implements
Task
{
@Override
public
String
getName
()
{
return
"LocalMessageBucketManager-OldMessageMover"
;
}
@Override
@Override
public
void
run
()
{
public
void
run
()
{
boolean
active
=
true
;
boolean
active
=
true
;
while
(
active
)
{
while
(
active
)
{
try
{
try
{
moveOldMessages
();
moveOldMessages
();
...
@@ -358,42 +404,9 @@ public class LocalMessageBucketManager extends ContainerHolder implements Messag
...
@@ -358,42 +404,9 @@ public class LocalMessageBucketManager extends ContainerHolder implements Messag
}
}
}
}
@Override
public
String
getName
()
{
return
"LocalMessageBucketManager-OldMessageMover"
;
}
@Override
@Override
public
void
shutdown
()
{
public
void
shutdown
()
{
}
}
}
}
class
IdleChecker
implements
Task
{
@Override
public
String
getName
()
{
return
"LocalMessageBucketManager-IdleChecker"
;
}
@Override
public
void
run
()
{
try
{
while
(
true
)
{
Thread
.
sleep
(
60
*
1000L
);
// 1 minute
try
{
closeIdleBuckets
();
}
catch
(
Throwable
e
)
{
Cat
.
getProducer
().
logError
(
e
);
}
}
}
catch
(
InterruptedException
e
)
{
// ignore it
}
}
@Override
public
void
shutdown
()
{
}
}
}
}
cat-core/src/main/java/com/dianping/cat/storage/dump/MessageBucket.java
浏览文件 @
77a1d759
...
@@ -2,6 +2,7 @@ package com.dianping.cat.storage.dump;
...
@@ -2,6 +2,7 @@ package com.dianping.cat.storage.dump;
import
java.io.IOException
;
import
java.io.IOException
;
import
com.dianping.cat.message.internal.MessageId
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.MessageTree
;
public
interface
MessageBucket
{
public
interface
MessageBucket
{
...
@@ -15,5 +16,5 @@ public interface MessageBucket {
...
@@ -15,5 +16,5 @@ public interface MessageBucket {
public
void
initialize
(
String
dataFile
)
throws
IOException
;
public
void
initialize
(
String
dataFile
)
throws
IOException
;
public
MessageBlock
store
(
MessageTree
tree
)
throws
IOException
;
public
MessageBlock
store
(
MessageTree
tree
,
MessageId
id
)
throws
IOException
;
}
}
cat-core/src/main/java/com/dianping/cat/storage/dump/MessageBucketManager.java
浏览文件 @
77a1d759
...
@@ -2,6 +2,7 @@ package com.dianping.cat.storage.dump;
...
@@ -2,6 +2,7 @@ package com.dianping.cat.storage.dump;
import
java.io.IOException
;
import
java.io.IOException
;
import
com.dianping.cat.message.internal.MessageId
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.MessageTree
;
public
interface
MessageBucketManager
{
public
interface
MessageBucketManager
{
...
@@ -9,5 +10,5 @@ public interface MessageBucketManager {
...
@@ -9,5 +10,5 @@ public interface MessageBucketManager {
public
MessageTree
loadMessage
(
String
messageId
)
throws
IOException
;
public
MessageTree
loadMessage
(
String
messageId
)
throws
IOException
;
public
void
storeMessage
(
MessageTree
tree
)
throws
IOException
;
public
void
storeMessage
(
MessageTree
tree
,
MessageId
id
)
throws
IOException
;
}
}
cat-core/src/test/java/com/dianping/cat/storage/dump/LocalMessageBucketManagerTest.java
浏览文件 @
77a1d759
...
@@ -9,6 +9,7 @@ import org.junit.runners.JUnit4;
...
@@ -9,6 +9,7 @@ import org.junit.runners.JUnit4;
import
com.dianping.cat.message.Transaction
;
import
com.dianping.cat.message.Transaction
;
import
com.dianping.cat.message.internal.DefaultTransaction
;
import
com.dianping.cat.message.internal.DefaultTransaction
;
import
com.dianping.cat.message.internal.MessageId
;
import
com.dianping.cat.message.internal.MessageIdFactory
;
import
com.dianping.cat.message.internal.MessageIdFactory
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.internal.DefaultMessageTree
;
import
com.dianping.cat.message.spi.internal.DefaultMessageTree
;
...
@@ -58,7 +59,10 @@ public class LocalMessageBucketManagerTest extends ComponentTestCase {
...
@@ -58,7 +59,10 @@ public class LocalMessageBucketManagerTest extends ComponentTestCase {
factory
.
initialize
(
"source"
);
factory
.
initialize
(
"source"
);
for
(
int
i
=
0
;
i
<
num
;
i
++)
{
for
(
int
i
=
0
;
i
<
num
;
i
++)
{
manager
.
storeMessage
(
newMessageTree
(
factory
.
getNextId
(),
i
,
now
+
i
*
10L
));
DefaultMessageTree
tree
=
newMessageTree
(
factory
.
getNextId
(),
i
,
now
+
i
*
10L
);
MessageId
id
=
MessageId
.
parse
(
tree
.
getMessageId
());
manager
.
storeMessage
(
tree
,
id
);
}
}
Thread
.
yield
();
Thread
.
yield
();
...
...
cat-core/src/test/java/com/dianping/cat/storage/dump/LocalMessageBucketTest.java
浏览文件 @
77a1d759
...
@@ -41,8 +41,10 @@ public class LocalMessageBucketTest extends ComponentTestCase {
...
@@ -41,8 +41,10 @@ public class LocalMessageBucketTest extends ComponentTestCase {
int
count
=
2000
;
int
count
=
2000
;
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
MessageId
id
=
MessageId
.
parse
(
tree
.
getMessageId
());
tree
.
setMessageId
(
factory
.
getNextId
());
tree
.
setMessageId
(
factory
.
getNextId
());
bucket
.
store
(
tree
);
bucket
.
store
(
tree
,
id
);
}
}
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
...
@@ -71,8 +73,10 @@ public class LocalMessageBucketTest extends ComponentTestCase {
...
@@ -71,8 +73,10 @@ public class LocalMessageBucketTest extends ComponentTestCase {
int
count
=
2000
;
int
count
=
2000
;
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
MessageId
id
=
MessageId
.
parse
(
tree
.
getMessageId
());
tree
.
setMessageId
(
factory
.
getNextId
());
tree
.
setMessageId
(
factory
.
getNextId
());
buckets
[
i
%
buckets
.
length
].
store
(
tree
);
buckets
[
i
%
buckets
.
length
].
store
(
tree
,
id
);
}
}
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
...
...
cat-hadoop/src/main/java/com/dianping/cat/hadoop/hdfs/HdfsMessageBucket.java
浏览文件 @
77a1d759
...
@@ -76,7 +76,7 @@ public class HdfsMessageBucket implements MessageBucket {
...
@@ -76,7 +76,7 @@ public class HdfsMessageBucket implements MessageBucket {
}
}
@Override
@Override
public
MessageBlock
store
(
MessageTree
tree
)
throws
IOException
{
public
MessageBlock
store
(
MessageTree
tree
,
MessageId
id
)
throws
IOException
{
throw
new
UnsupportedOperationException
(
"Not supported by HDFS!"
);
throw
new
UnsupportedOperationException
(
"Not supported by HDFS!"
);
}
}
...
...
cat-hadoop/src/main/java/com/dianping/cat/hadoop/hdfs/HdfsMessageBucketManager.java
浏览文件 @
77a1d759
...
@@ -131,7 +131,7 @@ public class HdfsMessageBucketManager extends ContainerHolder implements Message
...
@@ -131,7 +131,7 @@ public class HdfsMessageBucketManager extends ContainerHolder implements Message
}
}
@Override
@Override
public
void
storeMessage
(
MessageTree
tree
)
throws
IOException
{
public
void
storeMessage
(
MessageTree
tree
,
MessageId
id
)
throws
IOException
{
throw
new
UnsupportedOperationException
(
"Not supported by HDFS!"
);
throw
new
UnsupportedOperationException
(
"Not supported by HDFS!"
);
}
}
...
...
cat-hadoop/src/test/java/com/dianping/cat/hadoop/hdfs/HdfsMessageBucketManagerTest.java
浏览文件 @
77a1d759
...
@@ -9,6 +9,7 @@ import org.junit.runners.JUnit4;
...
@@ -9,6 +9,7 @@ import org.junit.runners.JUnit4;
import
com.dianping.cat.message.Transaction
;
import
com.dianping.cat.message.Transaction
;
import
com.dianping.cat.message.internal.DefaultTransaction
;
import
com.dianping.cat.message.internal.DefaultTransaction
;
import
com.dianping.cat.message.internal.MessageId
;
import
com.dianping.cat.message.internal.MessageIdFactory
;
import
com.dianping.cat.message.internal.MessageIdFactory
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.internal.DefaultMessageTree
;
import
com.dianping.cat.message.spi.internal.DefaultMessageTree
;
...
@@ -61,7 +62,9 @@ public class HdfsMessageBucketManagerTest extends ComponentTestCase {
...
@@ -61,7 +62,9 @@ public class HdfsMessageBucketManagerTest extends ComponentTestCase {
localManager
.
setBaseDir
(
new
File
(
"target/bucket/hdfs/dump"
));
// make local and hdfs base dir same
localManager
.
setBaseDir
(
new
File
(
"target/bucket/hdfs/dump"
));
// make local and hdfs base dir same
for
(
int
i
=
0
;
i
<
num
;
i
++)
{
for
(
int
i
=
0
;
i
<
num
;
i
++)
{
localManager
.
storeMessage
(
newMessageTree
(
factory
.
getNextId
(),
i
,
now
+
i
*
10L
));
DefaultMessageTree
tree
=
newMessageTree
(
factory
.
getNextId
(),
i
,
now
+
i
*
10L
);
MessageId
id
=
MessageId
.
parse
(
tree
.
getMessageId
());
localManager
.
storeMessage
(
tree
,
id
);
}
}
localManager
.
close
();
localManager
.
close
();
...
...
cat-home/pom.xml
浏览文件 @
77a1d759
...
@@ -231,7 +231,7 @@ org.eclipse.jdt.core.compiler.compliance=1.6]]></content>
...
@@ -231,7 +231,7 @@ org.eclipse.jdt.core.compiler.compliance=1.6]]></content>
</build>
</build>
<properties>
<properties>
<packaging>
war
</packaging>
<packaging>
war
</packaging>
<env>
product
</env>
<env>
alpha
</env>
<test-framework.scope>
test
</test-framework.scope>
<test-framework.scope>
test
</test-framework.scope>
</properties>
</properties>
</project>
</project>
...
...
cat-home/src/main/java/com/dianping/cat/CatHomeModule.java
浏览文件 @
77a1d759
...
@@ -11,6 +11,7 @@ import com.dianping.cat.message.spi.internal.DefaultMessageHandler;
...
@@ -11,6 +11,7 @@ import com.dianping.cat.message.spi.internal.DefaultMessageHandler;
import
com.dianping.cat.report.task.DailyTaskProducer
;
import
com.dianping.cat.report.task.DailyTaskProducer
;
import
com.dianping.cat.report.task.DefaultTaskConsumer
;
import
com.dianping.cat.report.task.DefaultTaskConsumer
;
import
com.dianping.cat.report.task.monthreport.MonthReportBuilderTask
;
import
com.dianping.cat.report.task.monthreport.MonthReportBuilderTask
;
import
com.dianping.cat.report.view.DomainNavManager
;
import
com.dianping.cat.system.alarm.AlarmRuleCreator
;
import
com.dianping.cat.system.alarm.AlarmRuleCreator
;
import
com.dianping.cat.system.alarm.AlarmTask
;
import
com.dianping.cat.system.alarm.AlarmTask
;
import
com.dianping.cat.system.alarm.threshold.listener.ExceptionDataListener
;
import
com.dianping.cat.system.alarm.threshold.listener.ExceptionDataListener
;
...
@@ -33,6 +34,7 @@ public class CatHomeModule extends AbstractModule {
...
@@ -33,6 +34,7 @@ public class CatHomeModule extends AbstractModule {
ServerConfigManager
serverConfigManager
=
ctx
.
lookup
(
ServerConfigManager
.
class
);
ServerConfigManager
serverConfigManager
=
ctx
.
lookup
(
ServerConfigManager
.
class
);
ctx
.
lookup
(
MessageConsumer
.
class
,
"realtime"
);
ctx
.
lookup
(
MessageConsumer
.
class
,
"realtime"
);
ctx
.
lookup
(
DomainNavManager
.
class
);
DefaultTaskConsumer
taskConsumer
=
ctx
.
lookup
(
DefaultTaskConsumer
.
class
);
DefaultTaskConsumer
taskConsumer
=
ctx
.
lookup
(
DefaultTaskConsumer
.
class
);
DailyTaskProducer
dailyTaskProducer
=
ctx
.
lookup
(
DailyTaskProducer
.
class
);
DailyTaskProducer
dailyTaskProducer
=
ctx
.
lookup
(
DailyTaskProducer
.
class
);
...
...
cat-home/src/main/java/com/dianping/cat/build/AlarmComponentConfigurator.java
浏览文件 @
77a1d759
...
@@ -63,7 +63,7 @@ public class AlarmComponentConfigurator extends AbstractResourceConfigurator {
...
@@ -63,7 +63,7 @@ public class AlarmComponentConfigurator extends AbstractResourceConfigurator {
req
(
MailRecordDao
.
class
,
MailSMS
.
class
,
ServerConfigManager
.
class
));
req
(
MailRecordDao
.
class
,
MailSMS
.
class
,
ServerConfigManager
.
class
));
all
.
add
(
C
(
ThresholdRuleManager
.
class
).
//
all
.
add
(
C
(
ThresholdRuleManager
.
class
).
//
req
(
AlarmTemplateDao
.
class
,
AlarmRuleDao
.
class
));
req
(
AlarmTemplateDao
.
class
,
AlarmRuleDao
.
class
,
ServerConfigManager
.
class
));
all
.
add
(
C
(
ExceptionDataListener
.
class
).
//
all
.
add
(
C
(
ExceptionDataListener
.
class
).
//
req
(
EventDispatcher
.
class
,
ThresholdRuleManager
.
class
));
req
(
EventDispatcher
.
class
,
ThresholdRuleManager
.
class
));
...
...
cat-home/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
浏览文件 @
77a1d759
...
@@ -4,6 +4,7 @@ import java.util.ArrayList;
...
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.List
;
import
com.dainping.cat.consumer.dal.report.HostinfoDao
;
import
com.dainping.cat.consumer.dal.report.HostinfoDao
;
import
com.dainping.cat.consumer.dal.report.ProjectDao
;
import
com.dainping.cat.consumer.dal.report.ReportDao
;
import
com.dainping.cat.consumer.dal.report.ReportDao
;
import
com.dainping.cat.consumer.dal.report.TaskDao
;
import
com.dainping.cat.consumer.dal.report.TaskDao
;
import
com.dianping.cat.CatHomeModule
;
import
com.dianping.cat.CatHomeModule
;
...
@@ -48,6 +49,7 @@ import com.dianping.cat.report.task.sql.SqlReportBuilder;
...
@@ -48,6 +49,7 @@ import com.dianping.cat.report.task.sql.SqlReportBuilder;
import
com.dianping.cat.report.task.transaction.TransactionGraphCreator
;
import
com.dianping.cat.report.task.transaction.TransactionGraphCreator
;
import
com.dianping.cat.report.task.transaction.TransactionMerger
;
import
com.dianping.cat.report.task.transaction.TransactionMerger
;
import
com.dianping.cat.report.task.transaction.TransactionReportBuilder
;
import
com.dianping.cat.report.task.transaction.TransactionReportBuilder
;
import
com.dianping.cat.report.view.DomainNavManager
;
import
com.site.dal.jdbc.datasource.JdbcDataSourceConfigurationManager
;
import
com.site.dal.jdbc.datasource.JdbcDataSourceConfigurationManager
;
import
com.site.initialization.DefaultModuleManager
;
import
com.site.initialization.DefaultModuleManager
;
import
com.site.initialization.Module
;
import
com.site.initialization.Module
;
...
@@ -140,9 +142,11 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
...
@@ -140,9 +142,11 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
all
.
add
(
C
(
ModuleManager
.
class
,
DefaultModuleManager
.
class
)
//
all
.
add
(
C
(
ModuleManager
.
class
,
DefaultModuleManager
.
class
)
//
.
config
(
E
(
"topLevelModules"
).
value
(
CatHomeModule
.
ID
)));
.
config
(
E
(
"topLevelModules"
).
value
(
CatHomeModule
.
ID
)));
all
.
add
(
C
(
DomainNavManager
.
class
).
req
(
ProjectDao
.
class
));
// TODO
// TODO
//all.add(C(OtherJobReport.class).//
//
all.add(C(OtherJobReport.class).//
//
req(DailyreportDao.class, DomainManager.class));
// req(DailyreportDao.class, DomainManager.class));
all
.
add
(
C
(
DailyReportService
.
class
,
DailyReportServiceImpl
.
class
)
//
all
.
add
(
C
(
DailyReportService
.
class
,
DailyReportServiceImpl
.
class
)
//
.
req
(
DailyreportDao
.
class
));
.
req
(
DailyreportDao
.
class
));
...
...
cat-home/src/main/java/com/dianping/cat/report/page/AbstractReportModel.java
浏览文件 @
77a1d759
...
@@ -4,10 +4,13 @@ import java.text.SimpleDateFormat;
...
@@ -4,10 +4,13 @@ import java.text.SimpleDateFormat;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Map
;
import
com.dianping.cat.report.ReportPage
;
import
com.dianping.cat.report.ReportPage
;
import
com.dianping.cat.report.view.DomainNavManager
;
import
com.dianping.cat.report.view.HistoryNav
;
import
com.dianping.cat.report.view.HistoryNav
;
import
com.dianping.cat.report.view.UrlNav
;
import
com.dianping.cat.report.view.UrlNav
;
import
com.dianping.cat.report.view.DomainNavManager.Department
;
import
com.site.web.mvc.Action
;
import
com.site.web.mvc.Action
;
import
com.site.web.mvc.ActionContext
;
import
com.site.web.mvc.ActionContext
;
import
com.site.web.mvc.ViewModel
;
import
com.site.web.mvc.ViewModel
;
...
@@ -86,6 +89,10 @@ public abstract class AbstractReportModel<A extends Action, M extends ActionCont
...
@@ -86,6 +89,10 @@ public abstract class AbstractReportModel<A extends Action, M extends ActionCont
// required by report tag
// required by report tag
public
abstract
Collection
<
String
>
getDomains
();
public
abstract
Collection
<
String
>
getDomains
();
public
Map
<
String
,
Department
>
getDomainGroups
()
{
return
DomainNavManager
.
getDepartment
(
getDomains
());
}
public
Throwable
getException
()
{
public
Throwable
getException
()
{
return
m_exception
;
return
m_exception
;
}
}
...
...
cat-home/src/main/java/com/dianping/cat/report/view/DomainNavManager.java
0 → 100644
浏览文件 @
77a1d759
package
com.dianping.cat.report.view
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.TreeMap
;
import
org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
;
import
org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
;
import
com.dainping.cat.consumer.dal.report.Project
;
import
com.dainping.cat.consumer.dal.report.ProjectDao
;
import
com.dainping.cat.consumer.dal.report.ProjectEntity
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.helper.TimeUtil
;
import
com.site.dal.jdbc.DalException
;
import
com.site.helper.Threads
;
import
com.site.helper.Threads.Task
;
import
com.site.lookup.annotation.Inject
;
public
class
DomainNavManager
implements
Initializable
{
@Inject
private
ProjectDao
m_projectDao
;
private
static
Map
<
String
,
Project
>
m_projects
=
new
HashMap
<
String
,
Project
>();
public
static
Map
<
String
,
Department
>
getDepartment
(
Collection
<
String
>
domains
)
{
Map
<
String
,
Department
>
result
=
new
TreeMap
<
String
,
Department
>();
synchronized
(
m_projects
)
{
for
(
String
domain
:
domains
)
{
Project
project
=
m_projects
.
get
(
domain
);
String
department
=
"Default"
;
String
projectLine
=
"Default"
;
if
(
project
!=
null
)
{
department
=
project
.
getDepartment
();
projectLine
=
project
.
getProjectLine
();
}
Department
temp1
=
result
.
get
(
department
);
if
(
temp1
==
null
)
{
temp1
=
new
Department
();
result
.
put
(
department
,
temp1
);
}
temp1
.
findOrCreatProjectLine
(
projectLine
).
addDomain
(
domain
);
}
}
return
result
;
}
@Override
public
void
initialize
()
throws
InitializationException
{
try
{
DomainReload
reload
=
new
DomainReload
();
Threads
.
forGroup
(
"Cat"
).
start
(
reload
);
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
}
public
void
reloadDomainInfo
()
{
synchronized
(
m_projects
)
{
try
{
List
<
Project
>
projects
=
m_projectDao
.
findAll
(
ProjectEntity
.
READSET_FULL
);
if
(
projects
.
size
()
>
0
)
{
m_projects
.
clear
();
for
(
Project
project
:
projects
)
{
m_projects
.
put
(
project
.
getDomain
(),
project
);
}
}
}
catch
(
DalException
e
)
{
Cat
.
logError
(
e
);
}
}
}
public
static
class
Department
{
private
Map
<
String
,
ProjectLine
>
m_projectLines
=
new
HashMap
<
String
,
ProjectLine
>();
public
ProjectLine
findOrCreatProjectLine
(
String
projectLine
)
{
if
(
projectLine
==
null
)
{
projectLine
=
"Default"
;
}
ProjectLine
line
=
m_projectLines
.
get
(
projectLine
);
if
(
line
==
null
)
{
line
=
new
ProjectLine
();
m_projectLines
.
put
(
projectLine
,
line
);
}
return
line
;
}
public
Map
<
String
,
ProjectLine
>
getProjectLines
()
{
return
m_projectLines
;
}
public
void
setProjectLines
(
Map
<
String
,
ProjectLine
>
projectLines
)
{
m_projectLines
=
projectLines
;
}
}
public
class
DomainReload
implements
Task
{
@Override
public
String
getName
()
{
return
"Domain-Info-Reload"
;
}
@Override
public
void
run
()
{
boolean
active
=
true
;
while
(
active
)
{
try
{
reloadDomainInfo
();
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
try
{
Thread
.
sleep
(
3
*
TimeUtil
.
ONE_MINUTE
);
}
catch
(
InterruptedException
e
)
{
active
=
false
;
}
}
}
@Override
public
void
shutdown
()
{
}
}
public
static
class
ProjectLine
{
private
List
<
String
>
m_lineDomains
=
new
ArrayList
<
String
>();
public
void
addDomain
(
String
name
)
{
m_lineDomains
.
add
(
name
);
}
public
List
<
String
>
getLineDomains
()
{
return
m_lineDomains
;
}
public
void
setLineDomains
(
List
<
String
>
lineDomains
)
{
m_lineDomains
=
lineDomains
;
}
}
}
cat-home/src/main/java/com/dianping/cat/system/alarm/threshold/ThresholdRuleManager.java
浏览文件 @
77a1d759
...
@@ -12,6 +12,7 @@ import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
...
@@ -12,6 +12,7 @@ import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import
org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
;
import
org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.configuration.ServerConfigManager
;
import
com.dianping.cat.home.dal.alarm.AlarmRule
;
import
com.dianping.cat.home.dal.alarm.AlarmRule
;
import
com.dianping.cat.home.dal.alarm.AlarmRuleDao
;
import
com.dianping.cat.home.dal.alarm.AlarmRuleDao
;
import
com.dianping.cat.home.dal.alarm.AlarmRuleEntity
;
import
com.dianping.cat.home.dal.alarm.AlarmRuleEntity
;
...
@@ -38,6 +39,9 @@ public class ThresholdRuleManager implements Initializable {
...
@@ -38,6 +39,9 @@ public class ThresholdRuleManager implements Initializable {
@Inject
@Inject
private
AlarmTemplateDao
m_alarmTemplateDao
;
private
AlarmTemplateDao
m_alarmTemplateDao
;
@Inject
private
ServerConfigManager
m_configManager
;
public
Map
<
Integer
,
Date
>
m_exceptionModifyTimes
=
new
HashMap
<
Integer
,
Date
>();
public
Map
<
Integer
,
Date
>
m_exceptionModifyTimes
=
new
HashMap
<
Integer
,
Date
>();
public
Map
<
Integer
,
Date
>
m_serviceModifyTimes
=
new
HashMap
<
Integer
,
Date
>();
public
Map
<
Integer
,
Date
>
m_serviceModifyTimes
=
new
HashMap
<
Integer
,
Date
>();
...
@@ -123,7 +127,9 @@ public class ThresholdRuleManager implements Initializable {
...
@@ -123,7 +127,9 @@ public class ThresholdRuleManager implements Initializable {
ReloadThresholdRuleTask
task
=
new
ReloadThresholdRuleTask
();
ReloadThresholdRuleTask
task
=
new
ReloadThresholdRuleTask
();
Threads
.
forGroup
(
"Cat"
).
start
(
task
);
if
(
m_configManager
.
isJobMachine
())
{
Threads
.
forGroup
(
"Cat"
).
start
(
task
);
}
}
}
private
void
initalizeExceptionRule
()
{
private
void
initalizeExceptionRule
()
{
...
...
cat-home/src/main/resources/META-INF/dal/jdbc/report-dal.xml
浏览文件 @
77a1d759
...
@@ -2,7 +2,8 @@
...
@@ -2,7 +2,8 @@
<entities
do-package=
"com.dianping.cat.home.dal.report"
gen=
"true"
>
<entities
do-package=
"com.dianping.cat.home.dal.report"
gen=
"true"
>
<entity
name=
"dailyreport"
table=
"dailyreport"
alias=
"dr"
>
<entity
name=
"dailyreport"
table=
"dailyreport"
alias=
"dr"
>
<member
name=
"count"
value-type=
"int"
select-expr=
"COUNT(*)"
all=
"false"
/>
<member
name=
"count"
value-type=
"int"
select-expr=
"COUNT(*)"
all=
"false"
/>
<var
name=
"start-date"
value-type=
"Date"
/>
<var
name=
"start-date"
value-type=
"Date"
/>
<var
name=
"end-date"
value-type=
"Date"
/>
<var
name=
"end-date"
value-type=
"Date"
/>
<readsets>
<readsets>
...
@@ -35,7 +36,8 @@
...
@@ -35,7 +36,8 @@
AND
<FIELD
name=
'name'
/>
= ${name}
AND
<FIELD
name=
'name'
/>
= ${name}
]]>
</statement>
]]>
</statement>
</query>
</query>
<query
name=
"find-all-by-domain-name-duration"
type=
"SELECT"
multiple=
"true"
>
<query
name=
"find-all-by-domain-name-duration"
type=
"SELECT"
multiple=
"true"
>
<param
name=
"start-date"
/>
<param
name=
"start-date"
/>
<param
name=
"end-date"
/>
<param
name=
"end-date"
/>
<param
name=
"domain"
/>
<param
name=
"domain"
/>
...
@@ -50,7 +52,8 @@
...
@@ -50,7 +52,8 @@
AND type = 1
AND type = 1
]]>
</statement>
]]>
</statement>
</query>
</query>
<query
name=
"find-all-by-domain-name-duration"
type=
"SELECT"
multiple=
"true"
>
<query
name=
"find-all-by-domain-name-duration"
type=
"SELECT"
multiple=
"true"
>
<param
name=
"start-date"
/>
<param
name=
"start-date"
/>
<param
name=
"end-date"
/>
<param
name=
"end-date"
/>
<param
name=
"domain"
/>
<param
name=
"domain"
/>
...
@@ -110,7 +113,8 @@
...
@@ -110,7 +113,8 @@
AND type =1;
AND type =1;
]]>
</statement>
]]>
</statement>
</query>
</query>
<query
name=
"find-database-all-by-domain-name-duration"
type=
"SELECT"
multiple=
"true"
>
<query
name=
"find-database-all-by-domain-name-duration"
type=
"SELECT"
multiple=
"true"
>
<param
name=
"start-date"
/>
<param
name=
"start-date"
/>
<param
name=
"end-date"
/>
<param
name=
"end-date"
/>
<param
name=
"domain"
/>
<param
name=
"domain"
/>
...
@@ -142,7 +146,8 @@
...
@@ -142,7 +146,8 @@
AND type = 2
AND type = 2
]]>
</statement>
]]>
</statement>
</query>
</query>
<query
name=
"find-database-all-by-period"
type=
"SELECT"
multiple=
"true"
>
<query
name=
"find-database-all-by-period"
type=
"SELECT"
multiple=
"true"
>
<param
name=
"start-date"
/>
<param
name=
"start-date"
/>
<param
name=
"end-date"
/>
<param
name=
"end-date"
/>
<statement>
<![CDATA[
<statement>
<![CDATA[
...
@@ -194,7 +199,8 @@
...
@@ -194,7 +199,8 @@
(
<VALUES/>
)
(
<VALUES/>
)
]]>
</statement>
]]>
</statement>
</query>
</query>
<query
name=
"find-by-domain-name-ip-duration"
type=
"SELECT"
multiple=
"true"
>
<query
name=
"find-by-domain-name-ip-duration"
type=
"SELECT"
multiple=
"true"
>
<param
name=
"start-date"
/>
<param
name=
"start-date"
/>
<param
name=
"end-date"
/>
<param
name=
"end-date"
/>
<param
name=
"ip"
/>
<param
name=
"ip"
/>
...
@@ -229,7 +235,8 @@
...
@@ -229,7 +235,8 @@
AND
<FIELD
name=
'period'
/>
= ${start-date}
AND
<FIELD
name=
'period'
/>
= ${start-date}
]]>
</statement>
]]>
</statement>
</query>
</query>
<query
name=
"find-ip-by-domain-name-duration"
type=
"SELECT"
multiple=
"true"
>
<query
name=
"find-ip-by-domain-name-duration"
type=
"SELECT"
multiple=
"true"
>
<param
name=
"start-date"
/>
<param
name=
"start-date"
/>
<param
name=
"end-date"
/>
<param
name=
"end-date"
/>
<param
name=
"domain"
/>
<param
name=
"domain"
/>
...
@@ -245,7 +252,8 @@
...
@@ -245,7 +252,8 @@
AND
<FIELD
name=
'period'
/>
<
${end-date}
AND
<FIELD
name=
'period'
/>
<
${end-date}
]]>
</statement>
]]>
</statement>
</query>
</query>
<query
name=
"find-domain-by-name-duration"
type=
"SELECT"
multiple=
"true"
>
<query
name=
"find-domain-by-name-duration"
type=
"SELECT"
multiple=
"true"
>
<param
name=
"start-date"
/>
<param
name=
"start-date"
/>
<param
name=
"end-date"
/>
<param
name=
"end-date"
/>
<param
name=
"name"
/>
<param
name=
"name"
/>
...
...
cat-home/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
77a1d759
...
@@ -367,6 +367,15 @@
...
@@ -367,6 +367,15 @@
<topLevelModules>
cat-home
</topLevelModules>
<topLevelModules>
cat-home
</topLevelModules>
</configuration>
</configuration>
</component>
</component>
<component>
<role>
com.dianping.cat.report.view.DomainNavManager
</role>
<implementation>
com.dianping.cat.report.view.DomainNavManager
</implementation>
<requirements>
<requirement>
<role>
com.dainping.cat.consumer.dal.report.ProjectDao
</role>
</requirement>
</requirements>
</component>
<component>
<component>
<role>
com.dianping.cat.report.service.DailyReportService
</role>
<role>
com.dianping.cat.report.service.DailyReportService
</role>
<implementation>
com.dianping.cat.report.service.impl.DailyReportServiceImpl
</implementation>
<implementation>
com.dianping.cat.report.service.impl.DailyReportServiceImpl
</implementation>
...
@@ -2599,6 +2608,9 @@
...
@@ -2599,6 +2608,9 @@
<requirement>
<requirement>
<role>
com.dianping.cat.home.dal.alarm.AlarmRuleDao
</role>
<role>
com.dianping.cat.home.dal.alarm.AlarmRuleDao
</role>
</requirement>
</requirement>
<requirement>
<role>
com.dianping.cat.configuration.ServerConfigManager
</role>
</requirement>
</requirements>
</requirements>
</component>
</component>
<component>
<component>
...
...
cat-home/src/main/resources/freemaker/event.ftl
浏览文件 @
77a1d759
<h4><a href="${current}" target="_blank">EventReport</a></h4>
<h4><a href="${current}" target="_blank">EventReport</a></h4>
<table rules="all">
<table rules="all"
border="1"
>
<tr>
<tr>
</tr>
<tr>
<td></td>
<td>Type</td>
<td>Type</td>
<td>Total Count</td>
<td>Total Count</td>
<td>Failure Count</td>
<td>Failure Count</td>
<td>Failure%</td>
<td>Failure%</td>
<td>TPS</td>
<td>TPS</td>
<td>Link</td>
<td>Link</td>
<td></td>
</tr>
</tr>
<#list types as item>
<#list types as item>
<tr>
<tr>
<td></td>
<td>${item.type.id}</td>
<td>${item.type.id}</td>
<td style="text-align:right">${item.type.totalCount}</td>
<td style="text-align:right">${item.type.totalCount}</td>
<td style="text-align:right">${item.type.failCount}</td>
<td style="text-align:right">${item.type.failCount}</td>
<td style="text-align:right">${item.type.failPercent?string("0.00")}</td>
<td style="text-align:right">${item.type.failPercent?string("0.00")}</td>
<td style="text-align:right">${item.type.tps?string("0.00")}</td>
<td style="text-align:right">${item.type.tps?string("0.00")}</td>
<td style="text-align:right"><a href="${item.url}" target="_blank">Graph</a></td>
<td style="text-align:right"><a href="${item.url}" target="_blank">Graph</a></td>
<td></td>
</tr>
</tr>
</#list>
</#list>
<tr></tr>
</table>
</table>
cat-home/src/main/resources/freemaker/exceptionAlarm.ftl
浏览文件 @
77a1d759
<h4>异常超过阀值告警</h4>
<h4>异常超过阀值告警</h4>
<table rules="all">
<table rules="all"
border="1"
>
<tr>
<tr>
</tr>
<tr>
<td></td>
<td>项目名称</td>
<td>项目名称</td>
<td>${domain}</td>
<td>${domain}</td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<td></td>
<td>告警时间</td>
<td>告警时间</td>
<td>${date?string("yyyy-MM-dd HH:mm:ss")}</td>
<td>${date?string("yyyy-MM-dd HH:mm:ss")}</td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<td></td>
<td>告警规则</td>
<td>告警规则</td>
<td>${rule}</td>
<td>${rule}</td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<td></td>
<td>错误个数</td>
<td>错误个数</td>
<td>${count}</td>
<td>${count}</td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<td></td>
<td>CAT链接</td>
<td>CAT链接</td>
<td> <a href="${url}" target="_blank">link</a></td>
<td> <a href="${url}" target="_blank">link</a></td>
<td></td>
</tr>
</tr>
<tr></tr>
</table>
</table>
\ No newline at end of file
cat-home/src/main/resources/freemaker/problem.ftl
浏览文件 @
77a1d759
<h4><a href="${current}" target="_blank">ProblemReport</a></h4>
<h4><a href="${current}" target="_blank">ProblemReport</a></h4>
<table rules="all">
<table rules="all"
border="1"
>
<tr>
<tr>
</tr>
<tr>
<td></td>
<td>Type</td>
<td>Type</td>
<td>Total Count</td>
<td>Total Count</td>
<td>Link</td>
<td>Link</td>
<td></td>
</tr>
</tr>
<#list types as item>
<#list types as item>
<tr>
<tr>
<td></td>
<td>${item.type}</td>
<td>${item.type}</td>
<td style="text-align:right">${item.count}</td>
<td style="text-align:right">${item.count}</td>
<td style="text-align:right"><a href="${item.url}" target="_blank">Graph</a></td>
<td style="text-align:right"><a href="${item.url}" target="_blank">Graph</a></td>
</tr>
</tr>
</#list>
</#list>
<tr></tr>
</table>
</table>
cat-home/src/main/resources/freemaker/serviceAlarm.ftl
浏览文件 @
77a1d759
<h4>服务调用失败告警</h4>
<h4>服务调用失败告警</h4>
<table rules="all">
<table rules="all"
border="1"
>
<tr>
<tr>
</tr>
<tr>
<td></td>
<td>项目名称</td>
<td>项目名称</td>
<td>${domain}</td>
<td>${domain}</td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<td></td>
<td>告警时间</td>
<td>告警时间</td>
<td>${date?string("yyyy-MM-dd HH:mm:ss")}</td>
<td>${date?string("yyyy-MM-dd HH:mm:ss")}</td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<td></td>
<td>告警规则</td>
<td>告警规则</td>
<td>${rule}</td>
<td>${rule}</td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<td></td>
<td>错误个数</td>
<td>错误个数</td>
<td>${count}</td>
<td>${count}</td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<td></td>
<td>CAT链接</td>
<td>CAT链接</td>
<td> <a href="${url}" target="_blank">link</a></td>
<td> <a href="${url}" target="_blank">link</a></td>
<td></td>
</tr>
</tr>
<tr></tr>
</table>
</table>
\ No newline at end of file
cat-home/src/main/resources/freemaker/transaction.ftl
浏览文件 @
77a1d759
<h4><a href="${current}" target="_blank">TransactionReport</a></h4>
<h4><a href="${current}" target="_blank">TransactionReport</a></h4>
<table rules="all">
<table rules="all"
border="1"
>
<tr>
<tr>
</tr>
<tr>
<td></td>
<td>Type</td>
<td>Type</td>
<td>Total Count</td>
<td>Total Count</td>
<td>Failure Count</td>
<td>Failure Count</td>
...
@@ -11,11 +8,9 @@
...
@@ -11,11 +8,9 @@
<td>Avg(ms)</td>
<td>Avg(ms)</td>
<td>TPS</td>
<td>TPS</td>
<td>Link</td>
<td>Link</td>
<td></td>
</tr>
</tr>
<#list types as item>
<#list types as item>
<tr>
<tr>
<td></td>
<td>${item.type.id}</td>
<td>${item.type.id}</td>
<td style="text-align:right">${item.type.totalCount}</td>
<td style="text-align:right">${item.type.totalCount}</td>
<td style="text-align:right">${item.type.failCount}</td>
<td style="text-align:right">${item.type.failCount}</td>
...
@@ -25,6 +20,5 @@
...
@@ -25,6 +20,5 @@
<td style="text-align:right"><a href="${item.url}" target="_blank">Graph</a></td>
<td style="text-align:right"><a href="${item.url}" target="_blank">Graph</a></td>
</tr>
</tr>
</#list>
</#list>
<tr></tr>
</table>
</table>
cat-home/src/main/webapp/WEB-INF/tags/historyReport.tag
浏览文件 @
77a1d759
<%@ tag trimDirectiveWhitespaces="true"%>
<%@ tag trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="a" uri="/WEB-INF/app.tld"%>
<%@ taglib prefix="a" uri="/WEB-INF/app.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="w" uri="http://www.unidal.org/web/core"%>
<%@ taglib prefix="res" uri="http://www.unidal.org/webres"%>
<%@ taglib prefix="res" uri="http://www.unidal.org/webres"%>
<%@ attribute name="title"%>
<%@ attribute name="title"%>
<%@ attribute name="navUrlPrefix"%>
<%@ attribute name="navUrlPrefix"%>
...
@@ -35,7 +36,7 @@
...
@@ -35,7 +36,7 @@
</td>
</td>
</tr>
</tr>
</table>
</table>
<table class="navbar">
<
%-- <
table class="navbar">
<tr>
<tr>
<td class="domain" rowspan="2" style="vertical-align:top;">
<td class="domain" rowspan="2" style="vertical-align:top;">
<div class="domain">
<div class="domain">
...
@@ -52,14 +53,38 @@
...
@@ -52,14 +53,38 @@
</div>
</div>
</td>
</td>
</tr>
</tr>
</table>
</table> --%>
<jsp:doBody />
<div class="navbar">
<table border="1" rules="all">
<c:forEach var="item" items="${model.domainGroups}">
<tr>
<c:set var="detail" value="${item.value}" />
<td class="department" rowspan="${w:size(detail.projectLines)}">${item.key}</td>
<c:forEach var="productline" items="${detail.projectLines}" varStatus="index">
<c:if test="${index.index != 0}">
<tr>
</c:if>
<td class="department">${productline.key}</td>
<td><div class="domain"><c:forEach var="domain" items="${productline.value.lineDomains}"> <c:choose><c:when test="${model.domain eq domain}"><a
href="?op=history&domain=${domain}&date=${model.date}&reportType=${model.reportType}"
class="current">[ ${domain} ]</a></c:when>
<c:otherwise><a
href="?op=history&domain=${domain}&date=${model.date}&reportType=${model.reportType}">[ ${domain} ]</a>
</c:otherwise></c:choose>
</c:forEach>
</div>
</td><c:if test="${index.index != 0}"></tr></c:if>
</c:forEach></tr>
</c:forEach>
</table>
</div>
<jsp:doBody />
<table class="footer">
<table class="footer">
<tr>
<tr>
<td>[ end ]</td>
<td>[ end ]</td>
</tr>
</tr>
</table>
</table>
</div>
</div>
</a:body>
</a:body>
\ No newline at end of file
cat-home/src/main/webapp/WEB-INF/tags/hourlyReport.tag
浏览文件 @
77a1d759
<%@ tag trimDirectiveWhitespaces="true" %>
<%@ tag trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="a" uri="/WEB-INF/app.tld"%>
<%@ taglib prefix="a" uri="/WEB-INF/app.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="res" uri="http://www.unidal.org/webres"%>
<%@ taglib prefix="w" uri="http://www.unidal.org/web/core"%>
<%@ attribute name="title"%>
<%@ taglib prefix="res" uri="http://www.unidal.org/webres"%>
<%@ attribute name="navUrlPrefix"%>
<%@ attribute name="title"%>
<%@ attribute name="timestamp"%>
<%@ attribute name="navUrlPrefix"%>
<%@ attribute name="subtitle" fragment="true"%>
<%@ attribute name="timestamp"%>
<%@ attribute name="subtitle" fragment="true"%>
<a:body>
<a:body>
<res:useCss value='${res.css.local.report_css}' target="head-css" />
<res:useCss value='${res.css.local.report_css}' target="head-css" />
<div class="report">
<table class="header">
<div class="report">
<tr>
<table class="header">
<td class="title"> <jsp:invoke fragment="subtitle"/></td>
<tr>
<td class="switch"><a href="${model.baseUri}?op=history&domain=${model.domain}">Switch To History Mode</a>
<td class="title"> <jsp:invoke fragment="subtitle"/></td>
</td>
<td class="switch"><a href="${model.baseUri}?op=history&domain=${model.domain}">Switch To History Mode</a>
<td class="nav">
</td>
<c:forEach var="nav" items="${model.navs}">
<td class="nav">
[ <a href="${model.baseUri}?date=${model.date}&step=${nav.hours}&${navUrlPrefix}">${nav.title}</a> ]
<c:forEach var="nav" items="${model.navs}">
</c:forEach>
[ <a href="${model.baseUri}?date=${model.date}&step=${nav.hours}&${navUrlPrefix}">${nav.title}</a> ]
[ <a href="${model.baseUri}?${navUrlPrefix}">now</a> ]
</c:forEach>
</td>
[ <a href="${model.baseUri}?${navUrlPrefix}">now</a> ]
</tr>
</td>
</table>
</tr>
</table>
<table class="navbar">
<tr>
<%-- <table class="navbar">
<td class="domain">
<tr>
<div class="domain">
<td class="domain">
<c:forEach var="domain" items="${model.domains}">
<div class="domain">
<c:choose>
<c:forEach var="domain" items="${model.domains}">
<c:when test="${model.domain eq domain}">
<c:choose>
<a href="${model.baseUri}?domain=${domain}&date=${model.date}" class="current">[ ${domain} ]</a>
<c:when test="${model.domain eq domain}">
</c:when>
<a href="${model.baseUri}?domain=${domain}&date=${model.date}" class="current">[ ${domain} ]</a>
<c:otherwise>
</c:when>
<a href="${model.baseUri}?domain=${domain}&date=${model.date}">[ ${domain} ]</a>
<c:otherwise>
</c:otherwise>
<a href="${model.baseUri}?domain=${domain}&date=${model.date}">[ ${domain} ]</a>
</c:choose>
</c:otherwise>
</c:forEach>
</c:choose>
</div>
</c:forEach>
</td>
</div>
</tr>
</td>
</table>
</tr>
</table> --%>
<jsp:doBody />
<div class="navbar">
<table border="1" rules="all">
<table class="footer">
<c:forEach var="item" items="${model.domainGroups}">
<tr>
<tr>
<td>[ end ]</td>
<c:set var="detail" value="${item.value}" />
</tr>
<td class="department" rowspan="${w:size(detail.projectLines)}">${item.key}</td>
</table>
<c:forEach var="productline" items="${detail.projectLines}" varStatus="index">
</div>
<c:if test="${index.index != 0}">
<tr>
</c:if>
<td class="department">${productline.key}</td>
<td><div class="domain"><c:forEach var="domain" items="${productline.value.lineDomains}"> <c:choose><c:when test="${model.domain eq domain}"><a
href="${model.baseUri}?domain=${domain}&date=${model.date}"
class="current">[ ${domain} ]</a></c:when>
<c:otherwise><a
href="${model.baseUri}?domain=${domain}&date=${model.date}">[ ${domain} ]</a>
</c:otherwise></c:choose>
</c:forEach>
</div>
</td><c:if test="${index.index != 0}"></tr></c:if>
</c:forEach></tr>
</c:forEach>
</table>
</div>
<jsp:doBody />
<table class="footer">
<tr>
<td>[ end ]</td>
</tr>
</table>
</div>
</a:body>
</a:body>
\ No newline at end of file
cat-home/src/main/webapp/css/body.css
浏览文件 @
77a1d759
...
@@ -168,4 +168,17 @@ a.heartbeat {
...
@@ -168,4 +168,17 @@ a.heartbeat {
text-align
:
right
;
text-align
:
right
;
margin-right
:
20px
;
margin-right
:
20px
;
pedding-right
:
20px
;
pedding-right
:
20px
;
}
.department
{
text-align
:
center
;
font-size
:
medium
;
font-weight
:
bold
;
width
:
80px
;
}
.domain
{
text-align
:
left
;
font-weight
:
bold
;
padding-left
:
4px
;
}
}
\ No newline at end of file
cat-home/src/main/webapp/css/report.css
浏览文件 @
77a1d759
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
text-align
:
left
;
text-align
:
left
;
font-size
:
small
;
font-size
:
small
;
font-weight
:
bold
;
font-weight
:
bold
;
padding-left
:
4px
;
}
}
.report
.navbar
.domain
A
{
.report
.navbar
.domain
A
{
...
...
cat-home/src/test/resources/com/dianping/cat/system/notify/EventRender.txt
浏览文件 @
77a1d759
<h4><a href="http://cat.qa.dianpingoa.com/cat/r/e?op=history&domain=MobileApi&date=2012051700&reportType=day" target="_blank">EventReport</a></h4>
<h4><a href="http://cat.qa.dianpingoa.com/cat/r/e?op=history&domain=MobileApi&date=2012051700&reportType=day" target="_blank">EventReport</a></h4>
<table rules="all">
<table rules="all"
border="1"
>
<tr>
<tr>
</tr>
<tr>
<td></td>
<td>Type</td>
<td>Type</td>
<td>Total Count</td>
<td>Total Count</td>
<td>Failure Count</td>
<td>Failure Count</td>
<td>Failure%</td>
<td>Failure%</td>
<td>TPS</td>
<td>TPS</td>
<td>Link</td>
<td>Link</td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<td></td>
<td>User</td>
<td>User</td>
<td style="text-align:right">1,705</td>
<td style="text-align:right">1,705</td>
<td style="text-align:right">0</td>
<td style="text-align:right">0</td>
<td style="text-align:right">0.00</td>
<td style="text-align:right">0.00</td>
<td style="text-align:right">0.00</td>
<td style="text-align:right">0.00</td>
<td style="text-align:right"><a href="http://cat.qa.dianpingoa.com/cat/r/e?op=historyGraph&domain=MobileApi&date=2012051700&ip=All&reportType=day&type=User" target="_blank">Graph</a></td>
<td style="text-align:right"><a href="http://cat.qa.dianpingoa.com/cat/r/e?op=historyGraph&domain=MobileApi&date=2012051700&ip=All&reportType=day&type=User" target="_blank">Graph</a></td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<td></td>
<td>User1</td>
<td>User1</td>
<td style="text-align:right">1,705</td>
<td style="text-align:right">1,705</td>
<td style="text-align:right">0</td>
<td style="text-align:right">0</td>
<td style="text-align:right">0.00</td>
<td style="text-align:right">0.00</td>
<td style="text-align:right">0.00</td>
<td style="text-align:right">0.00</td>
<td style="text-align:right"><a href="http://cat.qa.dianpingoa.com/cat/r/e?op=historyGraph&domain=MobileApi&date=2012051700&ip=All&reportType=day&type=User1" target="_blank">Graph</a></td>
<td style="text-align:right"><a href="http://cat.qa.dianpingoa.com/cat/r/e?op=historyGraph&domain=MobileApi&date=2012051700&ip=All&reportType=day&type=User1" target="_blank">Graph</a></td>
<td></td>
</tr>
</tr>
<tr></tr>
</table>
</table>
\ No newline at end of file
cat-home/src/test/resources/com/dianping/cat/system/notify/ProblemRender.txt
浏览文件 @
77a1d759
<h4><a href="http://cat.qa.dianpingoa.com/cat/r/p?op=history&domain=Cat&date=2012062616&reportType=day" target="_blank">ProblemReport</a></h4>
<h4><a href="http://cat.qa.dianpingoa.com/cat/r/p?op=history&domain=Cat&date=2012062616&reportType=day" target="_blank">ProblemReport</a></h4>
<table rules="all">
<table rules="all"
border="1"
>
<tr>
<tr>
</tr>
<tr>
<td></td>
<td>Type</td>
<td>Type</td>
<td>Total Count</td>
<td>Total Count</td>
<td>Link</td>
<td>Link</td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<td></td>
<td>error</td>
<td>error</td>
<td style="text-align:right">10</td>
<td style="text-align:right">10</td>
<td style="text-align:right"><a href="http://cat.qa.dianpingoa.com/cat/r/p?op=historyGraph&domain=Cat&date=2012062616&ip=All&reportType=day&type=error" target="_blank">Graph</a></td>
<td style="text-align:right"><a href="http://cat.qa.dianpingoa.com/cat/r/p?op=historyGraph&domain=Cat&date=2012062616&ip=All&reportType=day&type=error" target="_blank">Graph</a></td>
</tr>
</tr>
<tr>
<tr>
<td></td>
<td>failure</td>
<td>failure</td>
<td style="text-align:right">10</td>
<td style="text-align:right">10</td>
<td style="text-align:right"><a href="http://cat.qa.dianpingoa.com/cat/r/p?op=historyGraph&domain=Cat&date=2012062616&ip=All&reportType=day&type=failure" target="_blank">Graph</a></td>
<td style="text-align:right"><a href="http://cat.qa.dianpingoa.com/cat/r/p?op=historyGraph&domain=Cat&date=2012062616&ip=All&reportType=day&type=failure" target="_blank">Graph</a></td>
</tr>
</tr>
<tr>
<tr>
<td></td>
<td>heartbeat</td>
<td>heartbeat</td>
<td style="text-align:right">1</td>
<td style="text-align:right">1</td>
<td style="text-align:right"><a href="http://cat.qa.dianpingoa.com/cat/r/p?op=historyGraph&domain=Cat&date=2012062616&ip=All&reportType=day&type=heartbeat" target="_blank">Graph</a></td>
<td style="text-align:right"><a href="http://cat.qa.dianpingoa.com/cat/r/p?op=historyGraph&domain=Cat&date=2012062616&ip=All&reportType=day&type=heartbeat" target="_blank">Graph</a></td>
</tr>
</tr>
<tr>
<tr>
<td></td>
<td>url</td>
<td>url</td>
<td style="text-align:right">10</td>
<td style="text-align:right">10</td>
<td style="text-align:right"><a href="http://cat.qa.dianpingoa.com/cat/r/p?op=historyGraph&domain=Cat&date=2012062616&ip=All&reportType=day&type=url" target="_blank">Graph</a></td>
<td style="text-align:right"><a href="http://cat.qa.dianpingoa.com/cat/r/p?op=historyGraph&domain=Cat&date=2012062616&ip=All&reportType=day&type=url" target="_blank">Graph</a></td>
</tr>
</tr>
<tr></tr>
</table>
</table>
\ No newline at end of file
cat-home/src/test/resources/com/dianping/cat/system/notify/TransactionRender.txt
浏览文件 @
77a1d759
<h4><a href="http://cat.qa.dianpingoa.com/cat/r/t?op=history&domain=Cat&date=2012051713&reportType=day" target="_blank">TransactionReport</a></h4>
<h4><a href="http://cat.qa.dianpingoa.com/cat/r/t?op=history&domain=Cat&date=2012051713&reportType=day" target="_blank">TransactionReport</a></h4>
<table rules="all">
<table rules="all"
border="1"
>
<tr>
<tr>
</tr>
<tr>
<td></td>
<td>Type</td>
<td>Type</td>
<td>Total Count</td>
<td>Total Count</td>
<td>Failure Count</td>
<td>Failure Count</td>
...
@@ -11,10 +8,8 @@
...
@@ -11,10 +8,8 @@
<td>Avg(ms)</td>
<td>Avg(ms)</td>
<td>TPS</td>
<td>TPS</td>
<td>Link</td>
<td>Link</td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<td></td>
<td>Task1</td>
<td>Task1</td>
<td style="text-align:right">2</td>
<td style="text-align:right">2</td>
<td style="text-align:right">0</td>
<td style="text-align:right">0</td>
...
@@ -24,7 +19,6 @@
...
@@ -24,7 +19,6 @@
<td style="text-align:right"><a href="http://cat.qa.dianpingoa.com/cat/r/t?op=historyGraph&domain=Cat&date=2012051713&ip=All&reportType=day&type=Task1" target="_blank">Graph</a></td>
<td style="text-align:right"><a href="http://cat.qa.dianpingoa.com/cat/r/t?op=historyGraph&domain=Cat&date=2012051713&ip=All&reportType=day&type=Task1" target="_blank">Graph</a></td>
</tr>
</tr>
<tr>
<tr>
<td></td>
<td>URL</td>
<td>URL</td>
<td style="text-align:right">1</td>
<td style="text-align:right">1</td>
<td style="text-align:right">0</td>
<td style="text-align:right">0</td>
...
@@ -33,5 +27,4 @@
...
@@ -33,5 +27,4 @@
<td style="text-align:right">0.00</td>
<td style="text-align:right">0.00</td>
<td style="text-align:right"><a href="http://cat.qa.dianpingoa.com/cat/r/t?op=historyGraph&domain=Cat&date=2012051713&ip=All&reportType=day&type=URL" target="_blank">Graph</a></td>
<td style="text-align:right"><a href="http://cat.qa.dianpingoa.com/cat/r/t?op=historyGraph&domain=Cat&date=2012051713&ip=All&reportType=day&type=URL" target="_blank">Graph</a></td>
</tr>
</tr>
<tr></tr>
</table>
</table>
cat-job/src/main/java/com/dianping/cat/job/joblet/ConversionJoblet.java
浏览文件 @
77a1d759
...
@@ -10,6 +10,7 @@ import com.dianping.cat.job.spi.joblet.Joblet;
...
@@ -10,6 +10,7 @@ import com.dianping.cat.job.spi.joblet.Joblet;
import
com.dianping.cat.job.spi.joblet.JobletContext
;
import
com.dianping.cat.job.spi.joblet.JobletContext
;
import
com.dianping.cat.job.spi.joblet.JobletMeta
;
import
com.dianping.cat.job.spi.joblet.JobletMeta
;
import
com.dianping.cat.job.spi.mapreduce.MessageTreeWritable
;
import
com.dianping.cat.job.spi.mapreduce.MessageTreeWritable
;
import
com.dianping.cat.message.internal.MessageId
;
import
com.dianping.cat.message.internal.MessageIdFactory
;
import
com.dianping.cat.message.internal.MessageIdFactory
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.storage.dump.LocalMessageBucket
;
import
com.dianping.cat.storage.dump.LocalMessageBucket
;
...
@@ -56,7 +57,8 @@ public class ConversionJoblet extends ContainerHolder implements Joblet<IntWrita
...
@@ -56,7 +57,8 @@ public class ConversionJoblet extends ContainerHolder implements Joblet<IntWrita
try
{
try
{
tree
.
setMessageId
(
m_factory
.
getNextId
());
tree
.
setMessageId
(
m_factory
.
getNextId
());
m_bucket
.
store
(
tree
);
MessageId
id
=
MessageId
.
parse
(
tree
.
getMessageId
());
m_bucket
.
store
(
tree
,
id
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
e
);
System
.
out
.
println
(
e
);
}
}
...
...
script/Cat.sql
浏览文件 @
77a1d759
...
@@ -73,18 +73,6 @@ CREATE TABLE `location` (
...
@@ -73,18 +73,6 @@ CREATE TABLE `location` (
UNIQUE
KEY
`transaction_date_lat_lng`
(
`transaction_date`
,
`lat`
,
`lng`
)
UNIQUE
KEY
`transaction_date_lat_lng`
(
`transaction_date`
,
`lat`
,
`lng`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'用于热点图地理位置表'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'用于热点图地理位置表'
;
CREATE
TABLE
`maillog`
(
`id`
int
(
10
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'主键'
,
`address`
varchar
(
500
)
NOT
NULL
COMMENT
'收件人'
,
`title`
varchar
(
500
)
NOT
NULL
COMMENT
'邮件标题'
,
`content`
text
NOT
NULL
COMMENT
'邮件内容'
,
`sendtime`
datetime
NOT
NULL
COMMENT
'发送时间'
,
`status`
int
(
11
)
NOT
NULL
COMMENT
'发送状态(0、发送成功;1、发送失败)'
,
`error`
varchar
(
1000
)
DEFAULT
NULL
COMMENT
'发送失败错误信息'
,
`cc`
varchar
(
500
)
DEFAULT
NULL
COMMENT
'邮件抄送人'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'邮件提醒发送记录'
;
CREATE
TABLE
`monthreport`
(
CREATE
TABLE
`monthreport`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`name`
varchar
(
50
)
DEFAULT
NULL
,
`name`
varchar
(
50
)
DEFAULT
NULL
,
...
@@ -230,18 +218,19 @@ CREATE TABLE `scheduledReportSubscription` (
...
@@ -230,18 +218,19 @@ CREATE TABLE `scheduledReportSubscription` (
PRIMARY
KEY
(
`scheduled_report_id`
,
`user_id`
)
PRIMARY
KEY
(
`scheduled_report_id`
,
`user_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'用户订阅定时报表记录表'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'用户订阅定时报表记录表'
;
CREATE
TABLE
'department'
(
CREATE
TABLE
`project`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`name`
varchar
(
50
)
NOT
NULL
COMMENT
'部门名称'
,
`domain`
varchar
(
50
)
NOT
NULL
COMMENT
'项目名称'
,
`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
'项目组邮件'
,
`creation_date`
datetime
DEFAULT
NULL
COMMENT
'创建时间'
,
`modify_date`
datetime
DEFAULT
NULL
COMMENT
'修改时间'
,
PRIMARY
KEY
(
`id`
)
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'公司部门基本信息'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'项目基本信息'
;
CREATE
TABLE
'domainInfo'
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`name`
varchar
(
50
)
NOT
NULL
COMMENT
'项目名称'
,
`parent_name`
varchar
(
50
)
DEFAULT
NULL
COMMENT
'父项目名称'
,
`department_id`
int
(
11
)
DEFAULT
-
1
COMMENT
'项目所属部门名称'
,
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
COMMENT
=
'项目的基本信息'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录