Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
b7758f9d
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,发现更多精彩内容 >>
提交
b7758f9d
编写于
6月 05, 2012
作者:
Y
You Yong
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
ssh://192.168.8.22:58422/cat
上级
8d6a0706
4413c81b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
19 deletion
+26
-19
cat-home/src/main/java/com/dianping/cat/report/page/event/Handler.java
...main/java/com/dianping/cat/report/page/event/Handler.java
+23
-12
cat-home/src/main/java/com/dianping/cat/report/task/TaskConsumer.java
.../main/java/com/dianping/cat/report/task/TaskConsumer.java
+3
-7
未找到文件。
cat-home/src/main/java/com/dianping/cat/report/page/event/Handler.java
浏览文件 @
b7758f9d
...
...
@@ -2,21 +2,23 @@ package com.dianping.cat.report.page.event;
import
java.io.IOException
;
import
java.util.Date
;
import
java.util.List
;
import
javax.servlet.ServletException
;
import
org.unidal.webres.helper.Files
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.configuration.ServerConfigManager
;
import
com.dianping.cat.consumer.event.StatisticsComputer
;
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.event.model.transform.DefaultDomParser
;
import
com.dianping.cat.hadoop.dal.Dailyreport
;
import
com.dianping.cat.hadoop.dal.DailyreportDao
;
import
com.dianping.cat.hadoop.dal.DailyreportEntity
;
import
com.dianping.cat.helper.CatString
;
import
com.dianping.cat.report.ReportPage
;
import
com.dianping.cat.report.graph.GraphBuilder
;
import
com.dianping.cat.report.page.model.event.EventReportMerger
;
import
com.dianping.cat.report.page.model.spi.ModelRequest
;
import
com.dianping.cat.report.page.model.spi.ModelResponse
;
import
com.dianping.cat.report.page.model.spi.ModelService
;
...
...
@@ -40,6 +42,9 @@ public class Handler implements PageHandler<Context> {
@Inject
private
ServerConfigManager
m_manager
;
@Inject
private
DailyreportDao
dailyreportDao
;
private
StatisticsComputer
m_computer
=
new
StatisticsComputer
();
...
...
@@ -145,6 +150,8 @@ public class Handler implements PageHandler<Context> {
m_jspViewer
.
view
(
ctx
,
model
);
}
private
com
.
dianping
.
cat
.
consumer
.
event
.
model
.
transform
.
DefaultDomParser
eventParser
=
new
com
.
dianping
.
cat
.
consumer
.
event
.
model
.
transform
.
DefaultDomParser
();
private
void
showSummarizeReport
(
Model
model
,
Payload
payload
)
{
String
type
=
payload
.
getType
();
String
sorted
=
payload
.
getSortBy
();
...
...
@@ -154,27 +161,31 @@ public class Handler implements PageHandler<Context> {
}
model
.
setIpAddress
(
ip
);
String
oldXml
;
EventReport
report
=
null
;
EventReport
eventReport
=
null
;
try
{
//TODO
Date
start
=
payload
.
getHistoryStartDate
();
Date
end
=
payload
.
getHistoryEndDate
();
String
domain
=
model
.
getDomain
();
oldXml
=
Files
.
forIO
().
readFrom
(
getClass
().
getResourceAsStream
(
"event.xml"
),
"utf-8"
);
report
=
new
DefaultDomParser
().
parse
(
oldXml
);
List
<
Dailyreport
>
reports
=
dailyreportDao
.
findAllByDomainNameDuration
(
start
,
end
,
domain
,
"event"
,
DailyreportEntity
.
READSET_FULL
);
EventReportMerger
merger
=
new
EventReportMerger
(
new
EventReport
(
domain
));
for
(
Dailyreport
report
:
reports
)
{
String
xml
=
report
.
getContent
();
EventReport
reportModel
=
eventParser
.
parse
(
xml
);
reportModel
.
accept
(
merger
);
}
eventReport
=
merger
==
null
?
null
:
merger
.
getEventReport
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
if
(
r
eport
==
null
)
{
if
(
eventR
eport
==
null
)
{
return
;
}
model
.
setReport
(
r
eport
);
model
.
setReport
(
eventR
eport
);
if
(!
StringUtils
.
isEmpty
(
type
))
{
model
.
setDisplayNameReport
(
new
DisplayEventNameReport
().
display
(
sorted
,
type
,
ip
,
r
eport
));
model
.
setDisplayNameReport
(
new
DisplayEventNameReport
().
display
(
sorted
,
type
,
ip
,
eventR
eport
));
}
else
{
model
.
setDisplayTypeReport
(
new
DisplayEventTypeReport
().
display
(
sorted
,
ip
,
r
eport
));
model
.
setDisplayTypeReport
(
new
DisplayEventTypeReport
().
display
(
sorted
,
ip
,
eventR
eport
));
}
}
...
...
cat-home/src/main/java/com/dianping/cat/report/task/TaskConsumer.java
浏览文件 @
b7758f9d
...
...
@@ -28,11 +28,6 @@ public abstract class TaskConsumer implements Runnable {
private
volatile
boolean
stopped
=
false
;
public
void
run
()
{
try
{
Thread
.
sleep
(
1000
*
10
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
String
localIp
=
NetworkInterfaceManager
.
INSTANCE
.
getLocalHostAddress
();
findtask:
while
(
running
)
{
LockSupport
.
parkNanos
(
2L
*
1000
*
1000
*
1000
);
...
...
@@ -53,8 +48,9 @@ public abstract class TaskConsumer implements Runnable {
continue
findtask
;
}
}
updateDoingToDone
(
task
);
mergeReport
(
task
);
if
(
updateDoingToDone
(
task
))
{
mergeReport
(
task
);
}
}
}
else
{
taskNotFoundDuration
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录