Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
9e677d6b
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,发现更多精彩内容 >>
提交
9e677d6b
编写于
6月 13, 2012
作者:
S
sean.wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
event graph
上级
f20c8605
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
104 addition
and
5 deletion
+104
-5
cat-home/src/main/java/com/dianping/cat/report/task/DefaultTaskConsumer.java
...ava/com/dianping/cat/report/task/DefaultTaskConsumer.java
+104
-5
未找到文件。
cat-home/src/main/java/com/dianping/cat/report/task/DefaultTaskConsumer.java
浏览文件 @
9e677d6b
...
...
@@ -18,7 +18,9 @@ import org.codehaus.plexus.logging.Logger;
import
org.xml.sax.SAXException
;
import
com.dianping.cat.configuration.NetworkInterfaceManager
;
import
com.dianping.cat.consumer.event.model.entity.EventName
;
import
com.dianping.cat.consumer.event.model.entity.EventReport
;
import
com.dianping.cat.consumer.event.model.entity.EventType
;
import
com.dianping.cat.consumer.heartbeat.model.entity.HeartbeatReport
;
import
com.dianping.cat.consumer.problem.model.entity.ProblemReport
;
import
com.dianping.cat.consumer.transaction.model.entity.Machine
;
...
...
@@ -295,9 +297,106 @@ public class DefaultTaskConsumer extends TaskConsumer implements LogEnabled {
return
transactionReport
;
}
private
List
<
Graph
>
splitEventReportToGraphs
(
Date
reportPeroid
,
String
reportDomain
,
String
reportName
,
EventReport
transactionReport
)
{
// TODO Auto-generated method stub
return
null
;
private
List
<
Graph
>
splitEventReportToGraphs
(
Date
reportPeroid
,
String
domainName
,
String
reportName
,
EventReport
eventReport
)
{
Set
<
String
>
ips
=
eventReport
.
getIps
();
List
<
Graph
>
graphs
=
new
ArrayList
<
Graph
>(
ips
.
size
()
+
1
);
// all and every machine
Map
<
String
,
GraphLine
>
allDetailCache
=
new
TreeMap
<
String
,
GraphLine
>();
Map
<
String
,
GraphLine
>
allSummaryCache
=
new
TreeMap
<
String
,
GraphLine
>();
Date
creationDate
=
new
Date
();
for
(
String
ip
:
ips
)
{
Graph
graph
=
new
Graph
();
graph
.
setIp
(
ip
);
graph
.
setDomain
(
domainName
);
graph
.
setName
(
reportName
);
graph
.
setPeriod
(
reportPeroid
);
graph
.
setType
(
3
);
graph
.
setCreationDate
(
creationDate
);
com
.
dianping
.
cat
.
consumer
.
event
.
model
.
entity
.
Machine
machine
=
eventReport
.
getMachines
().
get
(
ip
);
Map
<
String
,
EventType
>
types
=
machine
.
getTypes
();
StringBuilder
detailBuilder
=
new
StringBuilder
();
StringBuilder
summaryBuilder
=
new
StringBuilder
();
for
(
Entry
<
String
,
EventType
>
eventEntry
:
types
.
entrySet
())
{
EventType
eventType
=
eventEntry
.
getValue
();
summaryBuilder
.
append
(
eventType
.
getId
());
summaryBuilder
.
append
(
'\t'
);
summaryBuilder
.
append
(
eventType
.
getTotalCount
());
summaryBuilder
.
append
(
'\t'
);
summaryBuilder
.
append
(
eventType
.
getFailCount
());
summaryBuilder
.
append
(
'\n'
);
String
summaryKey
=
eventType
.
getId
();
GraphLine
summaryLine
=
allSummaryCache
.
get
(
summaryKey
);
if
(
summaryLine
==
null
)
{
summaryLine
=
new
GraphLine
();
allSummaryCache
.
put
(
summaryKey
,
summaryLine
);
}
summaryLine
.
totalCount
+=
eventType
.
getTotalCount
();
summaryLine
.
failCount
+=
eventType
.
getFailCount
();
Map
<
String
,
EventName
>
names
=
eventType
.
getNames
();
for
(
Entry
<
String
,
EventName
>
nameEntry
:
names
.
entrySet
())
{
EventName
eventName
=
nameEntry
.
getValue
();
detailBuilder
.
append
(
eventType
.
getId
());
detailBuilder
.
append
(
'\t'
);
detailBuilder
.
append
(
eventName
.
getId
());
detailBuilder
.
append
(
'\t'
);
detailBuilder
.
append
(
eventName
.
getTotalCount
());
detailBuilder
.
append
(
'\t'
);
detailBuilder
.
append
(
eventName
.
getFailCount
());
detailBuilder
.
append
(
'\n'
);
String
key
=
eventType
.
getId
()
+
"\t"
+
eventName
.
getId
();
GraphLine
detailLine
=
allDetailCache
.
get
(
key
);
if
(
detailLine
==
null
)
{
detailLine
=
new
GraphLine
();
allDetailCache
.
put
(
key
,
detailLine
);
}
detailLine
.
totalCount
+=
eventName
.
getTotalCount
();
detailLine
.
failCount
+=
eventName
.
getFailCount
();
}
}
graph
.
setDetailContent
(
detailBuilder
.
toString
());
graph
.
setSummaryContent
(
summaryBuilder
.
toString
());
graphs
.
add
(
graph
);
}
Graph
allGraph
=
new
Graph
();
allGraph
.
setIp
(
"all"
);
allGraph
.
setDomain
(
domainName
);
allGraph
.
setName
(
reportName
);
allGraph
.
setPeriod
(
reportPeroid
);
allGraph
.
setType
(
3
);
allGraph
.
setCreationDate
(
creationDate
);
StringBuilder
detailSb
=
new
StringBuilder
();
for
(
Entry
<
String
,
GraphLine
>
entry
:
allDetailCache
.
entrySet
())
{
detailSb
.
append
(
entry
.
getKey
());
detailSb
.
append
(
'\t'
);
GraphLine
value
=
entry
.
getValue
();
detailSb
.
append
(
value
.
totalCount
);
detailSb
.
append
(
'\t'
);
detailSb
.
append
(
value
.
failCount
);
detailSb
.
append
(
'\t'
);
detailSb
.
append
(
'\n'
);
}
allGraph
.
setDetailContent
(
detailSb
.
toString
());
StringBuilder
summarySb
=
new
StringBuilder
();
for
(
Entry
<
String
,
GraphLine
>
entry
:
allSummaryCache
.
entrySet
())
{
summarySb
.
append
(
entry
.
getKey
());
summarySb
.
append
(
'\t'
);
GraphLine
value
=
entry
.
getValue
();
summarySb
.
append
(
value
.
totalCount
);
summarySb
.
append
(
'\t'
);
summarySb
.
append
(
value
.
failCount
);
summarySb
.
append
(
'\n'
);
}
allGraph
.
setSummaryContent
(
summarySb
.
toString
());
graphs
.
add
(
allGraph
);
return
graphs
;
}
private
List
<
Graph
>
splitHeartbeatReportToGraphs
(
Date
reportPeroid
,
String
reportDomain
,
String
reportName
,
HeartbeatReport
heartbeatReport
)
{
...
...
@@ -399,7 +498,7 @@ public class DefaultTaskConsumer extends TaskConsumer implements LogEnabled {
}
Graph
allGraph
=
new
Graph
();
allGraph
.
setIp
(
null
);
allGraph
.
setIp
(
"all"
);
allGraph
.
setDomain
(
domainName
);
allGraph
.
setName
(
reportName
);
allGraph
.
setPeriod
(
reportPeroid
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录