Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
eebab20f
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,发现更多精彩内容 >>
提交
eebab20f
编写于
2月 13, 2015
作者:
Y
youyong205
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify the history report
上级
efc4651e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
147 addition
and
13 deletion
+147
-13
cat-home/src/main/java/com/dianping/cat/build/ReportServiceComponentConfigurator.java
...ianping/cat/build/ReportServiceComponentConfigurator.java
+2
-1
cat-home/src/main/java/com/dianping/cat/report/page/alert/Handler.java
...main/java/com/dianping/cat/report/page/alert/Handler.java
+0
-1
cat-home/src/main/java/com/dianping/cat/report/service/impl/StorageReportService.java
...ianping/cat/report/service/impl/StorageReportService.java
+145
-11
未找到文件。
cat-home/src/main/java/com/dianping/cat/build/ReportServiceComponentConfigurator.java
浏览文件 @
eebab20f
...
...
@@ -46,6 +46,7 @@ import com.dianping.cat.report.service.impl.ProblemReportService;
import
com.dianping.cat.report.service.impl.RouterConfigService
;
import
com.dianping.cat.report.service.impl.ServiceReportService
;
import
com.dianping.cat.report.service.impl.StateReportService
;
import
com.dianping.cat.report.service.impl.StorageReportService
;
import
com.dianping.cat.report.service.impl.SystemReportService
;
import
com.dianping.cat.report.service.impl.TopReportService
;
import
com.dianping.cat.report.service.impl.TransactionReportService
;
...
...
@@ -74,7 +75,7 @@ public class ReportServiceComponentConfigurator extends AbstractResourceConfigur
all
.
add
(
C
(
ReportService
.
class
,
StateAnalyzer
.
ID
,
StateReportService
.
class
).
req
(
HourlyReportDao
.
class
,
DailyReportDao
.
class
,
WeeklyReportDao
.
class
,
MonthlyReportDao
.
class
,
HourlyReportContentDao
.
class
,
DailyReportContentDao
.
class
,
WeeklyReportContentDao
.
class
,
MonthlyReportContentDao
.
class
));
all
.
add
(
C
(
ReportService
.
class
,
StorageAnalyzer
.
ID
,
Cross
ReportService
.
class
).
req
(
HourlyReportDao
.
class
,
all
.
add
(
C
(
ReportService
.
class
,
StorageAnalyzer
.
ID
,
Storage
ReportService
.
class
).
req
(
HourlyReportDao
.
class
,
DailyReportDao
.
class
,
WeeklyReportDao
.
class
,
MonthlyReportDao
.
class
,
HourlyReportContentDao
.
class
,
DailyReportContentDao
.
class
,
WeeklyReportContentDao
.
class
,
MonthlyReportContentDao
.
class
));
...
...
cat-home/src/main/java/com/dianping/cat/report/page/alert/Handler.java
浏览文件 @
eebab20f
...
...
@@ -124,7 +124,6 @@ public class Handler implements PageHandler<Context> {
}
}
catch
(
DalException
e
)
{
setAlertResult
(
model
,
5
);
e
.
printStackTrace
();
Cat
.
logError
(
e
);
}
}
...
...
cat-home/src/main/java/com/dianping/cat/report/service/impl/StorageReportService.java
浏览文件 @
eebab20f
package
com.dianping.cat.report.service.impl
;
import
java.util.Date
;
import
java.util.List
;
import
org.unidal.dal.jdbc.DalException
;
import
org.unidal.dal.jdbc.DalNotFoundException
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.Constants
;
import
com.dianping.cat.consumer.storage.StorageReportMerger
;
import
com.dianping.cat.consumer.storage.model.entity.StorageReport
;
import
com.dianping.cat.consumer.storage.model.transform.DefaultNativeParser
;
import
com.dianping.cat.core.dal.DailyReport
;
import
com.dianping.cat.core.dal.DailyReportEntity
;
import
com.dianping.cat.core.dal.HourlyReport
;
import
com.dianping.cat.core.dal.HourlyReportContent
;
import
com.dianping.cat.core.dal.HourlyReportContentEntity
;
import
com.dianping.cat.core.dal.HourlyReportEntity
;
import
com.dianping.cat.core.dal.MonthlyReport
;
import
com.dianping.cat.core.dal.MonthlyReportEntity
;
import
com.dianping.cat.core.dal.WeeklyReport
;
import
com.dianping.cat.core.dal.WeeklyReportEntity
;
import
com.dianping.cat.helper.TimeHelper
;
import
com.dianping.cat.home.dal.report.DailyReportContent
;
import
com.dianping.cat.home.dal.report.DailyReportContentEntity
;
import
com.dianping.cat.home.dal.report.MonthlyReportContent
;
import
com.dianping.cat.home.dal.report.MonthlyReportContentEntity
;
import
com.dianping.cat.home.dal.report.WeeklyReportContent
;
import
com.dianping.cat.home.dal.report.WeeklyReportContentEntity
;
import
com.dianping.cat.report.service.AbstractReportService
;
public
class
StorageReportService
extends
AbstractReportService
<
StorageReport
>
{
...
...
@@ -21,26 +46,135 @@ public class StorageReportService extends AbstractReportService<StorageReport> {
@Override
public
StorageReport
queryDailyReport
(
String
id
,
Date
start
,
Date
end
)
{
// TODO Auto-generated method stub
return
null
;
StorageReportMerger
merger
=
new
StorageReportMerger
(
new
StorageReport
(
id
));
long
startTime
=
start
.
getTime
();
long
endTime
=
end
.
getTime
();
String
name
=
Constants
.
REPORT_HEAVY
;
for
(;
startTime
<
endTime
;
startTime
=
startTime
+
TimeHelper
.
ONE_DAY
)
{
try
{
DailyReport
report
=
m_dailyReportDao
.
findByDomainNamePeriod
(
id
,
name
,
new
Date
(
startTime
),
DailyReportEntity
.
READSET_FULL
);
StorageReport
reportModel
=
queryFromDailyBinary
(
report
.
getId
(),
id
);
reportModel
.
accept
(
merger
);
}
catch
(
DalNotFoundException
e
)
{
// ignore
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
}
StorageReport
storageReport
=
merger
.
getStorageReport
();
storageReport
.
setStartTime
(
start
);
storageReport
.
setEndTime
(
end
);
return
storageReport
;
}
private
StorageReport
queryFromDailyBinary
(
int
id
,
String
domain
)
throws
DalException
{
DailyReportContent
content
=
m_dailyReportContentDao
.
findByPK
(
id
,
DailyReportContentEntity
.
READSET_FULL
);
if
(
content
!=
null
)
{
return
DefaultNativeParser
.
parse
(
content
.
getContent
());
}
else
{
return
new
StorageReport
(
domain
);
}
}
private
StorageReport
queryFromHourlyBinary
(
int
id
,
String
reportId
)
throws
DalException
{
HourlyReportContent
content
=
m_hourlyReportContentDao
.
findByPK
(
id
,
HourlyReportContentEntity
.
READSET_FULL
);
if
(
content
!=
null
)
{
return
DefaultNativeParser
.
parse
(
content
.
getContent
());
}
else
{
return
new
StorageReport
(
reportId
);
}
}
private
StorageReport
queryFromMonthlyBinary
(
int
id
,
String
reportId
)
throws
DalException
{
MonthlyReportContent
content
=
m_monthlyReportContentDao
.
findByPK
(
id
,
MonthlyReportContentEntity
.
READSET_FULL
);
if
(
content
!=
null
)
{
return
DefaultNativeParser
.
parse
(
content
.
getContent
());
}
else
{
return
new
StorageReport
(
reportId
);
}
}
private
StorageReport
queryFromWeeklyBinary
(
int
id
,
String
reportId
)
throws
DalException
{
WeeklyReportContent
content
=
m_weeklyReportContentDao
.
findByPK
(
id
,
WeeklyReportContentEntity
.
READSET_FULL
);
if
(
content
!=
null
)
{
return
DefaultNativeParser
.
parse
(
content
.
getContent
());
}
else
{
return
new
StorageReport
(
reportId
);
}
}
@Override
public
StorageReport
queryHourlyReport
(
String
id
,
Date
start
,
Date
end
)
{
// TODO Auto-generated method stub
return
null
;
public
StorageReport
queryHourlyReport
(
String
reportId
,
Date
start
,
Date
end
)
{
StorageReportMerger
merger
=
new
StorageReportMerger
(
new
StorageReport
(
reportId
));
long
startTime
=
start
.
getTime
();
long
endTime
=
end
.
getTime
();
String
name
=
Constants
.
REPORT_HEAVY
;
for
(;
startTime
<
endTime
;
startTime
=
startTime
+
TimeHelper
.
ONE_HOUR
)
{
List
<
HourlyReport
>
reports
=
null
;
try
{
reports
=
m_hourlyReportDao
.
findAllByDomainNamePeriod
(
new
Date
(
startTime
),
reportId
,
name
,
HourlyReportEntity
.
READSET_FULL
);
}
catch
(
DalException
e
)
{
Cat
.
logError
(
e
);
}
if
(
reports
!=
null
)
{
for
(
HourlyReport
report
:
reports
)
{
try
{
StorageReport
reportModel
=
queryFromHourlyBinary
(
report
.
getId
(),
reportId
);
reportModel
.
accept
(
merger
);
}
catch
(
DalNotFoundException
e
)
{
// ignore
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
}
}
}
StorageReport
storageReport
=
merger
.
getStorageReport
();
storageReport
.
setStartTime
(
start
);
storageReport
.
setEndTime
(
new
Date
(
end
.
getTime
()
-
1
));
return
storageReport
;
}
@Override
public
StorageReport
queryMonthlyReport
(
String
id
,
Date
start
)
{
// TODO Auto-generated method stub
return
null
;
public
StorageReport
queryMonthlyReport
(
String
reportId
,
Date
start
)
{
try
{
MonthlyReport
entity
=
m_monthlyReportDao
.
findReportByDomainNamePeriod
(
start
,
reportId
,
Constants
.
REPORT_HEAVY
,
MonthlyReportEntity
.
READSET_FULL
);
return
queryFromMonthlyBinary
(
entity
.
getId
(),
reportId
);
}
catch
(
DalNotFoundException
e
)
{
// ignore
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
return
new
StorageReport
(
reportId
);
}
@Override
public
StorageReport
queryWeeklyReport
(
String
id
,
Date
start
)
{
// TODO Auto-generated method stub
return
null
;
public
StorageReport
queryWeeklyReport
(
String
reportId
,
Date
start
)
{
try
{
WeeklyReport
entity
=
m_weeklyReportDao
.
findReportByDomainNamePeriod
(
start
,
reportId
,
Constants
.
REPORT_HEAVY
,
WeeklyReportEntity
.
READSET_FULL
);
return
queryFromWeeklyBinary
(
entity
.
getId
(),
reportId
);
}
catch
(
DalNotFoundException
e
)
{
// ignore
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
return
new
StorageReport
(
reportId
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录