Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
55bdc59e
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,发现更多精彩内容 >>
提交
55bdc59e
编写于
6月 04, 2013
作者:
Y
yong.you
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify the add modify page of domain node
上级
bb05933a
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
369 addition
and
83 deletion
+369
-83
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/advanced/MatrixAnalyzer.java
...va/com/dianping/cat/consumer/advanced/MatrixAnalyzer.java
+1
-1
cat-core/src/main/java/com/dianping/cat/message/spi/codec/PlainTextMessageCodec.java
...dianping/cat/message/spi/codec/PlainTextMessageCodec.java
+1
-1
cat-home/src/main/java/com/dianping/cat/helper/CatString.java
...home/src/main/java/com/dianping/cat/helper/CatString.java
+4
-0
cat-home/src/main/java/com/dianping/cat/report/page/dependency/Handler.java
...java/com/dianping/cat/report/page/dependency/Handler.java
+1
-2
cat-home/src/main/java/com/dianping/cat/report/page/dependency/graph/TopologyGraphConfigManger.java
...port/page/dependency/graph/TopologyGraphConfigManger.java
+12
-2
cat-home/src/main/java/com/dianping/cat/system/page/config/Action.java
...main/java/com/dianping/cat/system/page/config/Action.java
+6
-2
cat-home/src/main/java/com/dianping/cat/system/page/config/Handler.java
...ain/java/com/dianping/cat/system/page/config/Handler.java
+37
-10
cat-home/src/main/java/com/dianping/cat/system/page/config/JspFile.java
...ain/java/com/dianping/cat/system/page/config/JspFile.java
+9
-4
cat-home/src/main/java/com/dianping/cat/system/page/config/JspViewer.java
...n/java/com/dianping/cat/system/page/config/JspViewer.java
+8
-4
cat-home/src/main/java/com/dianping/cat/system/page/config/Model.java
.../main/java/com/dianping/cat/system/page/config/Model.java
+43
-9
cat-home/src/main/java/com/dianping/cat/system/page/config/Payload.java
...ain/java/com/dianping/cat/system/page/config/Payload.java
+53
-31
cat-home/src/main/resources/META-INF/plexus/components.xml
cat-home/src/main/resources/META-INF/plexus/components.xml
+7
-0
cat-home/src/main/webapp/js/alarm.js
cat-home/src/main/webapp/js/alarm.js
+0
-1
cat-home/src/main/webapp/jsp/system/alarmExceptionRules.jsp
cat-home/src/main/webapp/jsp/system/alarmExceptionRules.jsp
+4
-1
cat-home/src/main/webapp/jsp/system/alarmServiceRules.jsp
cat-home/src/main/webapp/jsp/system/alarmServiceRules.jsp
+4
-1
cat-home/src/main/webapp/jsp/system/configTree.jsp
cat-home/src/main/webapp/jsp/system/configTree.jsp
+2
-1
cat-home/src/main/webapp/jsp/system/projectUpdate.jsp
cat-home/src/main/webapp/jsp/system/projectUpdate.jsp
+0
-1
cat-home/src/main/webapp/jsp/system/scheduledReports.jsp
cat-home/src/main/webapp/jsp/system/scheduledReports.jsp
+4
-1
cat-home/src/main/webapp/jsp/system/topologyGraphConfigNodeAdd.jsp
...src/main/webapp/jsp/system/topologyGraphConfigNodeAdd.jsp
+83
-0
cat-home/src/main/webapp/jsp/system/topologyGraphConfigs.jsp
cat-home/src/main/webapp/jsp/system/topologyGraphConfigs.jsp
+84
-0
cat-home/src/test/java/com/dianping/cat/report/analyzer/OpDataCollectTest.java
...a/com/dianping/cat/report/analyzer/OpDataCollectTest.java
+6
-11
未找到文件。
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/advanced/MatrixAnalyzer.java
浏览文件 @
55bdc59e
...
...
@@ -155,7 +155,7 @@ public class MatrixAnalyzer extends AbstractMessageAnalyzer<MatrixReport> implem
String
type
=
t
.
getType
();
Ratio
ratio
=
null
;
if
(
type
.
equals
(
"Call"
))
{
if
(
type
.
equals
(
"Call"
)
||
type
.
equals
(
"PigeonCall"
)
)
{
ratio
=
ratios
.
get
(
"Call"
);
}
else
if
(
type
.
equals
(
"SQL"
))
{
ratio
=
ratios
.
get
(
"SQL"
);
...
...
cat-core/src/main/java/com/dianping/cat/message/spi/codec/PlainTextMessageCodec.java
浏览文件 @
55bdc59e
...
...
@@ -343,7 +343,7 @@ public class PlainTextMessageCodec implements MessageCodec, LogEnabled {
}
else
if
(
message
instanceof
Heartbeat
)
{
return
encodeLine
(
message
,
buf
,
'H'
,
Policy
.
DEFAULT
);
}
else
{
throw
new
RuntimeException
(
String
.
format
(
"Unsupported message type: %s."
,
message
.
getClass
()
));
throw
new
RuntimeException
(
String
.
format
(
"Unsupported message type: %s."
,
message
));
}
}
...
...
cat-home/src/main/java/com/dianping/cat/helper/CatString.java
浏览文件 @
55bdc59e
...
...
@@ -23,4 +23,8 @@ public class CatString {
public
static
final
String
EXCEPTION_COUNT
=
"错误数"
;
public
static
final
String
EXCEPTION_INFO
=
"异常信息"
;
public
static
final
String
SUCCESS
=
"Success"
;
public
static
final
String
FAIL
=
"Fail"
;
}
cat-home/src/main/java/com/dianping/cat/report/page/dependency/Handler.java
浏览文件 @
55bdc59e
...
...
@@ -317,8 +317,7 @@ public class Handler implements PageHandler<Context> {
ModelResponse
<
DependencyReport
>
response
=
m_dependencyService
.
invoke
(
request
);
DependencyReport
report
=
response
.
getModel
();
Date
start
=
report
.
getStartTime
();
if
(
start
==
null
)
{
if
(
report
!=
null
&&
report
.
getStartTime
()
==
null
)
{
report
.
setStartTime
(
new
Date
(
payload
.
getDate
()));
report
.
setStartTime
(
new
Date
(
payload
.
getDate
()
+
TimeUtil
.
ONE_HOUR
));
}
...
...
cat-home/src/main/java/com/dianping/cat/report/page/dependency/graph/TopologyGraphConfigManger.java
浏览文件 @
55bdc59e
...
...
@@ -190,6 +190,15 @@ public class TopologyGraphConfigManger implements Initializable {
m_config
=
new
TopologyGraphConfig
();
}
}
public
boolean
insertDomainDefaultConfig
(
String
type
,
DomainConfig
config
)
{
NodeConfig
node
=
m_config
.
findOrCreateNodeConfig
(
type
);
node
.
setDefaultErrorResponseTime
(
config
.
getErrorResponseTime
());
node
.
setDefaultErrorThreshold
(
config
.
getErrorThreshold
());
node
.
setDefaultWarningResponseTime
(
config
.
getWarningResponseTime
());
node
.
setDefaultWarningThreshold
(
config
.
getWarningThreshold
());
return
flushConfig
();
}
public
boolean
insertDomainConfig
(
String
type
,
DomainConfig
config
)
{
m_config
.
findOrCreateNodeConfig
(
type
).
addDomainConfig
(
config
);
...
...
@@ -202,7 +211,7 @@ public class TopologyGraphConfigManger implements Initializable {
return
flushConfig
();
}
p
rivate
EdgeConfig
queryEdgeConfig
(
String
type
,
String
from
,
String
to
)
{
p
ublic
EdgeConfig
queryEdgeConfig
(
String
type
,
String
from
,
String
to
)
{
EdgeConfig
edgeConfig
=
m_config
.
findEdgeConfig
(
type
+
":"
+
from
+
":"
+
to
);
if
(
edgeConfig
==
null
)
{
...
...
@@ -221,7 +230,7 @@ public class TopologyGraphConfigManger implements Initializable {
return
edgeConfig
;
}
p
rivate
DomainConfig
queryNodeConfig
(
String
type
,
String
domain
)
{
p
ublic
DomainConfig
queryNodeConfig
(
String
type
,
String
domain
)
{
NodeConfig
typesConfig
=
m_config
.
findNodeConfig
(
type
);
if
(
typesConfig
!=
null
)
{
...
...
@@ -248,4 +257,5 @@ public class TopologyGraphConfigManger implements Initializable {
m_fileName
=
file
;
}
}
cat-home/src/main/java/com/dianping/cat/system/page/config/Action.java
浏览文件 @
55bdc59e
...
...
@@ -14,12 +14,16 @@ public enum Action implements org.unidal.web.mvc.Action {
AGGREGATION_UPDATE_SUBMIT
(
"aggregationUpdateSubmit"
),
AGGREGATION_DELETE
(
"aggregationDelete"
),
TOPOLOGY_GRAPH_CONFIG_LIST
(
"topologyGraphConfigList"
),
TOPOLOGY_GRAPH_CONFIG_NODE_ADD_OR_UPDATE
(
"topologyGraphConfigNodeAdd"
),
TOPOLOGY_GRAPH_CONFIG_NODE_ADD
(
"topologyGraphConfigNodeAdd
"
),
TOPOLOGY_GRAPH_CONFIG_NODE_ADD
_OR_UPDATE_SUBMIT
(
"topologyGraphConfigNodeAddSumbit
"
),
TOPOLOGY_GRAPH_CONFIG_NODE_DELETE
(
"topologyGraphConfigNodeDelete"
),
TOPOLOGY_GRAPH_CONFIG_EDGE_ADD
(
"topologyGraphConfigEdgeAdd"
),
TOPOLOGY_GRAPH_CONFIG_EDGE_ADD
_OR_UPDATE
(
"topologyGraphConfigEdgeAdd"
),
TOPOLOGY_GRAPH_CONFIG_EDGE_DELETE
(
"topologyGraphConfigEdgeDelete"
);
...
...
cat-home/src/main/java/com/dianping/cat/system/page/config/Handler.java
浏览文件 @
55bdc59e
...
...
@@ -8,6 +8,7 @@ import java.util.List;
import
javax.servlet.ServletException
;
import
org.codehaus.plexus.util.StringUtils
;
import
org.unidal.dal.jdbc.DalException
;
import
org.unidal.lookup.annotation.Inject
;
import
org.unidal.web.mvc.PageHandler
;
...
...
@@ -19,6 +20,7 @@ import com.dianping.cat.Cat;
import
com.dianping.cat.consumer.core.dal.Project
;
import
com.dianping.cat.consumer.core.dal.ProjectDao
;
import
com.dianping.cat.consumer.core.dal.ProjectEntity
;
import
com.dianping.cat.helper.CatString
;
import
com.dianping.cat.home.dal.report.AggregationRule
;
import
com.dianping.cat.home.dal.report.AggregationRuleDao
;
import
com.dianping.cat.home.dal.report.AggregationRuleEntity
;
...
...
@@ -68,6 +70,7 @@ public class Handler implements PageHandler<Context> {
updateProject
(
payload
);
model
.
setProjects
(
queryAllProjects
());
break
;
case
AGGREGATION_ALL:
model
.
setAggregationRules
(
queryAllAggregationRules
());
break
;
...
...
@@ -82,30 +85,54 @@ public class Handler implements PageHandler<Context> {
deleteAggregationRule
(
payload
);
model
.
setAggregationRules
(
queryAllAggregationRules
());
break
;
case
TOPOLOGY_GRAPH_CONFIG_NODE_ADD:
model
.
setOpResult
(
addGraphNodeConfig
(
payload
));
case
TOPOLOGY_GRAPH_CONFIG_NODE_ADD_OR_UPDATE:
graphNodeConfigAddOrUpdate
(
payload
,
model
);
break
;
case
TOPOLOGY_GRAPH_CONFIG_NODE_ADD_OR_UPDATE_SUBMIT:
model
.
setOpResult
(
graphNodeConfigAddOrUpdateSubmit
(
payload
,
model
));
break
;
case
TOPOLOGY_GRAPH_CONFIG_NODE_DELETE:
model
.
setOpResult
(
graphNodeConfigUpdate
(
payload
));
model
.
setOpResult
(
graphNodeConfigDelete
(
payload
));
model
.
setConfig
(
m_topologyConfigManager
.
getConfig
());
break
;
case
TOPOLOGY_GRAPH_CONFIG_EDGE_ADD:
case
TOPOLOGY_GRAPH_CONFIG_EDGE_ADD
_OR_UPDATE
:
model
.
setOpResult
(
graphEdgeConfigAdd
(
payload
));
break
;
case
TOPOLOGY_GRAPH_CONFIG_EDGE_DELETE:
model
.
setOpResult
(
graphEdgeConfigDelete
(
payload
));
break
;
case
TOPOLOGY_GRAPH_CONFIG_LIST:
model
.
setGraphConfig
(
m_topologyConfigManager
.
getConfig
());
break
;
}
m_jspViewer
.
view
(
ctx
,
model
);
}
private
boolean
addGraphNodeConfig
(
Payload
payload
)
{
private
void
graphNodeConfigAddOrUpdate
(
Payload
payload
,
Model
model
)
{
String
domain
=
payload
.
getDomain
();
String
type
=
payload
.
getType
();
if
(!
StringUtils
.
isEmpty
(
domain
))
{
model
.
setDomainConfig
(
m_topologyConfigManager
.
queryNodeConfig
(
type
,
domain
));
}
}
private
boolean
graphNodeConfigAddOrUpdateSubmit
(
Payload
payload
,
Model
model
)
{
String
type
=
payload
.
getType
();
DomainConfig
config
=
payload
.
getDomainConfig
();
return
true
;
// return m_topologyConfigManager.insertDomainConfig(, config);
String
domain
=
config
.
getId
();
model
.
setDomainConfig
(
config
);
if
(
domain
.
equalsIgnoreCase
(
CatString
.
ALL
))
{
return
m_topologyConfigManager
.
insertDomainDefaultConfig
(
type
,
config
);
}
else
{
return
m_topologyConfigManager
.
insertDomainConfig
(
type
,
config
);
}
}
private
boolean
graphNodeConfig
Upda
te
(
Payload
payload
)
{
return
true
;
private
boolean
graphNodeConfig
Dele
te
(
Payload
payload
)
{
return
m_topologyConfigManager
.
deleteDomainConfig
(
payload
.
getType
(),
payload
.
getDomain
())
;
}
private
boolean
graphEdgeConfigAdd
(
Payload
payload
)
{
...
...
@@ -113,7 +140,7 @@ public class Handler implements PageHandler<Context> {
}
private
boolean
graphEdgeConfigDelete
(
Payload
payload
)
{
return
true
;
return
m_topologyConfigManager
.
deleteDomainConfig
(
payload
.
getType
(),
payload
.
getDomain
())
;
}
private
List
<
Project
>
queryAllProjects
()
{
...
...
cat-home/src/main/java/com/dianping/cat/system/page/config/JspFile.java
浏览文件 @
55bdc59e
...
...
@@ -8,14 +8,19 @@ public enum JspFile {
AGGREGATION_ALL
(
"/jsp/system/aggregation.jsp"
),
AGGREGATION_UPATE
(
"/jsp/system/aggregationUpdate.jsp"
),
TOPOLOGY_GRAPH_CONFIG_ADD_OR_SUBMIT
(
"/jsp/system/topologyGraphConfigNodeAdd.jsp"
),
TOPOLOGY_GRAPH_CONFIG_
ADD
(
"/jsp/system/topologyGraphConfigNodeAdd.jsp"
),
TOPOLOGY_GRAPH_CONFIG_
NODE_ADD_OR_UPDATE_SUBMIT
(
"/jsp/system/topologyGraphConfigNodeAdd.jsp"
),
TOPOLOGY_GRAPH_CONFIG_DELETE
(
"/jsp/system/topologyGraphConfig
NodeDelete
.jsp"
),
TOPOLOGY_GRAPH_CONFIG_DELETE
(
"/jsp/system/topologyGraphConfig
s
.jsp"
),
TOPOLOGY_GRAPH_CONFIG_EDGE_ADD
(
"/jsp/system/topologyGraphConfigEdgeAdd.jsp"
),
TOPOLOGY_GRAPH_CONFIG_EDGE_ADD
_OR_UPDATE
(
"/jsp/system/topologyGraphConfigEdgeAdd.jsp"
),
TOPOLOGY_GRAPH_CONFIG_EDGE_DELETE
(
"/jsp/system/topologyGraphConfigEdgeDelete.jsp"
),
TOPOLOGY_GRAPH_CONFIG_EDGE_DELETE
(
"/jsp/system/topologyGraphConfigs.jsp"
),
TOPOLOGY_GRAPH_CONFIG_LIST
(
"/jsp/system/topologyGraphConfigs.jsp"
),
;
...
...
cat-home/src/main/java/com/dianping/cat/system/page/config/JspViewer.java
浏览文件 @
55bdc59e
...
...
@@ -24,14 +24,18 @@ public class JspViewer extends BaseJspViewer<SystemPage, Action, Context, Model>
return
JspFile
.
AGGREGATION_UPATE
.
getPath
();
case
AGGREGATION_UPDATE_SUBMIT:
return
JspFile
.
AGGREGATION_ALL
.
getPath
();
case
TOPOLOGY_GRAPH_CONFIG_NODE_ADD:
return
JspFile
.
TOPOLOGY_GRAPH_CONFIG_ADD
.
getPath
();
case
TOPOLOGY_GRAPH_CONFIG_NODE_ADD
_OR_UPDATE
:
return
JspFile
.
TOPOLOGY_GRAPH_CONFIG_ADD
_OR_SUBMIT
.
getPath
();
case
TOPOLOGY_GRAPH_CONFIG_NODE_DELETE:
return
JspFile
.
TOPOLOGY_GRAPH_CONFIG_DELETE
.
getPath
();
case
TOPOLOGY_GRAPH_CONFIG_EDGE_ADD:
return
JspFile
.
TOPOLOGY_GRAPH_CONFIG_EDGE_ADD
.
getPath
();
case
TOPOLOGY_GRAPH_CONFIG_EDGE_ADD
_OR_UPDATE
:
return
JspFile
.
TOPOLOGY_GRAPH_CONFIG_EDGE_ADD
_OR_UPDATE
.
getPath
();
case
TOPOLOGY_GRAPH_CONFIG_EDGE_DELETE:
return
JspFile
.
TOPOLOGY_GRAPH_CONFIG_EDGE_DELETE
.
getPath
();
case
TOPOLOGY_GRAPH_CONFIG_LIST:
return
JspFile
.
TOPOLOGY_GRAPH_CONFIG_LIST
.
getPath
();
case
TOPOLOGY_GRAPH_CONFIG_NODE_ADD_OR_UPDATE_SUBMIT:
return
JspFile
.
TOPOLOGY_GRAPH_CONFIG_NODE_ADD_OR_UPDATE_SUBMIT
.
getPath
();
}
throw
new
RuntimeException
(
"Unknown action: "
+
action
);
...
...
cat-home/src/main/java/com/dianping/cat/system/page/config/Model.java
浏览文件 @
55bdc59e
...
...
@@ -6,7 +6,11 @@ import java.util.List;
import
org.unidal.web.mvc.ViewModel
;
import
com.dianping.cat.consumer.core.dal.Project
;
import
com.dianping.cat.helper.CatString
;
import
com.dianping.cat.home.dal.report.AggregationRule
;
import
com.dianping.cat.home.dependency.config.entity.DomainConfig
;
import
com.dianping.cat.home.dependency.config.entity.EdgeConfig
;
import
com.dianping.cat.home.dependency.config.entity.TopologyGraphConfig
;
import
com.dianping.cat.system.SystemPage
;
public
class
Model
extends
ViewModel
<
SystemPage
,
Action
,
Context
>
{
...
...
@@ -19,12 +23,34 @@ public class Model extends ViewModel<SystemPage, Action, Context> {
private
List
<
AggregationRule
>
m_aggregationRules
;
private
String
m_opState
;
private
String
m_opState
=
CatString
.
SUCCESS
;
private
TopologyGraphConfig
m_config
;
private
DomainConfig
m_domainConfig
;
private
EdgeConfig
m_edgeConfig
;
public
Model
(
Context
ctx
)
{
super
(
ctx
);
}
public
DomainConfig
getDomainConfig
()
{
return
m_domainConfig
;
}
public
void
setDomainConfig
(
DomainConfig
domainConfig
)
{
m_domainConfig
=
domainConfig
;
}
public
EdgeConfig
getEdgeConfig
()
{
return
m_edgeConfig
;
}
public
void
setEdgeConfig
(
EdgeConfig
edgeConfig
)
{
m_edgeConfig
=
edgeConfig
;
}
public
AggregationRule
getAggregationRule
()
{
return
m_aggregationRule
;
}
...
...
@@ -55,8 +81,8 @@ public class Model extends ViewModel<SystemPage, Action, Context> {
}
public
String
getOpState
()
{
return
m_opState
;
}
return
m_opState
;
}
public
Project
getProject
()
{
return
m_project
;
...
...
@@ -74,18 +100,26 @@ public class Model extends ViewModel<SystemPage, Action, Context> {
m_aggregationRules
=
aggregationRules
;
}
public
TopologyGraphConfig
getConfig
()
{
return
m_config
;
}
public
void
setConfig
(
TopologyGraphConfig
config
)
{
m_config
=
config
;
}
public
void
setGraphConfig
(
TopologyGraphConfig
config
)
{
m_config
=
config
;
}
public
void
setOpResult
(
boolean
result
)
{
if
(
result
)
{
m_opState
=
"SUCCESS"
;
m_opState
=
CatString
.
SUCCESS
;
}
else
{
m_opState
=
"FAIL"
;
m_opState
=
CatString
.
FAIL
;
}
}
public
void
setOpState
(
String
opState
)
{
m_opState
=
opState
;
}
public
void
setProject
(
Project
project
)
{
m_project
=
project
;
}
...
...
cat-home/src/main/java/com/dianping/cat/system/page/config/Payload.java
浏览文件 @
55bdc59e
...
...
@@ -32,8 +32,14 @@ public class Payload implements ActionPayload<SystemPage, Action> {
@FieldMeta
(
"projectId"
)
private
int
m_projectId
;
@FieldMeta
(
"domain"
)
private
String
m_domain
;
@FieldMeta
(
"id"
)
private
int
m_id
;
@FieldMeta
(
"type"
)
private
String
m_type
;
@Override
public
Action
getAction
()
{
...
...
@@ -43,74 +49,90 @@ public class Payload implements ActionPayload<SystemPage, Action> {
return
m_action
;
}
@Override
public
SystemPage
getPage
()
{
return
m_page
;
public
DomainConfig
getDomainConfig
()
{
return
m_domainConfig
;
}
public
String
getReportType
()
{
return
""
;
public
EdgeConfig
getEdgeConfig
()
{
return
m_edgeConfig
;
}
public
void
setAction
(
String
action
)
{
m_action
=
Action
.
getByName
(
action
,
Action
.
PROJECT_ALL
)
;
public
int
getId
(
)
{
return
m_id
;
}
@Override
public
void
setPage
(
String
page
)
{
m_page
=
SystemPage
.
getByName
(
page
,
SystemPage
.
CONFIG
)
;
public
SystemPage
getPage
(
)
{
return
m_page
;
}
@Override
public
void
validate
(
ActionContext
<?>
ctx
)
{
public
Project
getProject
()
{
return
m_project
;
}
public
void
setProjectId
(
int
id
)
{
m_projectId
=
id
;
public
int
getProjectId
()
{
return
m_projectId
;
}
public
String
getReportType
()
{
return
""
;
}
public
AggregationRule
getRule
()
{
return
m_rule
;
}
public
void
setRule
(
AggregationRule
rule
)
{
m_rule
=
rul
e
;
}
public
String
getType
(
)
{
return
m_typ
e
;
}
public
DomainConfig
getDomainConfig
(
)
{
return
m_domainConfig
;
public
void
setAction
(
String
action
)
{
m_action
=
Action
.
getByName
(
action
,
Action
.
PROJECT_ALL
)
;
}
public
void
setDomainConfig
(
DomainConfig
domainConfig
)
{
m_domainConfig
=
domainConfig
;
}
public
EdgeConfig
getEdgeConfig
()
{
return
m_edgeConfig
;
}
public
void
setEdgeConfig
(
EdgeConfig
edgeConfig
)
{
m_edgeConfig
=
edgeConfig
;
}
public
Project
getProject
()
{
return
m_project
;
public
void
setId
(
int
id
)
{
m_id
=
id
;
}
@Override
public
void
setPage
(
String
page
)
{
m_page
=
SystemPage
.
getByName
(
page
,
SystemPage
.
CONFIG
);
}
public
void
setProject
(
Project
project
)
{
m_project
=
project
;
}
public
int
getProjectId
(
)
{
return
m_projectI
d
;
public
void
setProjectId
(
int
id
)
{
m_projectId
=
i
d
;
}
public
int
getId
(
)
{
return
m_id
;
public
void
setRule
(
AggregationRule
rule
)
{
m_rule
=
rule
;
}
public
void
setId
(
int
id
)
{
m_id
=
id
;
}
public
void
setType
(
String
type
)
{
m_type
=
type
;
}
public
String
getDomain
()
{
return
m_domain
;
}
public
void
setDomain
(
String
domain
)
{
m_domain
=
domain
;
}
@Override
public
void
validate
(
ActionContext
<?>
ctx
)
{
}
}
cat-home/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
55bdc59e
...
...
@@ -2843,6 +2843,9 @@
<requirement>
<role>
com.dianping.cat.home.dal.report.AggregationRuleDao
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.report.page.dependency.graph.TopologyGraphConfigManger
</role>
</requirement>
</requirements>
</component>
<component>
...
...
@@ -2872,6 +2875,10 @@
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.report.page.dependency.graph.TopologyGraphConfigManger
</role>
<implementation>
com.dianping.cat.report.page.dependency.graph.TopologyGraphConfigManger
</implementation>
</component>
<component>
<role>
com.dianping.cat.system.alarm.AlarmContentBuilder
</role>
<implementation>
com.dianping.cat.system.alarm.AlarmContentBuilder
</implementation>
...
...
cat-home/src/main/webapp/js/alarm.js
浏览文件 @
55bdc59e
...
...
@@ -24,4 +24,3 @@ function sub(anchor) {
return
false
;
}
cat-home/src/main/webapp/jsp/system/alarmExceptionRules.jsp
浏览文件 @
55bdc59e
...
...
@@ -20,6 +20,9 @@
var
id
=
'
${payload.action.name}
'
;
$
(
'
#
'
+
id
).
addClass
(
"
active
"
);
init
();
$
(
"
.delete
"
).
bind
(
"
click
"
,
function
()
{
return
confirm
(
"
确定要删除此项目吗(不可恢复)?
"
);
});
});
</script>
<div
class=
"body-content"
>
...
...
@@ -49,7 +52,7 @@
</c:otherwise>
</c:choose>
<a
class=
"btn btn-primary btn-small"
href=
"?op=alarmRuleUpdate&alarmRuleId=${item.alarmRule.id}&type=exception"
>
编辑
</a>
<a
class=
"btn btn-danger btn-small"
href=
"?op=exceptionAlarmRuleDelete&alarmRuleId=${item.alarmRule.id}"
>
删除
</a>
<a
class=
"
delete
btn btn-danger btn-small"
href=
"?op=exceptionAlarmRuleDelete&alarmRuleId=${item.alarmRule.id}"
>
删除
</a>
</td>
</tr>
</c:forEach></tbody>
...
...
cat-home/src/main/webapp/jsp/system/alarmServiceRules.jsp
浏览文件 @
55bdc59e
...
...
@@ -21,6 +21,9 @@
init
();
var
id
=
'
${payload.action.name}
'
;
$
(
'
#
'
+
id
).
addClass
(
"
active
"
);
$
(
"
.delete
"
).
bind
(
"
click
"
,
function
()
{
return
confirm
(
"
确定要删除此项目吗(不可恢复)?
"
);
});
});
</script>
...
...
@@ -50,7 +53,7 @@
</c:otherwise>
</c:choose>
<a
class=
"btn btn-primary btn-small"
href=
"?op=alarmRuleUpdate&alarmRuleId=${item.alarmRule.id}&type=service"
>
编辑
</a>
<a
class=
"btn btn-danger btn-small"
href=
"?op=serviceAlarmRuleDelete&alarmRuleId=${item.alarmRule.id}"
>
删除
</a>
<a
class=
"
delete
btn btn-danger btn-small"
href=
"?op=serviceAlarmRuleDelete&alarmRuleId=${item.alarmRule.id}"
>
删除
</a>
</td>
</tr>
</c:forEach></tbody>
...
...
cat-home/src/main/webapp/jsp/system/configTree.jsp
浏览文件 @
55bdc59e
...
...
@@ -3,7 +3,8 @@
<ul
class=
"nav nav-list"
>
<li
class=
'nav-header'
><h4>
全局配置信息
</h4></li>
<li
id=
"projectList"
><a
href=
"?op=projects"
><strong>
项目基本信息配置
</strong></a></li>
<li
id=
"aggregationList"
><a
href=
"?op=aggregations"
><strong>
前端监控规则配置
</strong></a></li>
<li
id=
"aggregationList"
><a
href=
"?op=aggregations"
><strong>
前端合并规则配置
</strong></a></li>
<li
id=
"topylogyConfigList"
><a
href=
"?op=topologyGraphConfigList"
><strong>
拓扑监控阀值配置
</strong></a></li>
<li
id=
"bussinessConfigList"
><a
href=
"?"
><strong>
业务监控规则配置
</strong></a></li>
</ul>
</div>
...
...
cat-home/src/main/webapp/jsp/system/projectUpdate.jsp
浏览文件 @
55bdc59e
...
...
@@ -9,7 +9,6 @@
<jsp:useBean
id=
"model"
type=
"com.dianping.cat.system.page.config.Model"
scope=
"request"
/>
<a:body>
<res:useJs
value=
"
${
res
.
js
.
local
[
'alarm_js'
]
}
"
target=
"head-js"
/>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
...
...
cat-home/src/main/webapp/jsp/system/scheduledReports.jsp
浏览文件 @
55bdc59e
...
...
@@ -20,6 +20,9 @@
init
();
var
id
=
'
${payload.action.name}
'
;
$
(
'
#
'
+
id
).
addClass
(
"
active
"
);
$
(
"
.delete
"
).
bind
(
"
click
"
,
function
()
{
return
confirm
(
"
确定要删除此项目吗(不可恢复)?
"
);
});
});
</script>
...
...
@@ -51,7 +54,7 @@
</c:otherwise>
</c:choose>
<a
class=
"btn btn-primary btn-small"
href=
"?op=scheduledReportUpdate&scheduledReportId=${item.scheduledReport.id}"
target=
"_blank"
>
编辑
</a>
<a
class=
"btn btn-danger btn-small"
href=
"?op=scheduledReportDelete&scheduledReportId=${item.scheduledReport.id}"
>
删除
</a>
<a
class=
"
delete
btn btn-danger btn-small"
href=
"?op=scheduledReportDelete&scheduledReportId=${item.scheduledReport.id}"
>
删除
</a>
</td>
</tr>
</c:forEach></tbody>
...
...
cat-home/src/main/webapp/jsp/system/topologyGraphConfigNodeAdd.jsp
0 → 100644
浏览文件 @
55bdc59e
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<%@ taglib
prefix=
"a"
uri=
"/WEB-INF/app.tld"
%>
<%@ 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"
%>
<jsp:useBean
id=
"ctx"
type=
"com.dianping.cat.system.page.config.Context"
scope=
"request"
/>
<jsp:useBean
id=
"payload"
type=
"com.dianping.cat.system.page.config.Payload"
scope=
"request"
/>
<jsp:useBean
id=
"model"
type=
"com.dianping.cat.system.page.config.Model"
scope=
"request"
/>
<a:body>
<res:useJs
value=
"
${
res
.
js
.
local
[
'alarm_js'
]
}
"
target=
"head-js"
/>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
$
(
'
#topylogyConfigList
'
).
addClass
(
'
active
'
);
var
action
=
'
${payload.action}
'
;
if
(
action
==
'
TOPOLOGY_GRAPH_CONFIG_NODE_ADD_OR_UPDATE_SUBMIT
'
){
var
state
=
'
${model.opState}
'
;
if
(
state
==
'
Success
'
){
$
(
'
#state
'
).
html
(
'
操作成功
'
);
}
else
{
$
(
'
#state
'
).
html
(
'
操作失败
'
);
}
setInterval
(
function
(){
$
(
'
#state
'
).
html
(
'
'
);
},
3000
);
}
});
</script>
<div
class=
"row-fluid"
>
<div
class=
"span2"
>
<%@include
file=
"./configTree.jsp"
%>
</div>
<div
class=
"span10"
>
<h4
id=
"state"
class=
"text-center text-error"
>
</h4>
<form
name=
"topologyGraphConfigNodeAddSumbit"
id=
"form"
method=
"post"
action=
"${model.pageUri}?op=topologyGraphConfigNodeAddSumbit"
>
<table
class=
"table table-striped table-bordered table-condensed"
>
<tr>
<td>
规则类型
</td>
<td><input
type=
"name"
name=
"type"
value=
"${payload.type}"
readonly
/></td>
<td></td>
</tr>
<tr>
<td>
项目名称
</td>
<td>
<c:if
test=
"
${
not
empty
payload
.
domain
}
"
>
<input
type=
"name"
name=
"domainConfig.id"
value=
"${payload.domain}"
required
/>
</c:if>
<c:if
test=
"
${
empty
payload
.
domain
}
"
>
<input
type=
"name"
name=
"domainConfig.id"
value=
"${model.domainConfig.id}"
required
/>
</c:if>
</td>
<td>
ALL表示所有项目的默认值
</td>
</tr>
<tr>
<td>
异常数warning阈值
</td>
<td><input
type=
"name"
name=
"domainConfig.warningThreshold"
value=
"${model.domainConfig.warningThreshold}"
required
/></td>
<td
style=
'color:red'
>
异常warning阈值(1一分钟内异常数目)
</td>
</tr>
<tr>
<td>
异常数error阈值
</td>
<td><input
type=
"name"
name=
"domainConfig.errorThreshold"
value=
"${model.domainConfig.errorThreshold}"
required
/></td>
<td
style=
'color:red'
>
异常error阈值(1一分钟内异常数目)
</td>
</tr>
<tr>
<td>
响应时间warning阈值
</td>
<td><input
type=
"name"
name=
"domainConfig.warningResponseTime"
value=
"${model.domainConfig.warningResponseTime}"
required
/></td>
<td
style=
'color:red'
>
响应时间warning阈值
</td>
</tr>
<tr>
<td>
响应时间error阈值
</td>
<td><input
type=
"name"
name=
"domainConfig.errorResponseTime"
value=
"${model.domainConfig.errorResponseTime}"
required
/></td>
<td
style=
'color:red'
>
响应时间error阈值
</td>
</tr>
<tr>
<td>
</td>
<td><input
class=
'btn btn-primary'
type=
"submit"
name=
"submit"
value=
"submit"
/></td>
</tr>
</table>
</form>
</div>
</div>
</a:body>
\ No newline at end of file
cat-home/src/main/webapp/jsp/system/topologyGraphConfigs.jsp
0 → 100644
浏览文件 @
55bdc59e
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<%@ taglib
prefix=
"a"
uri=
"/WEB-INF/app.tld"
%>
<%@ 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"
%>
<jsp:useBean
id=
"ctx"
type=
"com.dianping.cat.system.page.config.Context"
scope=
"request"
/>
<jsp:useBean
id=
"payload"
type=
"com.dianping.cat.system.page.config.Payload"
scope=
"request"
/>
<jsp:useBean
id=
"model"
type=
"com.dianping.cat.system.page.config.Model"
scope=
"request"
/>
<a:body>
<res:useJs
value=
"
${
res
.
js
.
local
[
'alarm_js'
]
}
"
target=
"head-js"
/>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
$
(
'
#topylogyConfigList
'
).
addClass
(
'
active
'
);
$
(
'
#tab0
'
).
addClass
(
'
active
'
);
$
(
'
#tabContent0
'
).
addClass
(
'
active
'
);
$
(
"
.delete
"
).
bind
(
"
click
"
,
function
()
{
return
confirm
(
"
确定要删除此项目吗(不可恢复)?
"
);
});
var
action
=
'
${payload.action}
'
;
if
(
action
==
'
TOPOLOGY_GRAPH_CONFIG_NODE_DELETE
'
){
var
state
=
'
${model.opState}
'
;
if
(
state
==
'
Success
'
){
$
(
'
#state
'
).
html
(
'
操作成功
'
);
}
else
{
$
(
'
#state
'
).
html
(
'
操作失败
'
);
}
setInterval
(
function
(){
$
(
'
#state
'
).
html
(
'
'
);
},
3000
);
}
});
</script>
<div
class=
"row-fluid"
>
<div
class=
"span2"
>
<%@include
file=
"./configTree.jsp"
%>
</div>
<div
class=
"span10"
>
<h4
id=
"state"
class=
"text-center text-error"
>
</h4>
<div
class=
"tabbable tabs-left"
id=
"topMetric"
>
<!-- Only required for left/right tabs -->
<ul
class=
"nav nav-tabs"
>
<c:forEach
var=
"item"
items=
"
${
model
.
config
.
nodeConfigs
}
"
varStatus=
"status"
>
<c:set
var=
"key"
value=
"
${
item
.
key
}
"
/>
<li
id=
"tab${status.index}"
class=
"text-right"
><a
href=
"#tabContent${status.index}"
data-toggle=
"tab"
>
<h4
class=
"text-error"
>
${key}
</h4></a></li>
</c:forEach>
</ul>
<div
class=
"tab-content"
>
<c:forEach
var=
"item"
items=
"
${
model
.
config
.
nodeConfigs
}
"
varStatus=
"status"
>
<c:set
var=
"value"
value=
"
${
item
.
value
}
"
/>
<div
class=
"tab-pane"
id=
"tabContent${status.index}"
>
<h2
class=
"text-center text-error"
>
${item.key}
</h2>
<table
class=
"table table-striped table-bordered table-condensed"
>
<tr
class=
"text-success"
>
<th><h4
class=
'text-center'
>
项目
</h4></th><th><h4
class=
'text-center'
>
异常Warning阀值
</h4></th>
<th><h4
class=
'text-center'
>
异常Error阀值
</h4></th><th><h4
class=
'text-center'
>
响应时间Warning阀值
</h4></th>
<th><h4
class=
'text-center'
>
响应时间Error阀值
</h4></th>
<th><h4
class=
'text-center'
>
操作
<a
class=
"btn btn-primary btn-small"
href=
"?op=topologyGraphConfigNodeAdd&type=${item.key}"
>
新增
</a></h4></th>
</tr>
<tr
class=
"text-error"
><td><h5>
默认值
</h5></td><td><h5
class=
"text-right"
>
${value.defaultWarningThreshold}
</h5></td>
<td><h5
class=
"text-right"
>
${value.defaultErrorThreshold}
</h5></td>
<td><h5
class=
"text-right"
>
${value.defaultWarningResponseTime}
</h5></td>
<td><h5
class=
"text-right"
>
${value.defaultErrorResponseTime}
</h5></td>
<td><a
href=
"?op=topologyGraphConfigNodeAdd&type=${item.key}&domain=ALL"
class=
"btn btn-primary btn-small"
>
修改
</a></td>
</tr>
<c:forEach
var=
"domainConfig"
items=
"
${
value
.
domains
}
"
>
<c:set
var=
"temp"
value=
"
${
domainConfig
.
value
}
"
/>
<tr><td>
${temp.id}
</td>
<td
style=
"text-align:right"
>
${temp.warningThreshold}
</td>
<td
style=
"text-align:right"
>
${temp.errorThreshold}
</td>
<td
style=
"text-align:right"
>
${temp.warningResponseTime}
</td>
<td
style=
"text-align:right"
>
${temp.errorResponseTime}
</td>
<td><a
href=
"?op=topologyGraphConfigNodeAdd&type=${item.key}&domain=${temp.id}"
class=
"btn btn-primary btn-small"
>
修改
</a>
<a
href=
"?op=topologyGraphConfigNodeDelete&type=${item.key}&domain=${temp.id}"
class=
"btn btn-primary btn-small btn-danger delete"
>
删除
</a></td>
</tr>
</c:forEach>
</table>
</div>
</c:forEach>
</div>
</div>
</div>
</div>
</a:body>
\ No newline at end of file
cat-home/src/test/java/com/dianping/cat/report/analyzer/OpDataCollectTest.java
浏览文件 @
55bdc59e
...
...
@@ -30,30 +30,22 @@ public class OpDataCollectTest extends ComponentTestCase {
@Test
public
void
test
()
throws
Exception
{
m_hourlyReportService
=
(
HourlyReportService
)
lookup
(
HourlyReportService
.
class
);
String
dateStr1
=
"2013-03-2
4
16:00"
;
String
dateStr2
=
"2013-04-
14
16:00"
;
String
dateStr1
=
"2013-03-2
2
16:00"
;
String
dateStr2
=
"2013-04-
26
16:00"
;
String
dateStr3
=
"2013-05-24 16:00"
;
String
[]
domains
=
getDomains
();
System
.
out
.
println
(
"Domain\tDate\tType\tTotal\tAvg\tLine95\tStd\tQPS"
);
for
(
String
domain
:
domains
)
{
buildTransactionData
(
domain
,
dateStr1
);
}
for
(
String
domain
:
domains
)
{
buildTransactionData
(
domain
,
dateStr2
);
}
for
(
String
domain
:
domains
)
{
buildTransactionData
(
domain
,
dateStr3
);
}
System
.
out
.
println
(
"Domain\tDate\tLoad\tHttp"
);
for
(
String
domain
:
domains
)
{
buildHeartbeatData
(
domain
,
dateStr1
);
}
for
(
String
domain
:
domains
)
{
buildHeartbeatData
(
domain
,
dateStr2
);
}
for
(
String
domain
:
domains
)
{
buildHeartbeatData
(
domain
,
dateStr3
);
}
}
...
...
@@ -90,7 +82,10 @@ public class OpDataCollectTest extends ComponentTestCase {
}
private
String
[]
getDomains
()
{
String
domains
=
"MobileMembercardMainApiWeb,MobileMembercardMainServer,MobileMembercardRecomServer,PayEngine,tuangou-paygate,DealService,TuanGouApiMobile,TuanGouRank,TuanGouRemote,TuanGouWap,TuanGouWeb,MobileApi,MLocationService,MConfigAPI,MobileRecomStore,UserBaseService,GroupService,GroupWeb,PiccenterDisplay,PiccenterStorage,PiccenterUpload,ShopServer,ShopWeb,ShoppicService,ShopSearchWeb,ReviewServer,UserService"
;
String
domains
=
"MobileMembercardMainApiWeb,MobileMembercardMainServer,MobileMembercardRecomServer,PayEngine,"
+
"tuangou-paygate,DealService,TuanGouApiMobile,TuanGouRank,TuanGouRemote,TuanGouWap,TuanGouWeb,MobileApi,"
+
"MLocationService,MConfigAPI,MobileRecomStore,UserBaseService,GroupService,GroupWeb,PiccenterDisplay,"
+
"PiccenterStorage,PiccenterUpload,ShopServer,ShopWeb,ShoppicService,ShopSearchWeb,ReviewServer,UserService"
;
return
domains
.
split
(
","
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录