Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
06cad87a
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,发现更多精彩内容 >>
提交
06cad87a
编写于
8月 04, 2014
作者:
J
jialinsun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chengjunxia bootcamp task modify & merge request
上级
f705887f
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
79 addition
and
35 deletion
+79
-35
cat-home/src/main/java/com/dianping/cat/report/page/metric/Action.java
...main/java/com/dianping/cat/report/page/metric/Action.java
+3
-1
cat-home/src/main/java/com/dianping/cat/report/page/metric/Handler.java
...ain/java/com/dianping/cat/report/page/metric/Handler.java
+30
-19
cat-home/src/main/java/com/dianping/cat/report/page/metric/JspFile.java
...ain/java/com/dianping/cat/report/page/metric/JspFile.java
+3
-1
cat-home/src/main/java/com/dianping/cat/report/page/metric/JspViewer.java
...n/java/com/dianping/cat/report/page/metric/JspViewer.java
+2
-0
cat-home/src/main/java/com/dianping/cat/report/page/metric/Model.java
.../main/java/com/dianping/cat/report/page/metric/Model.java
+16
-6
cat-home/src/main/java/com/dianping/cat/report/page/metric/Payload.java
...ain/java/com/dianping/cat/report/page/metric/Payload.java
+17
-6
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/ThirdPartyAlert.java
...ing/cat/report/task/alert/thirdParty/ThirdPartyAlert.java
+3
-2
cat-home/src/main/webapp/jsp/report/metric/json.jsp
cat-home/src/main/webapp/jsp/report/metric/json.jsp
+5
-0
未找到文件。
cat-home/src/main/java/com/dianping/cat/report/page/metric/Action.java
浏览文件 @
06cad87a
...
...
@@ -3,7 +3,9 @@ package com.dianping.cat.report.page.metric;
public
enum
Action
implements
org
.
unidal
.
web
.
mvc
.
Action
{
METRIC
(
"view"
),
DASHBOARD
(
"dashboard"
);
DASHBOARD
(
"dashboard"
),
JSON
(
"json"
);
private
String
m_name
;
...
...
cat-home/src/main/java/com/dianping/cat/report/page/metric/Handler.java
浏览文件 @
06cad87a
...
...
@@ -8,6 +8,7 @@ import java.util.Set;
import
javax.servlet.ServletException
;
import
org.codehaus.plexus.util.StringUtils
;
import
org.unidal.lookup.annotation.Inject
;
import
org.unidal.web.mvc.PageHandler
;
import
org.unidal.web.mvc.annotation.InboundActionMeta
;
...
...
@@ -56,23 +57,20 @@ public class Handler implements PageHandler<Context> {
int
timeRange
=
payload
.
getTimeRange
();
Date
start
=
new
Date
(
date
-
(
timeRange
-
1
)
*
TimeUtil
.
ONE_HOUR
);
Date
end
=
new
Date
(
date
+
TimeUtil
.
ONE_HOUR
);
Map
<
String
,
LineChart
>
allCharts
=
buildLineCharts
(
payload
,
start
,
end
);
switch
(
payload
.
getAction
())
{
case
METRIC:
Map
<
String
,
LineChart
>
charts
=
m_graphCreator
.
buildChartsByProductLine
(
payload
.
getProduct
(),
start
,
end
);
model
.
setLineCharts
(
new
ArrayList
<
LineChart
>(
charts
.
values
()));
break
;
case
DASHBOARD:
String
group
=
payload
.
getGroup
();
Map
<
String
,
LineChart
>
allCharts
=
null
;
model
.
setLineCharts
(
new
ArrayList
<
LineChart
>(
allCharts
.
values
()));
break
;
case
JSON:
String
id
=
payload
.
getId
();
LineChart
lineChart
=
allCharts
.
get
(
id
);
if
(
group
==
null
||
group
.
length
()
==
0
)
{
allCharts
=
m_graphCreator
.
buildDashboard
(
start
,
end
);
}
else
{
allCharts
=
m_graphCreator
.
buildDashboardByGroup
(
start
,
end
,
group
);
if
(
lineChart
!=
null
)
{
model
.
setJson
(
allCharts
.
get
(
id
).
getJsonString
());
}
model
.
setLineCharts
(
new
ArrayList
<
LineChart
>(
allCharts
.
values
()));
break
;
}
Set
<
String
>
groups
=
m_metricGroupConfigManager
.
getMetricGroupConfig
().
getMetricGroups
().
keySet
();
...
...
@@ -82,14 +80,28 @@ public class Handler implements PageHandler<Context> {
m_jspViewer
.
view
(
ctx
,
model
);
}
private
void
normalize
(
Model
model
,
Payload
payloa
d
)
{
model
.
setPage
(
ReportPage
.
METRIC
)
;
String
p
oduct
=
payload
.
getProduct
();
private
Map
<
String
,
LineChart
>
buildLineCharts
(
Payload
payload
,
Date
start
,
Date
en
d
)
{
Map
<
String
,
LineChart
>
allCharts
=
null
;
String
p
roductLine
=
payload
.
getProduct
();
if
(
poduct
==
null
||
poduct
.
length
()
==
0
)
{
payload
.
setAction
(
Action
.
DASHBOARD
.
getName
());
if
(
StringUtils
.
isEmpty
(
productLine
))
{
String
group
=
payload
.
getGroup
();
if
(
StringUtils
.
isEmpty
(
group
))
{
allCharts
=
m_graphCreator
.
buildDashboard
(
start
,
end
);
}
else
{
allCharts
=
m_graphCreator
.
buildDashboardByGroup
(
start
,
end
,
group
);
}
}
else
{
allCharts
=
m_graphCreator
.
buildChartsByProductLine
(
productLine
,
start
,
end
);
}
return
allCharts
;
}
private
void
normalize
(
Model
model
,
Payload
payload
)
{
model
.
setPage
(
ReportPage
.
METRIC
);
m_normalizePayload
.
normalize
(
model
,
payload
);
int
timeRange
=
payload
.
getTimeRange
();
Date
startTime
=
new
Date
(
payload
.
getDate
()
-
(
timeRange
-
1
)
*
TimeUtil
.
ONE_HOUR
);
Date
endTime
=
new
Date
(
payload
.
getDate
()
+
TimeUtil
.
ONE_HOUR
-
1
);
...
...
@@ -97,5 +109,4 @@ public class Handler implements PageHandler<Context> {
model
.
setStartTime
(
startTime
);
model
.
setEndTime
(
endTime
);
}
}
cat-home/src/main/java/com/dianping/cat/report/page/metric/JspFile.java
浏览文件 @
06cad87a
...
...
@@ -3,7 +3,9 @@ package com.dianping.cat.report.page.metric;
public
enum
JspFile
{
METRIC
(
"/jsp/report/metric/metric.jsp"
),
DASHBOARD
(
"/jsp/report/metric/dashboard.jsp"
),
;
DASHBOARD
(
"/jsp/report/metric/dashboard.jsp"
),
JSON
(
"/jsp/report/metric/json.jsp"
);
private
String
m_path
;
...
...
cat-home/src/main/java/com/dianping/cat/report/page/metric/JspViewer.java
浏览文件 @
06cad87a
...
...
@@ -14,6 +14,8 @@ public class JspViewer extends BaseJspViewer<ReportPage, Action, Context, Model>
return
JspFile
.
METRIC
.
getPath
();
case
DASHBOARD:
return
JspFile
.
DASHBOARD
.
getPath
();
case
JSON:
return
JspFile
.
JSON
.
getPath
();
}
throw
new
RuntimeException
(
"Unknown action: "
+
action
);
...
...
cat-home/src/main/java/com/dianping/cat/report/page/metric/Model.java
浏览文件 @
06cad87a
...
...
@@ -27,6 +27,8 @@ public class Model extends AbstractReportModel<Action, Context> {
private
Date
m_endTime
;
private
String
m_json
;
public
Model
(
Context
ctx
)
{
super
(
ctx
);
}
...
...
@@ -90,4 +92,12 @@ public class Model extends AbstractReportModel<Action, Context> {
m_startTime
=
startTime
;
}
public
String
getJson
()
{
return
m_json
;
}
public
void
setJson
(
String
json
)
{
this
.
m_json
=
json
;
}
}
cat-home/src/main/java/com/dianping/cat/report/page/metric/Payload.java
浏览文件 @
06cad87a
...
...
@@ -33,6 +33,9 @@ public class Payload extends AbstractReportPayload<Action> {
@FieldMeta
(
"group"
)
private
String
m_group
;
@FieldMeta
(
"id"
)
private
String
m_id
;
public
Payload
()
{
super
(
ReportPage
.
METRIC
);
}
...
...
@@ -63,6 +66,10 @@ public class Payload extends AbstractReportPayload<Action> {
return
m_timeRange
;
}
public
String
getId
()
{
return
m_id
;
}
public
boolean
isFullScreen
()
{
return
m_fullScreen
;
}
...
...
@@ -108,6 +115,10 @@ public class Payload extends AbstractReportPayload<Action> {
m_hideNav
=
hideNav
;
}
public
void
setId
(
String
id
)
{
m_id
=
id
;
}
@Override
public
void
validate
(
ActionContext
<?>
ctx
)
{
if
(
m_action
==
null
)
{
...
...
cat-home/src/main/java/com/dianping/cat/report/task/alert/thirdParty/ThirdPartyAlert.java
浏览文件 @
06cad87a
...
...
@@ -79,7 +79,8 @@ public class ThirdPartyAlert implements Task {
List
<
ThirdPartyAlertEntity
>
thirdPartyAlerts
=
entry
.
getValue
();
AlertEntity
entity
=
new
AlertEntity
();
entity
.
setDate
(
new
Date
()).
setContent
(
thirdPartyAlerts
.
toString
()).
setLevel
(
"warning"
);
entity
.
setDate
(
new
Date
()).
setContent
(
thirdPartyAlerts
.
toString
())
.
setLevel
(
AlertConstants
.
WARNING_EXCEPTION
);
entity
.
setMetric
(
getName
()).
setType
(
getName
()).
setGroup
(
domain
);
m_sendManager
.
addAlert
(
entity
);
...
...
cat-home/src/main/webapp/jsp/report/metric/json.jsp
0 → 100644
浏览文件 @
06cad87a
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<jsp:useBean
id=
"ctx"
type=
"com.dianping.cat.report.page.metric.Context"
scope=
"request"
/>
<jsp:useBean
id=
"payload"
type=
"com.dianping.cat.report.page.metric.Payload"
scope=
"request"
/>
<jsp:useBean
id=
"model"
type=
"com.dianping.cat.report.page.metric.Model"
scope=
"request"
/>
${model.json}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录