Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
20e27f4f
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,发现更多精彩内容 >>
提交
20e27f4f
编写于
10月 29, 2014
作者:
Y
youyong205
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #584 from leonindy/master
fix serval bugs found in code review
上级
3ab103dd
8939e565
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
166 addition
and
269 deletion
+166
-269
cat-home/src/main/java/com/dianping/cat/build/AlarmComponentConfigurator.java
...va/com/dianping/cat/build/AlarmComponentConfigurator.java
+16
-26
cat-home/src/main/java/com/dianping/cat/report/page/cache/CacheReport.java
.../java/com/dianping/cat/report/page/cache/CacheReport.java
+39
-38
cat-home/src/main/java/com/dianping/cat/report/task/alert/heartbeat/HeartbeatAlert.java
...nping/cat/report/task/alert/heartbeat/HeartbeatAlert.java
+20
-5
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/AlertSummaryContentGenerator.java
...port/task/alert/summary/AlertSummaryContentGenerator.java
+8
-2
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/AlertSummaryExecutor.java
...g/cat/report/task/alert/summary/AlertSummaryExecutor.java
+9
-22
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/AlertSummaryFTLDecorator.java
...t/report/task/alert/summary/AlertSummaryFTLDecorator.java
+0
-17
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/AlterationDecorator.java
...ng/cat/report/task/alert/summary/AlterationDecorator.java
+0
-17
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/AlterationSummaryContentGenerator.java
...task/alert/summary/AlterationSummaryContentGenerator.java
+10
-5
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/FailureDecorator.java
...nping/cat/report/task/alert/summary/FailureDecorator.java
+0
-17
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/FailureSummaryContentGenerator.java
...rt/task/alert/summary/FailureSummaryContentGenerator.java
+8
-2
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/SummaryContentGenerator.java
...at/report/task/alert/summary/SummaryContentGenerator.java
+7
-3
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/SummaryDataGenerator.java
...g/cat/report/task/alert/summary/SummaryDataGenerator.java
+0
-12
cat-home/src/main/resources/META-INF/plexus/components.xml
cat-home/src/main/resources/META-INF/plexus/components.xml
+31
-73
cat-home/src/main/webapp/jsp/report/cache/cache.jsp
cat-home/src/main/webapp/jsp/report/cache/cache.jsp
+9
-15
cat-home/src/main/webapp/jsp/report/cache/cacheHistory.jsp
cat-home/src/main/webapp/jsp/report/cache/cacheHistory.jsp
+9
-15
未找到文件。
cat-home/src/main/java/com/dianping/cat/build/AlarmComponentConfigurator.java
浏览文件 @
20e27f4f
...
...
@@ -16,6 +16,7 @@ import com.dianping.cat.consumer.metric.MetricConfigManager;
import
com.dianping.cat.consumer.metric.ProductLineConfigManager
;
import
com.dianping.cat.consumer.problem.ProblemAnalyzer
;
import
com.dianping.cat.consumer.top.TopAnalyzer
;
import
com.dianping.cat.consumer.transaction.TransactionAnalyzer
;
import
com.dianping.cat.core.config.ConfigDao
;
import
com.dianping.cat.home.dal.report.AlertDao
;
import
com.dianping.cat.home.dal.report.AlertSummaryDao
;
...
...
@@ -67,17 +68,13 @@ import com.dianping.cat.report.task.alert.sender.spliter.Spliter;
import
com.dianping.cat.report.task.alert.sender.spliter.SpliterManager
;
import
com.dianping.cat.report.task.alert.sender.spliter.WeixinSpliter
;
import
com.dianping.cat.report.task.alert.service.AlertEntityService
;
import
com.dianping.cat.report.task.alert.summary.AlertSummary
Data
Generator
;
import
com.dianping.cat.report.task.alert.summary.AlertSummary
Content
Generator
;
import
com.dianping.cat.report.task.alert.summary.AlertSummaryExecutor
;
import
com.dianping.cat.report.task.alert.summary.AlertSummaryFTLDecorator
;
import
com.dianping.cat.report.task.alert.summary.AlertSummaryGenerator
;
import
com.dianping.cat.report.task.alert.summary.AlertSummaryManager
;
import
com.dianping.cat.report.task.alert.summary.AlterationDataGenerator
;
import
com.dianping.cat.report.task.alert.summary.AlterationDecorator
;
import
com.dianping.cat.report.task.alert.summary.FailureDataGenerator
;
import
com.dianping.cat.report.task.alert.summary.FailureDecorator
;
import
com.dianping.cat.report.task.alert.summary.SummaryDataGenerator
;
import
com.dianping.cat.report.task.alert.summary.SummaryDecorator
;
import
com.dianping.cat.report.task.alert.summary.AlterationSummaryContentGenerator
;
import
com.dianping.cat.report.task.alert.summary.FailureSummaryContentGenerator
;
import
com.dianping.cat.report.task.alert.summary.SummaryContentGenerator
;
import
com.dianping.cat.report.task.alert.system.SystemAlert
;
import
com.dianping.cat.report.task.alert.thirdParty.HttpConnector
;
import
com.dianping.cat.report.task.alert.thirdParty.ThirdPartyAlert
;
...
...
@@ -185,8 +182,9 @@ class AlarmComponentConfigurator extends AbstractResourceConfigurator {
all
.
add
(
C
(
HeartbeatAlert
.
class
)
.
req
(
ProductLineConfigManager
.
class
,
BaselineService
.
class
)
.
req
(
ProjectService
.
class
,
RemoteMetricReportService
.
class
,
HeartbeatRuleConfigManager
.
class
,
DataChecker
.
class
,
AlertManager
.
class
,
AlertInfo
.
class
).
req
(
ModelService
.
class
,
HeartbeatAnalyzer
.
ID
));
.
req
(
RemoteMetricReportService
.
class
,
HeartbeatRuleConfigManager
.
class
,
DataChecker
.
class
,
AlertManager
.
class
,
AlertInfo
.
class
).
req
(
ModelService
.
class
,
HeartbeatAnalyzer
.
ID
,
"m_service"
)
.
req
(
ModelService
.
class
,
TransactionAnalyzer
.
ID
,
"m_transactionService"
));
all
.
add
(
C
(
SystemAlert
.
class
).
req
(
ProductLineConfigManager
.
class
,
BaselineService
.
class
,
AlertInfo
.
class
).
req
(
RemoteMetricReportService
.
class
,
SystemRuleConfigManager
.
class
,
DataChecker
.
class
,
AlertManager
.
class
));
...
...
@@ -217,28 +215,20 @@ class AlarmComponentConfigurator extends AbstractResourceConfigurator {
all
.
add
(
C
(
AlertSummaryManager
.
class
).
req
(
AlertSummaryDao
.
class
));
all
.
add
(
C
(
Summary
DataGenerator
.
class
,
AlertSummaryDataGenerator
.
ID
,
AlertSummaryData
Generator
.
class
).
req
(
all
.
add
(
C
(
Summary
ContentGenerator
.
class
,
AlertSummaryContentGenerator
.
ID
,
AlertSummaryContent
Generator
.
class
).
req
(
AlertSummaryGenerator
.
class
,
AlertSummaryManager
.
class
));
all
.
add
(
C
(
Summary
DataGenerator
.
class
,
FailureDataGenerator
.
ID
,
FailureData
Generator
.
class
).
req
(
all
.
add
(
C
(
Summary
ContentGenerator
.
class
,
FailureSummaryContentGenerator
.
ID
,
FailureSummaryContent
Generator
.
class
).
req
(
ModelService
.
class
,
ProblemAnalyzer
.
ID
));
all
.
add
(
C
(
Summary
DataGenerator
.
class
,
AlterationDataGenerator
.
ID
,
AlterationData
Generator
.
class
).
req
(
all
.
add
(
C
(
Summary
ContentGenerator
.
class
,
AlterationSummaryContentGenerator
.
ID
,
AlterationSummaryContent
Generator
.
class
).
req
(
AlterationDao
.
class
));
all
.
add
(
C
(
SummaryDecorator
.
class
,
AlertSummaryFTLDecorator
.
ID
,
AlertSummaryFTLDecorator
.
class
));
all
.
add
(
C
(
SummaryDecorator
.
class
,
FailureDecorator
.
ID
,
FailureDecorator
.
class
));
all
.
add
(
C
(
SummaryDecorator
.
class
,
AlterationDecorator
.
ID
,
AlterationDecorator
.
class
));
all
.
add
(
C
(
AlertSummaryExecutor
.
class
).
req
(
SenderManager
.
class
)
.
req
(
SummaryDataGenerator
.
class
,
AlertSummaryDataGenerator
.
ID
,
"m_alertSummaryDataGenerator"
)
.
req
(
SummaryDataGenerator
.
class
,
FailureDataGenerator
.
ID
,
"m_failureDataGenerator"
)
.
req
(
SummaryDataGenerator
.
class
,
AlterationDataGenerator
.
ID
,
"m_alterationDataGenerator"
)
.
req
(
SummaryDecorator
.
class
,
AlertSummaryFTLDecorator
.
ID
,
"m_alertSummaryDecorator"
)
.
req
(
SummaryDecorator
.
class
,
FailureDecorator
.
ID
,
"m_failureDecorator"
)
.
req
(
SummaryDecorator
.
class
,
AlterationDecorator
.
ID
,
"m_alterationDecorator"
));
all
.
add
(
C
(
AlertSummaryExecutor
.
class
)
.
req
(
SenderManager
.
class
)
.
req
(
SummaryContentGenerator
.
class
,
AlertSummaryContentGenerator
.
ID
,
"m_alertSummaryContentGenerator"
)
.
req
(
SummaryContentGenerator
.
class
,
FailureSummaryContentGenerator
.
ID
,
"m_failureSummaryContentGenerator"
)
.
req
(
SummaryContentGenerator
.
class
,
AlterationSummaryContentGenerator
.
ID
,
"m_alterationSummaryContentGenerator"
));
return
all
;
}
...
...
cat-home/src/main/java/com/dianping/cat/report/page/cache/CacheReport.java
浏览文件 @
20e27f4f
...
...
@@ -103,16 +103,6 @@ public class CacheReport {
return
result
;
}
public
List
<
String
>
getAllMethods
()
{
CacheNameItem
allItem
=
m_nameItems
.
get
(
ALL
);
if
(
allItem
!=
null
)
{
return
new
ArrayList
<
String
>(
allItem
.
getMethodCounts
().
keySet
());
}
else
{
return
new
ArrayList
<
String
>();
}
}
public
java
.
util
.
Date
getStartTime
()
{
return
m_startTime
;
}
...
...
@@ -160,14 +150,18 @@ public class CacheReport {
private
long
m_missed
;
private
long
m_getCount
;
private
long
m_add
;
private
long
m_get
;
private
long
m_mget
;
private
long
m_remove
;
private
TransactionName
m_name
;
private
String
m_category
;
private
Map
<
String
,
Long
>
m_methodCounts
=
new
HashMap
<
String
,
Long
>();
public
void
add
(
TransactionName
transactionName
,
EventName
eventName
,
String
method
)
{
long
transactionTotalCount
=
transactionName
.
getTotalCount
();
...
...
@@ -177,16 +171,16 @@ public class CacheReport {
m_name
.
setTps
(
m_name
.
getTps
()
+
transactionName
.
getTps
());
if
(!
StringUtil
.
isEmpty
(
method
))
{
Long
value
=
m_methodCounts
.
get
(
method
);
if
(
value
==
null
)
{
value
=
0L
;
}
m_methodCounts
.
put
(
method
,
value
+
transactionTotalCount
);
if
(
"get"
.
equals
(
method
))
{
m_get
+=
transactionTotalCount
;
m_missed
=
m_missed
+
eventName
.
getTotalCount
();
m_getCount
=
m_getCount
+
transactionTotalCount
;
m_hited
=
1
-
(
double
)
m_missed
/
m_getCount
;
m_hited
=
1
-
(
double
)
m_missed
/
m_get
;
}
else
if
(
"mget"
.
equals
(
method
))
{
m_mget
+=
transactionTotalCount
;
}
else
if
(
"add"
.
equals
(
method
))
{
m_add
+=
transactionTotalCount
;
}
else
if
(
"remove"
.
equals
(
method
))
{
m_remove
+=
transactionTotalCount
;
}
}
}
...
...
@@ -199,26 +193,28 @@ public class CacheReport {
return
m_missed
;
}
public
TransactionName
getName
()
{
return
m_
name
;
public
long
getAdd
()
{
return
m_
add
;
}
public
String
getCategory
()
{
return
m_
category
;
public
long
getGet
()
{
return
m_
get
;
}
public
Map
<
String
,
Long
>
getMethodCounts
()
{
return
m_m
ethodCounts
;
public
long
getMget
()
{
return
m_m
get
;
}
public
long
getMethodCount
(
String
method
)
{
Long
count
=
m_methodCounts
.
get
(
method
);
public
long
getRemove
()
{
return
m_remove
;
}
if
(
count
==
null
)
{
return
0L
;
}
else
{
return
count
;
public
TransactionName
getName
()
{
return
m_name
;
}
public
String
getCategory
()
{
return
m_category
;
}
public
void
setHited
(
double
hited
)
{
...
...
@@ -260,9 +256,14 @@ public class CacheReport {
return
(
int
)
(
o2
.
getName
().
getAvg
()
*
1000
-
o1
.
getName
().
getAvg
()
*
1000
);
}
else
if
(
m_sort
.
equals
(
"name"
))
{
return
o1
.
getName
().
getId
().
compareTo
(
o2
.
getName
().
getId
());
}
else
if
(
m_sort
.
startsWith
(
"method:"
))
{
String
method
=
m_sort
.
substring
(
7
);
return
(
int
)
(
o2
.
getMethodCount
(
method
)
-
o1
.
getMethodCount
(
method
));
}
else
if
(
m_sort
.
equals
(
"add"
))
{
return
(
int
)
(
o2
.
getAdd
()
-
o1
.
getAdd
());
}
else
if
(
m_sort
.
equals
(
"get"
))
{
return
(
int
)
(
o2
.
getGet
()
-
o1
.
getGet
());
}
else
if
(
m_sort
.
equals
(
"mget"
))
{
return
(
int
)
(
o2
.
getMget
()
-
o1
.
getMget
());
}
else
if
(
m_sort
.
equals
(
"remove"
))
{
return
(
int
)
(
o2
.
getRemove
()
-
o1
.
getRemove
());
}
return
0
;
}
...
...
cat-home/src/main/java/com/dianping/cat/report/task/alert/heartbeat/HeartbeatAlert.java
浏览文件 @
20e27f4f
package
com.dianping.cat.report.task.alert.heartbeat
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
...
...
@@ -14,6 +15,8 @@ import com.dianping.cat.consumer.heartbeat.HeartbeatAnalyzer;
import
com.dianping.cat.consumer.heartbeat.model.entity.HeartbeatReport
;
import
com.dianping.cat.consumer.heartbeat.model.entity.Machine
;
import
com.dianping.cat.consumer.heartbeat.model.entity.Period
;
import
com.dianping.cat.consumer.transaction.TransactionAnalyzer
;
import
com.dianping.cat.consumer.transaction.model.entity.TransactionReport
;
import
com.dianping.cat.helper.TimeHelper
;
import
com.dianping.cat.home.rule.entity.Condition
;
import
com.dianping.cat.home.rule.entity.Config
;
...
...
@@ -25,16 +28,15 @@ import com.dianping.cat.report.task.alert.BaseAlert;
import
com.dianping.cat.report.task.alert.sender.AlertEntity
;
import
com.dianping.cat.service.ModelRequest
;
import
com.dianping.cat.service.ModelResponse
;
import
com.dianping.cat.service.ProjectService
;
public
class
HeartbeatAlert
extends
BaseAlert
implements
Task
{
@Inject
private
ProjectService
m_projectService
;
@Inject
(
type
=
ModelService
.
class
,
value
=
HeartbeatAnalyzer
.
ID
)
private
ModelService
<
HeartbeatReport
>
m_service
;
@Inject
(
type
=
ModelService
.
class
,
value
=
TransactionAnalyzer
.
ID
)
private
ModelService
<
TransactionReport
>
m_transactionService
;
private
static
final
String
[]
m_metrics
=
{
"ThreadCount"
,
"DaemonCount"
,
"TotalStartedCount"
,
"CatThreadCount"
,
"PiegonThreadCount"
,
"HttpThreadCount"
,
"NewGcCount"
,
"OldGcCount"
,
"MemoryFree"
,
"HeapUsage"
,
"NoneHeapUsage"
,
"SystemLoadAverage"
,
"CatMessageOverflow"
,
"CatMessageSize"
};
...
...
@@ -220,6 +222,17 @@ public class HeartbeatAlert extends BaseAlert implements Task {
}
}
private
Set
<
String
>
queryDomains
()
{
Set
<
String
>
domains
=
new
HashSet
<
String
>();
ModelRequest
request
=
new
ModelRequest
(
"cat"
,
System
.
currentTimeMillis
());
if
(
m_transactionService
.
isEligable
(
request
))
{
ModelResponse
<
TransactionReport
>
response
=
m_transactionService
.
invoke
(
request
);
domains
.
addAll
(
response
.
getModel
().
getDomainNames
());
}
return
domains
;
}
@Override
public
void
run
()
{
boolean
active
=
true
;
...
...
@@ -234,7 +247,9 @@ public class HeartbeatAlert extends BaseAlert implements Task {
long
current
=
System
.
currentTimeMillis
();
try
{
for
(
String
domain
:
m_projectService
.
findAllDomain
())
{
Set
<
String
>
domains
=
queryDomains
();
for
(
String
domain
:
domains
)
{
try
{
processDomain
(
domain
);
}
catch
(
Exception
e
)
{
...
...
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/AlertSummary
Data
Generator.java
→
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/AlertSummary
Content
Generator.java
浏览文件 @
20e27f4f
...
...
@@ -10,7 +10,7 @@ import org.unidal.lookup.annotation.Inject;
import
com.dianping.cat.home.alert.summary.entity.AlertSummary
;
public
class
AlertSummary
DataGenerator
extends
SummaryData
Generator
{
public
class
AlertSummary
ContentGenerator
extends
SummaryContent
Generator
{
@Inject
private
AlertSummaryGenerator
m_alertSummaryGenerator
;
...
...
@@ -18,7 +18,7 @@ public class AlertSummaryDataGenerator extends SummaryDataGenerator {
@Inject
private
AlertSummaryManager
m_alertSummaryManager
;
public
static
final
String
ID
=
"AlertSummary
Data
Generator"
;
public
static
final
String
ID
=
"AlertSummary
Content
Generator"
;
@SuppressWarnings
(
"unchecked"
)
private
Map
<
Object
,
Object
>
gatherDomainsForDependBusiness
(
Map
<
Object
,
Object
>
map
)
{
...
...
@@ -64,4 +64,10 @@ public class AlertSummaryDataGenerator extends SummaryDataGenerator {
public
String
getID
()
{
return
ID
;
}
@Override
protected
String
getTemplateAddress
()
{
return
"summary.ftl"
;
}
}
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/AlertSummaryExecutor.java
浏览文件 @
20e27f4f
...
...
@@ -5,7 +5,6 @@ import java.util.ArrayList;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.unidal.lookup.annotation.Inject
;
...
...
@@ -19,23 +18,14 @@ import com.site.lookup.util.StringUtils;
public
class
AlertSummaryExecutor
{
@Inject
(
type
=
Summary
DataGenerator
.
class
,
value
=
AlertSummaryData
Generator
.
ID
)
private
Summary
DataGenerator
m_alertSummaryData
Generator
;
@Inject
(
type
=
Summary
ContentGenerator
.
class
,
value
=
AlertSummaryContent
Generator
.
ID
)
private
Summary
ContentGenerator
m_alertSummaryContent
Generator
;
@Inject
(
type
=
Summary
DataGenerator
.
class
,
value
=
FailureData
Generator
.
ID
)
private
Summary
DataGenerator
m_failureData
Generator
;
@Inject
(
type
=
Summary
ContentGenerator
.
class
,
value
=
FailureSummaryContent
Generator
.
ID
)
private
Summary
ContentGenerator
m_failureSummaryContent
Generator
;
@Inject
(
type
=
SummaryDataGenerator
.
class
,
value
=
AlterationDataGenerator
.
ID
)
private
SummaryDataGenerator
m_alterationDataGenerator
;
@Inject
(
type
=
SummaryDecorator
.
class
,
value
=
AlertSummaryFTLDecorator
.
ID
)
private
SummaryDecorator
m_alertSummaryDecorator
;
@Inject
(
type
=
SummaryDecorator
.
class
,
value
=
FailureDecorator
.
ID
)
private
SummaryDecorator
m_failureDecorator
;
@Inject
(
type
=
SummaryDecorator
.
class
,
value
=
AlterationDecorator
.
ID
)
private
SummaryDecorator
m_alterationDecorator
;
@Inject
(
type
=
SummaryContentGenerator
.
class
,
value
=
AlterationSummaryContentGenerator
.
ID
)
private
SummaryContentGenerator
m_alterationSummaryContentGenerator
;
@Inject
private
SenderManager
m_sendManager
;
...
...
@@ -72,16 +62,13 @@ public class AlertSummaryExecutor {
try
{
StringBuilder
builder
=
new
StringBuilder
();
Map
<
Object
,
Object
>
summaryModel
=
m_alertSummaryDataGenerator
.
generateModel
(
domain
,
date
);
String
summaryContent
=
m_alertSummaryDecorator
.
generateHtml
(
summaryModel
);
String
summaryContent
=
m_alertSummaryContentGenerator
.
generateHtml
(
domain
,
date
);
builder
.
append
(
summaryContent
);
Map
<
Object
,
Object
>
failureModel
=
m_failureDataGenerator
.
generateModel
(
domain
,
date
);
String
failureContext
=
m_failureDecorator
.
generateHtml
(
failureModel
);
String
failureContext
=
m_failureSummaryContentGenerator
.
generateHtml
(
domain
,
date
);
builder
.
append
(
failureContext
);
Map
<
Object
,
Object
>
alterationModel
=
m_alterationDataGenerator
.
generateModel
(
domain
,
date
);
String
alterationContext
=
m_alterationDecorator
.
generateHtml
(
alterationModel
);
String
alterationContext
=
m_alterationSummaryContentGenerator
.
generateHtml
(
domain
,
date
);
builder
.
append
(
alterationContext
);
t
.
setStatus
(
Transaction
.
SUCCESS
);
...
...
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/AlertSummaryFTLDecorator.java
已删除
100644 → 0
浏览文件 @
3ab103dd
package
com.dianping.cat.report.task.alert.summary
;
public
class
AlertSummaryFTLDecorator
extends
SummaryDecorator
{
public
static
final
String
ID
=
"AlertSummaryFTLDecorator"
;
@Override
protected
String
getID
()
{
return
ID
;
}
@Override
protected
String
getTemplateAddress
()
{
return
"summary.ftl"
;
}
}
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/AlterationDecorator.java
已删除
100644 → 0
浏览文件 @
3ab103dd
package
com.dianping.cat.report.task.alert.summary
;
public
class
AlterationDecorator
extends
SummaryDecorator
{
public
static
final
String
ID
=
"AlterationDecorator"
;
@Override
protected
String
getID
()
{
return
ID
;
}
@Override
protected
String
getTemplateAddress
()
{
return
"alterationInfo.ftl"
;
}
}
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/Alteration
Data
Generator.java
→
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/Alteration
SummaryContent
Generator.java
浏览文件 @
20e27f4f
...
...
@@ -13,13 +13,13 @@ import com.dianping.cat.home.dal.report.Alteration;
import
com.dianping.cat.home.dal.report.AlterationDao
;
import
com.dianping.cat.home.dal.report.AlterationEntity
;
public
class
AlterationDataGenerator
extends
SummaryDataGenerator
{
public
static
final
String
ID
=
"AlterationDataGenerator"
;
public
class
AlterationSummaryContentGenerator
extends
SummaryContentGenerator
{
@Inject
private
AlterationDao
m_alterationDao
;
public
static
final
String
ID
=
"AlterationSummaryContentGenerator"
;
@Override
public
Map
<
Object
,
Object
>
generateModel
(
String
domain
,
Date
date
)
{
Map
<
Object
,
Object
>
dataMap
=
new
HashMap
<
Object
,
Object
>();
...
...
@@ -36,13 +36,18 @@ public class AlterationDataGenerator extends SummaryDataGenerator {
return
dataMap
;
}
@Override
public
String
getID
()
{
return
ID
;
}
private
Date
getStartDate
(
Date
date
)
{
return
new
Date
(
date
.
getTime
()
-
AlertSummaryExecutor
.
SUMMARY_DURATION
);
}
@Override
p
ublic
String
getID
()
{
return
ID
;
p
rotected
String
getTemplateAddress
()
{
return
"alterationInfo.ftl"
;
}
}
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/FailureDecorator.java
已删除
100644 → 0
浏览文件 @
3ab103dd
package
com.dianping.cat.report.task.alert.summary
;
public
class
FailureDecorator
extends
SummaryDecorator
{
public
static
final
String
ID
=
"FailureDecorator"
;
@Override
protected
String
getID
()
{
return
ID
;
}
@Override
protected
String
getTemplateAddress
()
{
return
"errorInfo.ftl"
;
}
}
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/Failure
Data
Generator.java
→
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/Failure
SummaryContent
Generator.java
浏览文件 @
20e27f4f
...
...
@@ -19,9 +19,9 @@ import com.dianping.cat.report.page.problem.ProblemStatistics.TypeStatistics;
import
com.dianping.cat.service.ModelRequest
;
import
com.dianping.cat.service.ModelResponse
;
public
class
Failure
DataGenerator
extends
SummaryData
Generator
{
public
class
Failure
SummaryContentGenerator
extends
SummaryContent
Generator
{
public
static
final
String
ID
=
"FailureD
ataGene
rator"
;
public
static
final
String
ID
=
"FailureD
eco
rator"
;
@Inject
(
type
=
ModelService
.
class
,
value
=
ProblemAnalyzer
.
ID
)
private
ModelService
<
ProblemReport
>
m_service
;
...
...
@@ -89,4 +89,10 @@ public class FailureDataGenerator extends SummaryDataGenerator {
public
String
getID
()
{
return
ID
;
}
@Override
protected
String
getTemplateAddress
()
{
return
"errorInfo.ftl"
;
}
}
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/Summary
Deco
rator.java
→
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/Summary
ContentGene
rator.java
浏览文件 @
20e27f4f
package
com.dianping.cat.report.task.alert.summary
;
import
java.io.StringWriter
;
import
java.util.Date
;
import
java.util.Map
;
import
org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
;
...
...
@@ -11,11 +12,14 @@ import com.dianping.cat.Cat;
import
freemarker.template.Configuration
;
import
freemarker.template.Template
;
public
abstract
class
Summary
Deco
rator
implements
Initializable
{
public
abstract
class
Summary
ContentGene
rator
implements
Initializable
{
public
Configuration
m_configuration
;
public
String
generateHtml
(
Map
<
Object
,
Object
>
dataMap
)
{
protected
abstract
Map
<
Object
,
Object
>
generateModel
(
String
domain
,
Date
date
);
public
String
generateHtml
(
String
domain
,
Date
date
)
{
Map
<
Object
,
Object
>
dataMap
=
generateModel
(
domain
,
date
);
StringWriter
sw
=
new
StringWriter
(
5000
);
try
{
...
...
@@ -40,5 +44,5 @@ public abstract class SummaryDecorator implements Initializable {
protected
abstract
String
getTemplateAddress
();
p
rotected
abstract
String
getID
();
p
ublic
abstract
String
getID
();
}
cat-home/src/main/java/com/dianping/cat/report/task/alert/summary/SummaryDataGenerator.java
已删除
100644 → 0
浏览文件 @
3ab103dd
package
com.dianping.cat.report.task.alert.summary
;
import
java.util.Date
;
import
java.util.Map
;
public
abstract
class
SummaryDataGenerator
{
public
abstract
Map
<
Object
,
Object
>
generateModel
(
String
domain
,
Date
date
);
public
abstract
String
getID
();
}
cat-home/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
20e27f4f
...
...
@@ -2706,9 +2706,6 @@
<requirement>
<role>
com.dianping.cat.report.baseline.BaselineService
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.service.ProjectService
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.report.task.alert.RemoteMetricReportService
</role>
</requirement>
...
...
@@ -2727,6 +2724,12 @@
<requirement>
<role>
com.dianping.cat.report.page.model.spi.ModelService
</role>
<role-hint>
heartbeat
</role-hint>
<field-name>
m_service
</field-name>
</requirement>
<requirement>
<role>
com.dianping.cat.report.page.model.spi.ModelService
</role>
<role-hint>
transaction
</role-hint>
<field-name>
m_transactionService
</field-name>
</requirement>
</requirements>
</component>
...
...
@@ -2898,9 +2901,9 @@
</requirements>
</component>
<component>
<role>
com.dianping.cat.report.task.alert.summary.Summary
Data
Generator
</role>
<role-hint>
AlertSummary
Data
Generator
</role-hint>
<implementation>
com.dianping.cat.report.task.alert.summary.AlertSummary
Data
Generator
</implementation>
<role>
com.dianping.cat.report.task.alert.summary.Summary
Content
Generator
</role>
<role-hint>
AlertSummary
Content
Generator
</role-hint>
<implementation>
com.dianping.cat.report.task.alert.summary.AlertSummary
Content
Generator
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.report.task.alert.summary.AlertSummaryGenerator
</role>
...
...
@@ -2911,9 +2914,9 @@
</requirements>
</component>
<component>
<role>
com.dianping.cat.report.task.alert.summary.Summary
Data
Generator
</role>
<role-hint>
FailureD
ataGene
rator
</role-hint>
<implementation>
com.dianping.cat.report.task.alert.summary.Failure
Data
Generator
</implementation>
<role>
com.dianping.cat.report.task.alert.summary.Summary
Content
Generator
</role>
<role-hint>
FailureD
eco
rator
</role-hint>
<implementation>
com.dianping.cat.report.task.alert.summary.Failure
SummaryContent
Generator
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.report.page.model.spi.ModelService
</role>
...
...
@@ -2922,30 +2925,15 @@
</requirements>
</component>
<component>
<role>
com.dianping.cat.report.task.alert.summary.Summary
Data
Generator
</role>
<role-hint>
Alteration
Data
Generator
</role-hint>
<implementation>
com.dianping.cat.report.task.alert.summary.Alteration
Data
Generator
</implementation>
<role>
com.dianping.cat.report.task.alert.summary.Summary
Content
Generator
</role>
<role-hint>
Alteration
SummaryContent
Generator
</role-hint>
<implementation>
com.dianping.cat.report.task.alert.summary.Alteration
SummaryContent
Generator
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.home.dal.report.AlterationDao
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.report.task.alert.summary.SummaryDecorator
</role>
<role-hint>
AlertSummaryFTLDecorator
</role-hint>
<implementation>
com.dianping.cat.report.task.alert.summary.AlertSummaryFTLDecorator
</implementation>
</component>
<component>
<role>
com.dianping.cat.report.task.alert.summary.SummaryDecorator
</role>
<role-hint>
FailureDecorator
</role-hint>
<implementation>
com.dianping.cat.report.task.alert.summary.FailureDecorator
</implementation>
</component>
<component>
<role>
com.dianping.cat.report.task.alert.summary.SummaryDecorator
</role>
<role-hint>
AlterationDecorator
</role-hint>
<implementation>
com.dianping.cat.report.task.alert.summary.AlterationDecorator
</implementation>
</component>
<component>
<role>
com.dianping.cat.report.task.alert.summary.AlertSummaryExecutor
</role>
<implementation>
com.dianping.cat.report.task.alert.summary.AlertSummaryExecutor
</implementation>
...
...
@@ -2954,34 +2942,19 @@
<role>
com.dianping.cat.report.task.alert.sender.sender.SenderManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.report.task.alert.summary.SummaryDataGenerator
</role>
<role-hint>
AlertSummaryDataGenerator
</role-hint>
<field-name>
m_alertSummaryDataGenerator
</field-name>
</requirement>
<requirement>
<role>
com.dianping.cat.report.task.alert.summary.SummaryDataGenerator
</role>
<role-hint>
FailureDataGenerator
</role-hint>
<field-name>
m_failureDataGenerator
</field-name>
</requirement>
<requirement>
<role>
com.dianping.cat.report.task.alert.summary.SummaryDataGenerator
</role>
<role-hint>
AlterationDataGenerator
</role-hint>
<field-name>
m_alterationDataGenerator
</field-name>
</requirement>
<requirement>
<role>
com.dianping.cat.report.task.alert.summary.SummaryDecorator
</role>
<role-hint>
AlertSummaryFTLDecorator
</role-hint>
<field-name>
m_alertSummaryDecorator
</field-name>
<role>
com.dianping.cat.report.task.alert.summary.SummaryContentGenerator
</role>
<role-hint>
AlertSummaryContentGenerator
</role-hint>
<field-name>
m_alertSummaryContentGenerator
</field-name>
</requirement>
<requirement>
<role>
com.dianping.cat.report.task.alert.summary.Summary
Deco
rator
</role>
<role>
com.dianping.cat.report.task.alert.summary.Summary
ContentGene
rator
</role>
<role-hint>
FailureDecorator
</role-hint>
<field-name>
m_failure
Deco
rator
</field-name>
<field-name>
m_failure
SummaryContentGene
rator
</field-name>
</requirement>
<requirement>
<role>
com.dianping.cat.report.task.alert.summary.Summary
Deco
rator
</role>
<role-hint>
Alteration
Deco
rator
</role-hint>
<field-name>
m_alteration
Deco
rator
</field-name>
<role>
com.dianping.cat.report.task.alert.summary.Summary
ContentGene
rator
</role>
<role-hint>
Alteration
SummaryContentGene
rator
</role-hint>
<field-name>
m_alteration
SummaryContentGene
rator
</field-name>
</requirement>
</requirements>
</component>
...
...
@@ -4100,34 +4073,19 @@
<implementation>
com.dianping.cat.report.task.alert.summary.AlertSummaryExecutor
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.report.task.alert.summary.SummaryDataGenerator
</role>
<role-hint>
AlertSummaryDataGenerator
</role-hint>
<field-name>
m_alertSummaryDataGenerator
</field-name>
</requirement>
<requirement>
<role>
com.dianping.cat.report.task.alert.summary.SummaryDataGenerator
</role>
<role-hint>
FailureDataGenerator
</role-hint>
<field-name>
m_failureDataGenerator
</field-name>
</requirement>
<requirement>
<role>
com.dianping.cat.report.task.alert.summary.SummaryDataGenerator
</role>
<role-hint>
AlterationDataGenerator
</role-hint>
<field-name>
m_alterationDataGenerator
</field-name>
</requirement>
<requirement>
<role>
com.dianping.cat.report.task.alert.summary.SummaryDecorator
</role>
<role-hint>
AlertSummaryFTLDecorator
</role-hint>
<field-name>
m_alertSummaryDecorator
</field-name>
<role>
com.dianping.cat.report.task.alert.summary.SummaryContentGenerator
</role>
<role-hint>
AlertSummaryContentGenerator
</role-hint>
<field-name>
m_alertSummaryContentGenerator
</field-name>
</requirement>
<requirement>
<role>
com.dianping.cat.report.task.alert.summary.Summary
Deco
rator
</role>
<role>
com.dianping.cat.report.task.alert.summary.Summary
ContentGene
rator
</role>
<role-hint>
FailureDecorator
</role-hint>
<field-name>
m_failure
Deco
rator
</field-name>
<field-name>
m_failure
SummaryContentGene
rator
</field-name>
</requirement>
<requirement>
<role>
com.dianping.cat.report.task.alert.summary.Summary
Deco
rator
</role>
<role-hint>
Alteration
Deco
rator
</role-hint>
<field-name>
m_alteration
Deco
rator
</field-name>
<role>
com.dianping.cat.report.task.alert.summary.Summary
ContentGene
rator
</role>
<role-hint>
Alteration
SummaryContentGene
rator
</role-hint>
<field-name>
m_alteration
SummaryContentGene
rator
</field-name>
</requirement>
<requirement>
<role>
com.dianping.cat.report.task.alert.sender.sender.SenderManager
</role>
...
...
cat-home/src/main/webapp/jsp/report/cache/cache.jsp
浏览文件 @
20e27f4f
...
...
@@ -77,9 +77,8 @@
<div
class=
"row-fluid"
>
<div
class=
"span7"
>
<table
class=
"data"
style=
"min-width:900px"
>
<c:set
var=
"methods"
value=
"
${
model
.
report
.
allMethods
}
"
/>
<tr>
<th
class=
"left"
colspan=
'
${fn:length(methods) + 6}
'
><input
type=
"text"
<th
class=
"left"
colspan=
'
10
'
><input
type=
"text"
name=
"queryname"
id=
"queryname"
size=
"40"
value=
"${model.queryName}"
>
<input
id=
"queryname"
style=
"WIDTH: 60px"
...
...
@@ -102,9 +101,10 @@
<a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=type&queryname=${model.queryName}"
>
Name
</a>
</th>
<th
class=
"right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=total&queryname=${model.queryName}"
>
Total
</a></th>
<c:forEach
var=
"method"
items=
"
${
methods
}
"
>
<th
class=
"right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=method:${method}&queryname=${model.queryName}"
>
${method}
</a></th>
</c:forEach>
<th
class=
"right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=get&queryname=${model.queryName}"
>
Get
</a></th>
<th
class=
"right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=mget&queryname=${model.queryName}"
>
mGet
</a></th>
<th
class=
"right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=add&queryname=${model.queryName}"
>
Add
</a></th>
<th
class=
"right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=remove&queryname=${model.queryName}"
>
Remove
</a></th>
<th
class=
"right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=missed&queryname=${model.queryName}"
>
Missed
</a></th>
<th
class=
"right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=hitPercent&queryname=${model.queryName}"
>
Hit Rate(%)
</a></th>
<th
class=
"right"
><a
href=
"?domain=${model.domain}&date=${model.date}&type=${payload.type}&sort=avg&queryname=${model.queryName}"
>
Avg
</a>
(ms)
</th>
...
...
@@ -118,16 +118,10 @@
<td
style=
"text-align: left; word-wrap: break-word; word-break: break-all;"
>
${w:shorten(e.id, 80)}
</td>
<td>
${w:format(e.totalCount,'#,###,###,###,##0')}
</td>
<c:forEach
var=
"method"
items=
"
${
methods
}
"
>
<c:choose>
<c:when
test=
"
${
empty
item
.
methodCounts
[
method
]
}
"
>
<td>
0
</td>
</c:when>
<c:otherwise>
<td>
${w:format(item.methodCounts[method],'#,###,###,###,##0')}
</td>
</c:otherwise>
</c:choose>
</c:forEach>
<td>
${w:format(item.get,'#,###,###,###,##0')}
</td>
<td>
${w:format(item.mget,'#,###,###,###,##0')}
</td>
<td>
${w:format(item.add,'#,###,###,###,##0')}
</td>
<td>
${w:format(item.remove,'#,###,###,###,##0')}
</td>
<td>
${item.missed}
</td>
<td>
${w:format(item.hited,'0.0000%')}
</td>
<td>
${w:format(e.avg,'0.0')}
</td>
...
...
cat-home/src/main/webapp/jsp/report/cache/cacheHistory.jsp
浏览文件 @
20e27f4f
...
...
@@ -70,9 +70,8 @@
<div
class=
"row-fluid"
>
<div
class=
"span7"
>
<table
class=
"data"
style=
"min-width:900px"
>
<c:set
var=
"methods"
value=
"
${
model
.
report
.
allMethods
}
"
/>
<tr>
<th
class=
"left"
colspan=
'
${fn:length(methods) + 6}
'
><input
type=
"text"
<th
class=
"left"
colspan=
'
10
'
><input
type=
"text"
name=
"queryname"
id=
"queryname"
size=
"40"
value=
"${model.queryName}"
>
<input
id=
"queryname"
style=
"WIDTH: 60px"
...
...
@@ -98,9 +97,10 @@
<a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}${model.customDate}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=type&queryname=${model.queryName}"
>
Name
</a>
</th>
<th
class=
"right"
><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}${model.customDate}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=total&queryname=${model.queryName}"
>
Total
</a></th>
<c:forEach
var=
"method"
items=
"
${
methods
}
"
>
<th
class=
"right"
><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}${model.customDate}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=method:${method}&queryname=${model.queryName}"
>
${method}
</a></th>
</c:forEach>
<th
class=
"right"
><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}${model.customDate}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=get&queryname=${model.queryName}"
>
Get
</a></th>
<th
class=
"right"
><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}${model.customDate}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=mget&queryname=${model.queryName}"
>
mGet
</a></th>
<th
class=
"right"
><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}${model.customDate}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=add&queryname=${model.queryName}"
>
Add
</a></th>
<th
class=
"right"
><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}${model.customDate}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=remove&queryname=${model.queryName}"
>
Remove
</a></th>
<th
class=
"right"
><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}${model.customDate}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=missed&queryname=${model.queryName}"
>
Missed
</a></th>
<th
class=
"right"
><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}${model.customDate}&date=${model.date}&ip=${model.ipAddress}&type=${payload.type}&sort=hitPercent&queryname=${model.queryName}"
>
Hit Rate(%)
</a></th>
<th
class=
"right"
><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}${model.customDate}&date=${model.date}&type=${payload.type}&sort=avg&queryname=${model.queryName}"
>
Avg
</a>
(ms)
</th>
...
...
@@ -115,16 +115,10 @@
style=
"text-align: left; word-wrap: break-word; word-break: break-all;"
>
${w:shorten(e.id, 80)}
</td>
<td>
${w:format(e.totalCount,'#,###,###,###,##0')}
</td>
<c:forEach
var=
"method"
items=
"
${
methods
}
"
>
<c:choose>
<c:when
test=
"
${
empty
item
.
methodCounts
[
method
]
}
"
>
<td>
0
</td>
</c:when>
<c:otherwise>
<td>
${w:format(item.methodCounts[method],'#,###,###,###,##0')}
</td>
</c:otherwise>
</c:choose>
</c:forEach>
<td>
${w:format(item.get,'#,###,###,###,##0')}
</td>
<td>
${w:format(item.mget,'#,###,###,###,##0')}
</td>
<td>
${w:format(item.add,'#,###,###,###,##0')}
</td>
<td>
${w:format(item.remove,'#,###,###,###,##0')}
</td>
<td>
${item.missed}
</td>
<td>
${w:format(item.hited,'0.0000%')}
</td>
<td>
${w:format(e.avg,'0.0')}
</td>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录