Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
42f35a95
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,发现更多精彩内容 >>
提交
42f35a95
编写于
4月 26, 2012
作者:
F
Frankie Wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix historical report issue
上级
8dba38a5
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
74 addition
and
66 deletion
+74
-66
cat-core/src/main/java/com/dianping/cat/status/StatusInfoCollector.java
...ain/java/com/dianping/cat/status/StatusInfoCollector.java
+1
-0
cat-core/src/main/resources/META-INF/dal/model/status-codegen.xml
.../src/main/resources/META-INF/dal/model/status-codegen.xml
+1
-0
cat-core/src/main/resources/META-INF/dal/model/status-model.xml
...re/src/main/resources/META-INF/dal/model/status-model.xml
+1
-0
cat-home/src/main/java/com/dianping/cat/report/page/ip/location/IPSeekerManager.java
...dianping/cat/report/page/ip/location/IPSeekerManager.java
+1
-1
cat-home/src/main/java/com/dianping/cat/report/page/model/event/HistoricalEventService.java
...g/cat/report/page/model/event/HistoricalEventService.java
+14
-13
cat-home/src/main/java/com/dianping/cat/report/page/model/heartbeat/HistoricalHeartbeatService.java
...port/page/model/heartbeat/HistoricalHeartbeatService.java
+14
-13
cat-home/src/main/java/com/dianping/cat/report/page/model/ip/HistoricalIpService.java
...ianping/cat/report/page/model/ip/HistoricalIpService.java
+14
-13
cat-home/src/main/java/com/dianping/cat/report/page/model/problem/HistoricalProblemService.java
...t/report/page/model/problem/HistoricalProblemService.java
+14
-13
cat-home/src/main/java/com/dianping/cat/report/page/model/transaction/HistoricalTransactionService.java
.../page/model/transaction/HistoricalTransactionService.java
+14
-13
未找到文件。
cat-core/src/main/java/com/dianping/cat/status/StatusInfoCollector.java
浏览文件 @
42f35a95
...
...
@@ -137,6 +137,7 @@ class StatusInfoCollector extends BaseVisitor {
MemoryMXBean
bean
=
ManagementFactory
.
getMemoryMXBean
();
Runtime
runtime
=
Runtime
.
getRuntime
();
memory
.
setMax
(
runtime
.
maxMemory
());
memory
.
setTotal
(
runtime
.
totalMemory
());
memory
.
setFree
(
runtime
.
freeMemory
());
memory
.
setHeapUsage
(
bean
.
getHeapMemoryUsage
().
getUsed
());
...
...
cat-core/src/main/resources/META-INF/dal/model/status-codegen.xml
浏览文件 @
42f35a95
...
...
@@ -36,6 +36,7 @@
<attribute
name=
"usable"
value-type=
"long"
/>
</entity>
<entity
name=
"memory"
>
<attribute
name=
"max"
value-type=
"int"
/>
<attribute
name=
"total"
value-type=
"int"
/>
<attribute
name=
"free"
value-type=
"int"
/>
<attribute
name=
"heap-usage"
value-type=
"int"
/>
...
...
cat-core/src/main/resources/META-INF/dal/model/status-model.xml
浏览文件 @
42f35a95
...
...
@@ -26,6 +26,7 @@
<attribute
name=
"usable"
value-type=
"long"
primitive=
"true"
/>
</entity>
<entity
name=
"memory"
class-name=
"MemoryInfo"
>
<attribute
name=
"max"
value-type=
"long"
primitive=
"true"
/>
<attribute
name=
"total"
value-type=
"long"
primitive=
"true"
/>
<attribute
name=
"free"
value-type=
"long"
primitive=
"true"
/>
<attribute
name=
"heap-usage"
value-type=
"long"
primitive=
"true"
/>
...
...
cat-home/src/main/java/com/dianping/cat/report/page/ip/location/IPSeekerManager.java
浏览文件 @
42f35a95
...
...
@@ -17,7 +17,7 @@ public class IPSeekerManager {
String
area
=
loc
.
getArea
();
String
country
=
loc
.
getCountry
();
if
(
area
.
isEmpty
()
&&
country
.
isEmpty
())
{
if
(
area
.
trim
().
isEmpty
()
&&
country
.
trim
()
.
isEmpty
())
{
return
""
;
}
else
{
return
area
+
"@"
+
country
;
...
...
cat-home/src/main/java/com/dianping/cat/report/page/model/event/HistoricalEventService.java
浏览文件 @
42f35a95
...
...
@@ -29,24 +29,18 @@ public class HistoricalEventService extends BaseHistoricalModelService<EventRepo
protected
EventReport
buildModel
(
ModelRequest
request
)
throws
Exception
{
String
domain
=
request
.
getDomain
();
long
date
=
Long
.
parseLong
(
request
.
getProperty
(
"date"
));
EventReport
report
=
getLocalReport
(
date
,
domain
)
;
EventReport
report
;
// try remote report
if
(
report
==
null
&&
!
isLocalMode
())
{
report
=
getRemoteReport
(
date
,
domain
);
if
(
isLocalMode
())
{
report
=
getReportFromLocalDisk
(
date
,
domain
);
}
else
{
report
=
getReportFromDatabase
(
date
,
domain
);
}
return
report
;
}
private
EventReport
getLocalReport
(
long
timestamp
,
String
domain
)
throws
Exception
{
Bucket
<
String
>
bucket
=
m_bucketManager
.
getReportBucket
(
timestamp
,
"event"
);
String
xml
=
bucket
.
findById
(
domain
);
return
xml
==
null
?
null
:
new
DefaultXmlParser
().
parse
(
xml
);
}
private
EventReport
getRemoteReport
(
long
timestamp
,
String
domain
)
throws
Exception
{
private
EventReport
getReportFromDatabase
(
long
timestamp
,
String
domain
)
throws
Exception
{
List
<
Report
>
reports
=
m_reportDao
.
findAllByPeriodDomainTypeName
(
new
Date
(
timestamp
),
domain
,
1
,
getName
(),
ReportEntity
.
READSET_FULL
);
DefaultXmlParser
parser
=
new
DefaultXmlParser
();
...
...
@@ -63,6 +57,13 @@ public class HistoricalEventService extends BaseHistoricalModelService<EventRepo
}
}
return
merger
.
getEventReport
();
return
merger
==
null
?
null
:
merger
.
getEventReport
();
}
private
EventReport
getReportFromLocalDisk
(
long
timestamp
,
String
domain
)
throws
Exception
{
Bucket
<
String
>
bucket
=
m_bucketManager
.
getReportBucket
(
timestamp
,
"event"
);
String
xml
=
bucket
.
findById
(
domain
);
return
xml
==
null
?
null
:
new
DefaultXmlParser
().
parse
(
xml
);
}
}
cat-home/src/main/java/com/dianping/cat/report/page/model/heartbeat/HistoricalHeartbeatService.java
浏览文件 @
42f35a95
...
...
@@ -30,24 +30,18 @@ public class HistoricalHeartbeatService extends BaseHistoricalModelService<Heart
protected
HeartbeatReport
buildModel
(
ModelRequest
request
)
throws
Exception
{
String
domain
=
request
.
getDomain
();
long
date
=
Long
.
parseLong
(
request
.
getProperty
(
"date"
));
HeartbeatReport
report
=
getLocalReport
(
date
,
domain
)
;
HeartbeatReport
report
;
// try remote report
if
(
report
==
null
&&
!
isLocalMode
())
{
report
=
getRemoteReport
(
date
,
domain
);
if
(
isLocalMode
())
{
report
=
getReportFromLocalDisk
(
date
,
domain
);
}
else
{
report
=
getReportFromDatabase
(
date
,
domain
);
}
return
report
;
}
private
HeartbeatReport
getLocalReport
(
long
timestamp
,
String
domain
)
throws
Exception
{
Bucket
<
String
>
bucket
=
m_bucketManager
.
getReportBucket
(
timestamp
,
"heartbeat"
);
String
xml
=
bucket
.
findById
(
domain
);
return
xml
==
null
?
null
:
new
DefaultXmlParser
().
parse
(
xml
);
}
private
HeartbeatReport
getRemoteReport
(
long
timestamp
,
String
domain
)
throws
Exception
{
private
HeartbeatReport
getReportFromDatabase
(
long
timestamp
,
String
domain
)
throws
Exception
{
List
<
Report
>
reports
=
m_reportDao
.
findAllByPeriodDomainTypeName
(
new
Date
(
timestamp
),
domain
,
1
,
getName
(),
ReportEntity
.
READSET_FULL
);
DefaultXmlParser
parser
=
new
DefaultXmlParser
();
...
...
@@ -64,6 +58,13 @@ public class HistoricalHeartbeatService extends BaseHistoricalModelService<Heart
}
}
return
merger
.
getHeartbeatReport
();
return
merger
==
null
?
null
:
merger
.
getHeartbeatReport
();
}
private
HeartbeatReport
getReportFromLocalDisk
(
long
timestamp
,
String
domain
)
throws
Exception
{
Bucket
<
String
>
bucket
=
m_bucketManager
.
getReportBucket
(
timestamp
,
"heartbeat"
);
String
xml
=
bucket
.
findById
(
domain
);
return
xml
==
null
?
null
:
new
DefaultXmlParser
().
parse
(
xml
);
}
}
cat-home/src/main/java/com/dianping/cat/report/page/model/ip/HistoricalIpService.java
浏览文件 @
42f35a95
...
...
@@ -29,24 +29,18 @@ public class HistoricalIpService extends BaseHistoricalModelService<IpReport> {
protected
IpReport
buildModel
(
ModelRequest
request
)
throws
Exception
{
String
domain
=
request
.
getDomain
();
long
date
=
Long
.
parseLong
(
request
.
getProperty
(
"date"
));
IpReport
report
=
getLocalReport
(
date
,
domain
)
;
IpReport
report
;
// try remote report
if
(
report
==
null
&&
!
isLocalMode
())
{
report
=
getRemoteReport
(
date
,
domain
);
if
(
isLocalMode
())
{
report
=
getReportFromLocalDisk
(
date
,
domain
);
}
else
{
report
=
getReportFromDatabase
(
date
,
domain
);
}
return
report
;
}
private
IpReport
getLocalReport
(
long
timestamp
,
String
domain
)
throws
Exception
{
Bucket
<
String
>
bucket
=
m_bucketManager
.
getReportBucket
(
timestamp
,
"ip"
);
String
xml
=
bucket
.
findById
(
domain
);
return
xml
==
null
?
null
:
new
DefaultXmlParser
().
parse
(
xml
);
}
private
IpReport
getRemoteReport
(
long
timestamp
,
String
domain
)
throws
Exception
{
private
IpReport
getReportFromDatabase
(
long
timestamp
,
String
domain
)
throws
Exception
{
List
<
Report
>
reports
=
m_reportDao
.
findAllByPeriodDomainTypeName
(
new
Date
(
timestamp
),
domain
,
1
,
getName
(),
ReportEntity
.
READSET_FULL
);
DefaultXmlParser
parser
=
new
DefaultXmlParser
();
...
...
@@ -63,6 +57,13 @@ public class HistoricalIpService extends BaseHistoricalModelService<IpReport> {
}
}
return
merger
.
getIpReport
();
return
merger
==
null
?
null
:
merger
.
getIpReport
();
}
private
IpReport
getReportFromLocalDisk
(
long
timestamp
,
String
domain
)
throws
Exception
{
Bucket
<
String
>
bucket
=
m_bucketManager
.
getReportBucket
(
timestamp
,
"ip"
);
String
xml
=
bucket
.
findById
(
domain
);
return
xml
==
null
?
null
:
new
DefaultXmlParser
().
parse
(
xml
);
}
}
cat-home/src/main/java/com/dianping/cat/report/page/model/problem/HistoricalProblemService.java
浏览文件 @
42f35a95
...
...
@@ -30,24 +30,18 @@ public class HistoricalProblemService extends BaseHistoricalModelService<Problem
protected
ProblemReport
buildModel
(
ModelRequest
request
)
throws
Exception
{
String
domain
=
request
.
getDomain
();
long
date
=
Long
.
parseLong
(
request
.
getProperty
(
"date"
));
ProblemReport
report
=
getLocalReport
(
date
,
domain
)
;
ProblemReport
report
;
// try remote report
if
(
report
==
null
&&
!
isLocalMode
())
{
report
=
getRemoteReport
(
date
,
domain
);
if
(
isLocalMode
())
{
report
=
getReportFromLocalDisk
(
date
,
domain
);
}
else
{
report
=
getReportFromDatabase
(
date
,
domain
);
}
return
report
;
}
private
ProblemReport
getLocalReport
(
long
timestamp
,
String
domain
)
throws
Exception
{
Bucket
<
String
>
bucket
=
m_bucketManager
.
getReportBucket
(
timestamp
,
"problem"
);
String
xml
=
bucket
.
findById
(
domain
);
return
xml
==
null
?
null
:
new
DefaultXmlParser
().
parse
(
xml
);
}
private
ProblemReport
getRemoteReport
(
long
timestamp
,
String
domain
)
throws
Exception
{
private
ProblemReport
getReportFromDatabase
(
long
timestamp
,
String
domain
)
throws
Exception
{
List
<
Report
>
reports
=
m_reportDao
.
findAllByPeriodDomainTypeName
(
new
Date
(
timestamp
),
domain
,
1
,
getName
(),
ReportEntity
.
READSET_FULL
);
DefaultXmlParser
parser
=
new
DefaultXmlParser
();
...
...
@@ -64,6 +58,13 @@ public class HistoricalProblemService extends BaseHistoricalModelService<Problem
}
}
return
merger
.
getProblemReport
();
return
merger
==
null
?
null
:
merger
.
getProblemReport
();
}
private
ProblemReport
getReportFromLocalDisk
(
long
timestamp
,
String
domain
)
throws
Exception
{
Bucket
<
String
>
bucket
=
m_bucketManager
.
getReportBucket
(
timestamp
,
"problem"
);
String
xml
=
bucket
.
findById
(
domain
);
return
xml
==
null
?
null
:
new
DefaultXmlParser
().
parse
(
xml
);
}
}
cat-home/src/main/java/com/dianping/cat/report/page/model/transaction/HistoricalTransactionService.java
浏览文件 @
42f35a95
...
...
@@ -29,24 +29,18 @@ public class HistoricalTransactionService extends BaseHistoricalModelService<Tra
protected
TransactionReport
buildModel
(
ModelRequest
request
)
throws
Exception
{
String
domain
=
request
.
getDomain
();
long
date
=
Long
.
parseLong
(
request
.
getProperty
(
"date"
));
TransactionReport
report
=
getLocalReport
(
date
,
domain
)
;
TransactionReport
report
;
// try remote report
if
(
report
==
null
&&
!
isLocalMode
())
{
report
=
getRemoteReport
(
date
,
domain
);
if
(
isLocalMode
())
{
report
=
getReportFromLocalDisk
(
date
,
domain
);
}
else
{
report
=
getReportFromDatabase
(
date
,
domain
);
}
return
report
;
}
private
TransactionReport
getLocalReport
(
long
timestamp
,
String
domain
)
throws
Exception
{
Bucket
<
String
>
bucket
=
m_bucketManager
.
getReportBucket
(
timestamp
,
"transaction"
);
String
xml
=
bucket
.
findById
(
domain
);
return
xml
==
null
?
null
:
new
DefaultXmlParser
().
parse
(
xml
);
}
private
TransactionReport
getRemoteReport
(
long
timestamp
,
String
domain
)
throws
Exception
{
private
TransactionReport
getReportFromDatabase
(
long
timestamp
,
String
domain
)
throws
Exception
{
List
<
Report
>
reports
=
m_reportDao
.
findAllByPeriodDomainTypeName
(
new
Date
(
timestamp
),
domain
,
1
,
getName
(),
ReportEntity
.
READSET_FULL
);
DefaultXmlParser
parser
=
new
DefaultXmlParser
();
...
...
@@ -63,6 +57,13 @@ public class HistoricalTransactionService extends BaseHistoricalModelService<Tra
}
}
return
merger
.
getTransactionReport
();
return
merger
==
null
?
null
:
merger
.
getTransactionReport
();
}
private
TransactionReport
getReportFromLocalDisk
(
long
timestamp
,
String
domain
)
throws
Exception
{
Bucket
<
String
>
bucket
=
m_bucketManager
.
getReportBucket
(
timestamp
,
"transaction"
);
String
xml
=
bucket
.
findById
(
domain
);
return
xml
==
null
?
null
:
new
DefaultXmlParser
().
parse
(
xml
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录