Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
331ebfab
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,发现更多精彩内容 >>
提交
331ebfab
编写于
7月 17, 2014
作者:
L
leon.li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add contact info in metric dashboard page
上级
9894cea0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
57 addition
and
10 deletion
+57
-10
cat-home/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
...n/java/com/dianping/cat/build/ComponentsConfigurator.java
+3
-3
cat-home/src/main/java/com/dianping/cat/report/page/metric/graph/MetricGraphCreator.java
...ping/cat/report/page/metric/graph/MetricGraphCreator.java
+48
-7
cat-home/src/main/resources/META-INF/plexus/components.xml
cat-home/src/main/resources/META-INF/plexus/components.xml
+6
-0
未找到文件。
cat-home/src/main/java/com/dianping/cat/build/ComponentsConfigurator.java
浏览文件 @
331ebfab
...
...
@@ -153,7 +153,7 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
all
.
add
(
C
(
MetricGraphCreator
.
class
).
req
(
CachedMetricReportService
.
class
,
DataExtractor
.
class
,
MetricDataFetcher
.
class
).
req
(
BaselineService
.
class
,
MetricConfigManager
.
class
,
ProductLineConfigManager
.
class
,
MetricGroupConfigManager
.
class
,
AlertInfo
.
class
));
ProductLineConfigManager
.
class
,
MetricGroupConfigManager
.
class
,
AlertInfo
.
class
,
ProjectDao
.
class
));
all
.
add
(
C
(
SystemGraphCreator
.
class
).
req
(
CachedMetricReportService
.
class
,
DataExtractor
.
class
,
MetricDataFetcher
.
class
).
req
(
BaselineService
.
class
,
MetricConfigManager
.
class
,
...
...
@@ -205,8 +205,8 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
all
.
add
(
C
(
AlertExceptionBuilder
.
class
).
req
(
ExceptionConfigManager
.
class
));
all
.
add
(
C
(
ExceptionAlert
.
class
).
req
(
ProjectDao
.
class
,
ExceptionAlertConfig
.
class
,
MailSMS
.
class
,
ExceptionConfigManager
.
class
,
AlertExceptionBuilder
.
class
,
AlertDao
.
class
).
req
(
ModelService
.
class
,
TopAnalyzer
.
ID
));
ExceptionConfigManager
.
class
,
AlertExceptionBuilder
.
class
,
AlertDao
.
class
).
req
(
ModelService
.
class
,
TopAnalyzer
.
ID
));
all
.
add
(
C
(
AlertSummaryExecutor
.
class
).
req
(
AlertSummaryGenerator
.
class
,
AlertSummaryManager
.
class
,
MailSMS
.
class
)
.
req
(
AlertSummaryDecorator
.
class
,
AlertSummaryFTLDecorator
.
ID
));
...
...
cat-home/src/main/java/com/dianping/cat/report/page/metric/graph/MetricGraphCreator.java
浏览文件 @
331ebfab
...
...
@@ -11,18 +11,59 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
org.unidal.lookup.annotation.Inject
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.advanced.metric.config.entity.MetricItemConfig
;
import
com.dianping.cat.consumer.company.model.entity.ProductLine
;
import
com.dianping.cat.consumer.metric.model.entity.MetricReport
;
import
com.dianping.cat.core.dal.Project
;
import
com.dianping.cat.core.dal.ProjectDao
;
import
com.dianping.cat.core.dal.ProjectEntity
;
import
com.dianping.cat.helper.Chinese
;
import
com.dianping.cat.helper.TimeUtil
;
import
com.dianping.cat.home.metric.group.entity.MetricKeyConfig
;
import
com.dianping.cat.report.chart.AbstractGraphCreator
;
import
com.dianping.cat.report.page.LineChart
;
import
com.dianping.cat.report.task.alert.MetricType
;
import
com.site.lookup.util.StringUtils
;
public
class
MetricGraphCreator
extends
AbstractGraphCreator
{
@Inject
private
ProjectDao
m_projectDao
;
protected
String
buildContactInfo
(
String
domainName
)
{
try
{
Project
project
=
m_projectDao
.
findByDomain
(
domainName
,
ProjectEntity
.
READSET_FULL
);
String
owners
=
project
.
getOwner
();
String
phones
=
project
.
getPhone
();
StringBuilder
builder
=
new
StringBuilder
();
if
(!
StringUtils
.
isEmpty
(
owners
))
{
builder
.
append
(
"[负责人: "
).
append
(
owners
);
}
if
(!
StringUtils
.
isEmpty
(
phones
))
{
builder
.
append
(
" 手机: "
).
append
(
phones
).
append
(
" ]"
);
}
return
builder
.
toString
();
}
catch
(
Exception
ex
)
{
Cat
.
logError
(
"build contact info error for doamin: "
+
domainName
,
ex
);
}
return
null
;
}
private
String
extractDomain
(
String
metricKey
)
{
try
{
return
metricKey
.
split
(
":"
)[
0
];
}
catch
(
Exception
ex
)
{
Cat
.
logError
(
"extract domain error:"
+
metricKey
,
ex
);
return
null
;
}
}
public
Map
<
String
,
LineChart
>
buildChartData
(
final
Map
<
String
,
double
[]>
datas
,
Date
startDate
,
Date
endDate
,
final
Map
<
String
,
double
[]>
dataWithOutFutures
)
{
Map
<
String
,
LineChart
>
charts
=
new
LinkedHashMap
<
String
,
LineChart
>();
...
...
@@ -31,10 +72,11 @@ public class MetricGraphCreator extends AbstractGraphCreator {
for
(
Entry
<
String
,
double
[]>
entry
:
dataWithOutFutures
.
entrySet
())
{
String
key
=
entry
.
getKey
();
String
contactInfo
=
buildContactInfo
(
extractDomain
(
key
));
double
[]
value
=
entry
.
getValue
();
LineChart
lineChart
=
new
LineChart
();
buildLineChartTitle
(
alertKeys
,
lineChart
,
key
);
buildLineChartTitle
(
alertKeys
,
lineChart
,
key
,
contactInfo
);
lineChart
.
setStart
(
startDate
);
lineChart
.
setSize
(
value
.
length
);
lineChart
.
setStep
(
step
*
TimeUtil
.
ONE_MINUTE
);
...
...
@@ -57,7 +99,7 @@ public class MetricGraphCreator extends AbstractGraphCreator {
Map
<
String
,
double
[]>
dataWithOutFutures
=
removeFutureData
(
endDate
,
allCurrentValues
);
return
buildChartData
(
oldCurrentValues
,
startDate
,
endDate
,
dataWithOutFutures
);
}
private
Map
<
String
,
double
[]>
prepareAllData
(
String
productLine
,
Date
startDate
,
Date
endDate
)
{
long
start
=
startDate
.
getTime
(),
end
=
endDate
.
getTime
();
int
totalSize
=
(
int
)
((
end
-
start
)
/
TimeUtil
.
ONE_MINUTE
);
...
...
@@ -72,7 +114,6 @@ public class MetricGraphCreator extends AbstractGraphCreator {
}
return
oldCurrentValues
;
}
private
Map
<
String
,
double
[]>
queryMetricValueByDate
(
String
productLine
,
long
start
)
{
MetricReport
metricReport
=
m_metricReportService
.
queryMetricReport
(
productLine
,
new
Date
(
start
));
...
...
@@ -199,7 +240,7 @@ public class MetricGraphCreator extends AbstractGraphCreator {
}
return
false
;
}
private
String
queryMetricItemDes
(
String
type
)
{
String
des
=
""
;
...
...
@@ -213,7 +254,7 @@ public class MetricGraphCreator extends AbstractGraphCreator {
return
des
;
}
private
void
buildLineChartTitle
(
List
<
String
>
alertKeys
,
LineChart
chart
,
String
key
)
{
private
void
buildLineChartTitle
(
List
<
String
>
alertKeys
,
LineChart
chart
,
String
key
,
String
contactInfo
)
{
int
index
=
key
.
lastIndexOf
(
":"
);
String
metricId
=
key
.
substring
(
0
,
index
);
String
type
=
key
.
substring
(
index
+
1
);
...
...
@@ -226,9 +267,9 @@ public class MetricGraphCreator extends AbstractGraphCreator {
chart
.
setId
(
metricId
+
":"
+
type
);
if
(
alertKeys
.
contains
(
metricId
))
{
chart
.
setHtmlTitle
(
"<span style='color:red'>"
+
title
+
"</span>"
);
chart
.
setHtmlTitle
(
"<span style='color:red'>"
+
title
+
"<
br><small>"
+
contactInfo
+
"</small><
/span>"
);
}
else
{
chart
.
setHtmlTitle
(
title
);
chart
.
setHtmlTitle
(
title
+
"<br><small>"
+
contactInfo
+
"</small>"
);
}
}
}
...
...
cat-home/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
331ebfab
...
...
@@ -291,6 +291,9 @@
<requirement>
<role>
com.dianping.cat.report.task.alert.AlertInfo
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.core.dal.ProjectDao
</role>
</requirement>
</requirements>
</component>
<component>
...
...
@@ -3145,6 +3148,9 @@
<role>
com.dianping.cat.report.page.metric.graph.MetricGraphCreator
</role>
<implementation>
com.dianping.cat.report.page.metric.graph.MetricGraphCreator
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.core.dal.ProjectDao
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.report.baseline.BaselineService
</role>
</requirement>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录