Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
c0629f94
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,发现更多精彩内容 >>
提交
c0629f94
编写于
5月 24, 2014
作者:
Y
youyong205
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify the metric title builder
上级
cd2a1380
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
34 addition
and
50 deletion
+34
-50
cat-home/src/main/java/com/dianping/cat/report/chart/AggregationGraphCreator.java
...om/dianping/cat/report/chart/AggregationGraphCreator.java
+1
-2
cat-home/src/main/java/com/dianping/cat/report/chart/BaseGraphCreator.java
.../java/com/dianping/cat/report/chart/BaseGraphCreator.java
+23
-37
cat-home/src/main/java/com/dianping/cat/report/chart/DefaultAggGraphCreator.java
...com/dianping/cat/report/chart/DefaultAggGraphCreator.java
+1
-2
cat-home/src/main/java/com/dianping/cat/report/task/metric/AlertInfo.java
...n/java/com/dianping/cat/report/task/metric/AlertInfo.java
+1
-1
cat-home/src/main/java/com/dianping/cat/report/task/metric/MetricAlert.java
...java/com/dianping/cat/report/task/metric/MetricAlert.java
+1
-1
cat-home/src/main/java/com/dianping/cat/report/task/metric/SwitchAlert.java
...java/com/dianping/cat/report/task/metric/SwitchAlert.java
+1
-1
cat-home/src/main/webapp/jsp/system/productLine/topologyProductLines.jsp
...in/webapp/jsp/system/productLine/topologyProductLines.jsp
+6
-6
未找到文件。
cat-home/src/main/java/com/dianping/cat/report/chart/AggregationGraphCreator.java
浏览文件 @
c0629f94
...
...
@@ -63,7 +63,6 @@ public class AggregationGraphCreator extends BaseGraphCreator {
private
Pair
<
String
,
LineChart
>
buildAggerationChart
(
final
Map
<
String
,
double
[]>
datas
,
Date
startDate
,
Date
endDate
,
final
Map
<
String
,
double
[]>
dataWithOutFutures
,
MetricAggregation
metricAggregation
)
{
MetricAggregationGroup
metricAggregationGroup
=
m_metricAggregationConfigManager
.
getMetricAggregationConfig
()
.
findMetricAggregationGroup
(
m_aggregationGroup
);
List
<
MetricItemConfig
>
alertItems
=
m_alertInfo
.
getLastestAlarm
(
5
);
...
...
@@ -88,7 +87,7 @@ public class AggregationGraphCreator extends BaseGraphCreator {
String
itemKey
=
domain
+
":"
+
type
+
":"
+
metricAggregationItem
.
getKey
()
+
":"
+
displayType
.
toUpperCase
();
if
(
dataWithOutFutures
.
containsKey
(
itemKey
))
{
buildLineChartTitle
(
alertItems
,
lineChart
,
itemKey
,
title
);
buildLineChartTitle
(
alertItems
,
lineChart
,
itemKey
);
Map
<
Long
,
Double
>
all
=
convertToMap
(
datas
.
get
(
itemKey
),
startDate
,
1
);
Map
<
Long
,
Double
>
current
=
convertToMap
(
dataWithOutFutures
.
get
(
itemKey
),
startDate
,
step
);
...
...
cat-home/src/main/java/com/dianping/cat/report/chart/BaseGraphCreator.java
浏览文件 @
c0629f94
...
...
@@ -62,8 +62,10 @@ public abstract class BaseGraphCreator implements LogEnabled {
protected
void
addLastMinuteData
(
Map
<
Long
,
Double
>
current
,
Map
<
Long
,
Double
>
all
,
int
minute
,
Date
end
)
{
int
step
=
m_dataExtractor
.
getStep
();
if
(
step
==
1
)
if
(
step
==
1
)
{
return
;
}
long
endTime
=
0
;
long
currentTime
=
System
.
currentTimeMillis
();
if
(
end
.
getTime
()
>
currentTime
)
{
...
...
@@ -95,21 +97,10 @@ public abstract class BaseGraphCreator implements LogEnabled {
protected
void
buildLineChartTitle
(
List
<
MetricItemConfig
>
alertItems
,
LineChart
chart
,
String
key
)
{
int
index
=
key
.
lastIndexOf
(
":"
);
String
i
d
=
key
.
substring
(
0
,
index
);
String
metricI
d
=
key
.
substring
(
0
,
index
);
String
type
=
key
.
substring
(
index
+
1
);
MetricItemConfig
config
=
m_metricConfigManager
.
queryMetricItemConfig
(
id
);
String
metricId
=
m_metricConfigManager
.
buildMetricKey
(
config
.
getDomain
(),
config
.
getType
(),
config
.
getMetricKey
());
String
des
=
""
;
config
.
setId
(
metricId
);
if
(
MetricType
.
AVG
.
name
().
equals
(
type
))
{
des
=
Chinese
.
Suffix_AVG
;
}
else
if
(
MetricType
.
SUM
.
name
().
equals
(
type
))
{
des
=
Chinese
.
Suffix_SUM
;
}
else
if
(
MetricType
.
COUNT
.
name
().
equals
(
type
))
{
des
=
Chinese
.
Suffix_COUNT
;
}
MetricItemConfig
config
=
m_metricConfigManager
.
queryMetricItemConfig
(
metricId
);
String
des
=
queryMetricItemDes
(
type
);
String
title
=
config
.
getTitle
()
+
des
;
chart
.
setTitle
(
title
);
...
...
@@ -122,24 +113,18 @@ public abstract class BaseGraphCreator implements LogEnabled {
}
}
public
void
buildLineChartTitle
(
List
<
MetricItemConfig
>
alertItems
,
LineChart
chart
,
String
key
,
String
title
)
{
if
(
chart
.
getHtmlTitle
().
contains
(
"<span style='color:red'>"
))
{
return
;
}
int
index
=
key
.
lastIndexOf
(
":"
);
String
id
=
key
.
substring
(
0
,
index
);
MetricItemConfig
config
=
m_metricConfigManager
.
queryMetricItemConfig
(
id
);
String
metricId
=
m_metricConfigManager
.
buildMetricKey
(
config
.
getDomain
(),
config
.
getType
(),
config
.
getMetricKey
());
config
.
setId
(
metricId
);
private
String
queryMetricItemDes
(
String
type
)
{
String
des
=
""
;
if
(
alertItems
.
contains
(
config
))
{
chart
.
setHtmlTitle
(
"<span style='color:red'>"
+
title
+
"</span>"
);
}
else
{
chart
.
setHtmlTitle
(
title
);
if
(
MetricType
.
AVG
.
name
().
equals
(
type
))
{
des
=
Chinese
.
Suffix_AVG
;
}
else
if
(
MetricType
.
SUM
.
name
().
equals
(
type
))
{
des
=
Chinese
.
Suffix_SUM
;
}
else
if
(
MetricType
.
COUNT
.
name
().
equals
(
type
))
{
des
=
Chinese
.
Suffix_COUNT
;
}
}
return
des
;
}
protected
double
[]
convert
(
double
[]
value
,
int
removeLength
)
{
int
length
=
value
.
length
;
...
...
@@ -202,7 +187,7 @@ public abstract class BaseGraphCreator implements LogEnabled {
for
(;
start
<
end
;
start
+=
TimeUtil
.
ONE_HOUR
)
{
Map
<
String
,
double
[]>
currentValues
=
queryMetricValueByDate
(
productLine
,
start
);
mergeMap
(
oldCurrentValues
,
currentValues
,
totalSize
,
index
);
index
++;
}
...
...
@@ -234,7 +219,7 @@ public abstract class BaseGraphCreator implements LogEnabled {
MetricReport
metricReport
=
m_metricReportService
.
queryMetricReport
(
productLine
,
new
Date
(
start
));
List
<
String
>
domains
=
m_productLineConfigManager
.
queryDomainsByProductLine
(
productLine
);
List
<
MetricItemConfig
>
metricConfigs
=
m_metricConfigManager
.
queryMetricItemConfigs
(
domains
);
Collections
.
sort
(
metricConfigs
,
new
Comparator
<
MetricItemConfig
>()
{
@Override
public
int
compare
(
MetricItemConfig
o1
,
MetricItemConfig
o2
)
{
...
...
@@ -254,7 +239,8 @@ public abstract class BaseGraphCreator implements LogEnabled {
}
// if current report is not exist, use last day value replace it.
if
(
sum
<=
0
&&
start
<
TimeUtil
.
getCurrentHour
().
getTime
())
{
MetricReport
lastMetricReport
=
m_metricReportService
.
queryMetricReport
(
productLine
,
new
Date
(
start
-
TimeUtil
.
ONE_DAY
));
MetricReport
lastMetricReport
=
m_metricReportService
.
queryMetricReport
(
productLine
,
new
Date
(
start
-
TimeUtil
.
ONE_DAY
));
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:ss"
);
m_logger
.
error
(
"Replace error value, Metric report is not exsit, productLine:"
+
productLine
+
" ,date:"
...
...
@@ -269,8 +255,8 @@ public abstract class BaseGraphCreator implements LogEnabled {
// remove the minute of future
Map
<
String
,
double
[]>
newCurrentValues
=
new
LinkedHashMap
<
String
,
double
[]>();
int
step
=
m_dataExtractor
.
getStep
();
if
(
step
<=
0
){
if
(
step
<=
0
)
{
return
allCurrentValues
;
}
int
minute
=
Calendar
.
getInstance
().
get
(
Calendar
.
MINUTE
);
...
...
@@ -295,7 +281,7 @@ public abstract class BaseGraphCreator implements LogEnabled {
}
values
.
put
(
key
,
value
);
}
protected
void
put
(
Map
<
String
,
LineChart
>
charts
,
Map
<
String
,
LineChart
>
result
,
String
key
)
{
LineChart
value
=
charts
.
get
(
key
);
...
...
cat-home/src/main/java/com/dianping/cat/report/chart/DefaultAggGraphCreator.java
浏览文件 @
c0629f94
...
...
@@ -36,7 +36,6 @@ public class DefaultAggGraphCreator extends GraphCreator {
@Override
public
Map
<
String
,
LineChart
>
buildChartData
(
final
Map
<
String
,
double
[]>
datas
,
Date
startDate
,
Date
endDate
,
final
Map
<
String
,
double
[]>
dataWithOutFutures
)
{
Map
<
String
,
List
<
String
>>
aggregationKeys
=
buildLineChartKeys
(
dataWithOutFutures
.
keySet
());
Map
<
String
,
LineChart
>
charts
=
new
LinkedHashMap
<
String
,
LineChart
>();
List
<
MetricItemConfig
>
alertItems
=
m_alertInfo
.
getLastestAlarm
(
5
);
...
...
@@ -54,7 +53,7 @@ public class DefaultAggGraphCreator extends GraphCreator {
for
(
String
key
:
keyMapEntry
.
getValue
())
{
if
(
dataWithOutFutures
.
containsKey
(
key
))
{
buildLineChartTitle
(
alertItems
,
lineChart
,
key
,
chartTitle
);
buildLineChartTitle
(
alertItems
,
lineChart
,
key
);
double
[]
baselines
=
queryBaseline
(
key
,
startDate
,
endDate
);
Map
<
Long
,
Double
>
all
=
convertToMap
(
datas
.
get
(
key
),
startDate
,
1
);
...
...
cat-home/src/main/java/com/dianping/cat/report/task/metric/AlertInfo.java
浏览文件 @
c0629f94
...
...
@@ -12,7 +12,7 @@ public class AlertInfo {
private
ConcurrentHashMap
<
MetricItemConfig
,
Long
>
m_alerts
=
new
ConcurrentHashMap
<
MetricItemConfig
,
Long
>();
public
void
add
Metric
(
MetricItemConfig
config
,
long
value
)
{
public
void
add
AlertInfo
(
MetricItemConfig
config
,
long
value
)
{
m_alerts
.
putIfAbsent
(
config
,
value
);
}
...
...
cat-home/src/main/java/com/dianping/cat/report/task/metric/MetricAlert.java
浏览文件 @
c0629f94
...
...
@@ -183,7 +183,7 @@ public class MetricAlert extends BaseAlert implements Task, LogEnabled {
if
(
alert
!=
null
&&
alert
.
getKey
())
{
config
.
setId
(
m_metricConfigManager
.
buildMetricKey
(
config
.
getDomain
(),
config
.
getType
(),
config
.
getMetricKey
()));
m_alertInfo
.
add
Metric
(
config
,
new
Date
().
getTime
());
m_alertInfo
.
add
AlertInfo
(
config
,
new
Date
().
getTime
());
sendAlertInfo
(
productLine
,
config
,
alert
.
getValue
());
}
}
...
...
cat-home/src/main/java/com/dianping/cat/report/task/metric/SwitchAlert.java
浏览文件 @
c0629f94
...
...
@@ -124,7 +124,7 @@ public class SwitchAlert extends BaseAlert implements Task, LogEnabled {
if
(
alert
!=
null
&&
alert
.
getKey
())
{
config
.
setId
(
m_metricConfigManager
.
buildMetricKey
(
config
.
getDomain
(),
config
.
getType
(),
config
.
getMetricKey
()));
m_alertInfo
.
add
Metric
(
config
,
new
Date
().
getTime
());
m_alertInfo
.
add
AlertInfo
(
config
,
new
Date
().
getTime
());
sendAlertInfo
(
productLine
,
config
,
alert
.
getValue
());
}
}
...
...
cat-home/src/main/webapp/jsp/system/productLine/topologyProductLines.jsp
浏览文件 @
c0629f94
...
...
@@ -73,27 +73,27 @@
<th
width=
"10%"
>
产品线
</th>
<th
width=
"10%"
>
标题
</th>
<th
width=
"5%"
>
顺序
</th>
<th
width=
"5%"
>
错误监控
</th>
<th
width=
"5%"
>
业务监控
</th>
<th
width=
"5%"
>
外部监控
</th>
<th
width=
"5%"
>
应用监控
</th>
<th
width=
"5%"
>
网络监控
</th>
<th
width=
"5%"
>
系统监控
</th>
<th
width=
"5%"
>
外部监控
</th>
<th
width=
"40%"
>
项目列表
</th>
<th
width=
"10%"
>
操作
<a
href=
"?op=topologyProductLineAdd&type=${type}"
class=
'update btn btn-primary btn-small'
>
新增
</a></th>
</tr>
<c:forEach
var=
"item"
items=
"
${
listItem
.
value
}
"
varStatus=
"status"
>
<tr><td>
${item.id}
</td><td>
${item.title}
</td>
<td>
${item.order}
</td>
<td><c:if
test=
"
${
item
.
dashboard
}
"
><span
class=
"text-error"
><strong>
是
</strong></span></c:if>
<c:if
test=
"
${
!
item
.
dashboard
}
"
><span><strong>
否
</strong></span></c:if>
</td>
<td><c:if
test=
"
${
item
.
metricDashboard
}
"
><span
class=
"text-error"
><strong>
是
</strong></span></c:if>
<c:if
test=
"
${
!
item
.
metricDashboard
}
"
><span><strong>
否
</strong></span></c:if>
</td>
<td><c:if
test=
"
${
item
.
userMonitorDashboard
}
"
><span
class=
"text-error"
><strong>
是
</strong></span></c:if>
<c:if
test=
"
${
!
item
.
userMonitorDashboard
}
"
><span><strong>
否
</strong></span></c:if>
</td>
<td><c:if
test=
"
${
item
.
applicationDashboard
}
"
><span
class=
"text-error"
><strong>
是
</strong></span></c:if>
<c:if
test=
"
${
!
item
.
applicationDashboard
}
"
><span><strong>
否
</strong></span></c:if>
</td>
<td><c:if
test=
"
${
item
.
networkDashboard
}
"
><span
class=
"text-error"
><strong>
是
</strong></span></c:if>
<c:if
test=
"
${
!
item
.
networkDashboard
}
"
><span><strong>
否
</strong></span></c:if>
</td>
<td><c:if
test=
"
${
item
.
systemMonitorDashboard
}
"
><span
class=
"text-error"
><strong>
是
</strong></span></c:if>
<c:if
test=
"
${
!
item
.
systemMonitorDashboard
}
"
><span><strong>
否
</strong></span></c:if>
</td>
<td><c:if
test=
"
${
item
.
userMonitorDashboard
}
"
><span
class=
"text-error"
><strong>
是
</strong></span></c:if>
<c:if
test=
"
${
!
item
.
userMonitorDashboard
}
"
><span><strong>
否
</strong></span></c:if>
</td>
<td>
<c:forEach
var=
"domain"
items=
"
${
item
.
domains
}
"
>
${domain.key},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录