Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
764e676c
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,发现更多精彩内容 >>
提交
764e676c
编写于
8月 28, 2013
作者:
Y
yong.you
浏览文件
操作
浏览文件
下载
差异文件
merge the code and fix confict
上级
20b86754
eeee830b
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
105 addition
and
105 deletion
+105
-105
biz
biz
+1
-0
cat-consumer/src/main/java/com/dianping/cat/consumer/state/StateAnalyzer.java
...n/java/com/dianping/cat/consumer/state/StateAnalyzer.java
+16
-9
cat-core/src/main/java/com/dianping/cat/statistic/ServerStatistic.java
...main/java/com/dianping/cat/statistic/ServerStatistic.java
+12
-11
cat-core/src/main/java/com/dianping/cat/statistic/ServerStatisticManager.java
...va/com/dianping/cat/statistic/ServerStatisticManager.java
+33
-49
cat-core/src/main/java/com/dianping/cat/storage/dump/LocalMessageBucketManager.java
.../dianping/cat/storage/dump/LocalMessageBucketManager.java
+1
-0
cat-home/src/main/java/com/dianping/cat/report/service/impl/UtilizationReportService.java
...ing/cat/report/service/impl/UtilizationReportService.java
+2
-2
cat-home/src/main/webapp/jsp/report/utilization/detail.jsp
cat-home/src/main/webapp/jsp/report/utilization/detail.jsp
+0
-8
cat-home/src/main/webapp/jsp/report/utilization/utilizationHistory.jsp
...main/webapp/jsp/report/utilization/utilizationHistory.jsp
+26
-24
cat-home/src/test/java/com/dianping/cat/report/task/utilization/UtilizationBuilderTest.java
...g/cat/report/task/utilization/UtilizationBuilderTest.java
+2
-2
script/Cat.sql
script/Cat.sql
+12
-0
未找到文件。
biz
@
dbcbe7e1
Subproject commit dbcbe7e175f7bec0b0d123cdd75f3281bf444794
cat-consumer/src/main/java/com/dianping/cat/consumer/state/StateAnalyzer.java
浏览文件 @
764e676c
...
...
@@ -3,6 +3,7 @@ package com.dianping.cat.consumer.state;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.concurrent.atomic.AtomicLong
;
import
org.codehaus.plexus.logging.LogEnabled
;
import
org.codehaus.plexus.logging.Logger
;
...
...
@@ -13,6 +14,7 @@ import com.dianping.cat.analysis.AbstractMessageAnalyzer;
import
com.dianping.cat.configuration.NetworkInterfaceManager
;
import
com.dianping.cat.consumer.state.model.entity.Detail
;
import
com.dianping.cat.consumer.state.model.entity.Machine
;
import
com.dianping.cat.consumer.state.model.entity.Message
;
import
com.dianping.cat.consumer.state.model.entity.ProcessDomain
;
import
com.dianping.cat.consumer.state.model.entity.StateReport
;
import
com.dianping.cat.core.dal.Hostinfo
;
...
...
@@ -43,18 +45,19 @@ public class StateAnalyzer extends AbstractMessageAnalyzer<StateReport> implemen
if
(
end
>
System
.
currentTimeMillis
())
{
end
=
System
.
currentTimeMillis
();
}
int
size
=
0
;
double
maxTps
=
0
;
for
(;
start
<
end
;
start
+=
minute
)
{
size
++;
Statistic
state
=
m_serverStateManager
.
findState
(
start
);
Message
temp
=
machine
.
findOrCreateMessage
(
start
);
com
.
dianping
.
cat
.
consumer
.
state
.
model
.
entity
.
Message
temp
=
machine
.
findOrCreateMessage
(
start
);
Map
<
String
,
Long
>
totals
=
state
.
getMessageTotals
();
Map
<
String
,
AtomicLong
>
totals
=
state
.
getMessageTotals
();
long
messageTotal
=
state
.
getMessageTotal
();
temp
.
setTotal
(
messageTotal
);
Map
<
String
,
Long
>
totalLosses
=
state
.
getMessageTotalLosses
();
Map
<
String
,
Atomic
Long
>
totalLosses
=
state
.
getMessageTotalLosses
();
long
messageTotalLoss
=
state
.
getMessageTotalLoss
();
temp
.
setTotalLoss
(
messageTotalLoss
);
...
...
@@ -66,9 +69,9 @@ public class StateAnalyzer extends AbstractMessageAnalyzer<StateReport> implemen
machine
.
setTotalLoss
(
messageTotalLoss
+
machine
.
getTotalLoss
());
machine
.
setSize
(
messageSize
+
machine
.
getSize
());
for
(
Entry
<
String
,
Long
>
entry
:
totals
.
entrySet
())
{
for
(
Entry
<
String
,
Atomic
Long
>
entry
:
totals
.
entrySet
())
{
String
key
=
entry
.
getKey
();
long
value
=
entry
.
getValue
();
long
value
=
entry
.
getValue
()
.
get
()
;
ProcessDomain
domain
=
machine
.
findOrCreateProcessDomain
(
key
);
Detail
detail
=
domain
.
findOrCreateDetail
(
start
);
if
(
totals
.
containsKey
(
key
))
{
...
...
@@ -76,8 +79,8 @@ public class StateAnalyzer extends AbstractMessageAnalyzer<StateReport> implemen
detail
.
setTotal
(
value
);
}
if
(
totalLosses
.
containsKey
(
key
))
{
domain
.
setTotalLoss
(
totalLosses
.
get
(
key
)
+
domain
.
getTotalLoss
());
detail
.
setTotalLoss
(
totalLosses
.
get
(
key
));
domain
.
setTotalLoss
(
totalLosses
.
get
(
key
)
.
get
()
+
domain
.
getTotalLoss
());
detail
.
setTotalLoss
(
totalLosses
.
get
(
key
)
.
get
()
);
}
if
(
sizes
.
containsKey
(
key
))
{
domain
.
setSize
(
sizes
.
get
(
key
)
+
domain
.
getSize
());
...
...
@@ -128,11 +131,14 @@ public class StateAnalyzer extends AbstractMessageAnalyzer<StateReport> implemen
double
sum
=
machine
.
getDelaySum
();
long
count
=
machine
.
getDelayCount
();
double
avg
=
0
;
if
(
count
>
0
)
{
avg
=
sum
/
count
;
machine
.
setDelayAvg
(
avg
);
}
temp
.
setTime
(
new
Date
(
start
));
size
++;
}
double
avgTps
=
0
;
...
...
@@ -174,6 +180,7 @@ public class StateAnalyzer extends AbstractMessageAnalyzer<StateReport> implemen
@Override
public
StateReport
getReport
(
String
domain
)
{
StateReport
report
=
new
StateReport
(
domain
);
report
=
new
StateReport
(
ReportConstants
.
CAT
);
report
.
setStartTime
(
new
Date
(
m_startTime
));
report
.
setEndTime
(
new
Date
(
m_startTime
+
MINUTE
*
60
-
1
));
...
...
@@ -213,7 +220,7 @@ public class StateAnalyzer extends AbstractMessageAnalyzer<StateReport> implemen
m_domainManager
.
insert
(
domain
,
ip
);
}
else
if
(!
ipInfo
.
getIp
().
equals
(
ip
))
{
String
localIp
=
NetworkInterfaceManager
.
INSTANCE
.
getLocalHostAddress
();
// only work on online enviroment
// only work on online enviro
n
ment
if
(
localIp
.
startsWith
(
"10."
))
{
long
current
=
System
.
currentTimeMillis
();
long
lastModifyTime
=
ipInfo
.
getLastModifiedDate
().
getTime
();
...
...
cat-core/src/main/java/com/dianping/cat/statistic/ServerStatistic.java
浏览文件 @
764e676c
...
...
@@ -3,9 +3,10 @@ package com.dianping.cat.statistic;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.concurrent.atomic.AtomicLong
;
public
class
ServerStatistic
{
private
Map
<
Long
,
Statistic
>
m_statistics
=
new
LinkedHashMap
<
Long
,
Statistic
>(
6
0
);
private
Map
<
Long
,
Statistic
>
m_statistics
=
new
LinkedHashMap
<
Long
,
Statistic
>(
10
0
);
public
Statistic
findOrCreate
(
Long
time
)
{
Statistic
state
=
m_statistics
.
get
(
time
);
...
...
@@ -33,9 +34,9 @@ public class ServerStatistic {
private
long
m_messageDumpLoss
;
private
Map
<
String
,
Long
>
m_messageTotals
=
new
HashMap
<
String
,
Long
>(
256
);
private
Map
<
String
,
AtomicLong
>
m_messageTotals
=
new
HashMap
<
String
,
Atomic
Long
>(
256
);
private
Map
<
String
,
Long
>
m_messageTotalLosses
=
new
HashMap
<
String
,
Long
>(
256
);
private
Map
<
String
,
AtomicLong
>
m_messageTotalLosses
=
new
HashMap
<
String
,
Atomic
Long
>(
256
);
private
Map
<
String
,
Double
>
m_messageSizes
=
new
HashMap
<
String
,
Double
>(
256
);
...
...
@@ -82,20 +83,20 @@ public class ServerStatistic {
}
public
void
addMessageTotal
(
String
domain
,
long
messageTotal
)
{
Long
value
=
m_messageTotals
.
get
(
domain
);
Atomic
Long
value
=
m_messageTotals
.
get
(
domain
);
if
(
value
!=
null
)
{
m_messageTotals
.
put
(
domain
,
value
+
messageTotal
);
value
.
set
(
value
.
get
()+
messageTotal
);
}
else
{
m_messageTotals
.
put
(
domain
,
messageTotal
);
m_messageTotals
.
put
(
domain
,
new
AtomicLong
(
messageTotal
)
);
}
}
public
void
addMessageTotalLoss
(
String
domain
,
long
messageTotalLoss
)
{
Long
value
=
m_messageTotalLosses
.
get
(
domain
);
Atomic
Long
value
=
m_messageTotalLosses
.
get
(
domain
);
if
(
value
!=
null
)
{
m_messageTotalLosses
.
put
(
domain
,
value
+
messageTotalLoss
);
value
.
set
(
value
.
get
()+
messageTotalLoss
);
}
else
{
m_messageTotalLosses
.
put
(
domain
,
messageTotalLoss
);
m_messageTotalLosses
.
put
(
domain
,
new
AtomicLong
(
messageTotalLoss
)
);
}
}
...
...
@@ -164,11 +165,11 @@ public class ServerStatistic {
return
m_messageSizes
;
}
public
Map
<
String
,
Long
>
getMessageTotals
()
{
public
Map
<
String
,
Atomic
Long
>
getMessageTotals
()
{
return
m_messageTotals
;
}
public
Map
<
String
,
Long
>
getMessageTotalLosses
()
{
public
Map
<
String
,
Atomic
Long
>
getMessageTotalLosses
()
{
return
m_messageTotalLosses
;
}
...
...
cat-core/src/main/java/com/dianping/cat/statistic/ServerStatisticManager.java
浏览文件 @
764e676c
...
...
@@ -6,99 +6,83 @@ public class ServerStatisticManager {
public
ServerStatistic
m_serverState
=
new
ServerStatistic
();
public
void
addBlockTotal
(
long
total
)
{
Long
time
=
getCurrentMinute
();
private
Statistic
m_currentStatistic
=
null
;
private
long
m_currentMunite
=
-
1
;
m_serverState
.
findOrCreate
(
time
).
addBlockTotal
(
total
);
public
void
addBlockTotal
(
long
total
)
{
getCurrentStatistic
().
addBlockTotal
(
total
);
}
public
void
addBlockLoss
(
long
total
)
{
Long
time
=
getCurrentMinute
();
m_serverState
.
findOrCreate
(
time
).
addBlockLoss
(
total
);
getCurrentStatistic
().
addBlockLoss
(
total
);
}
public
void
addBlockTime
(
long
total
)
{
Long
time
=
getCurrentMinute
();
m_serverState
.
findOrCreate
(
time
).
addBlockTime
(
total
);
getCurrentStatistic
().
addBlockTime
(
total
);
}
public
void
addPigeonTimeError
(
long
total
)
{
Long
time
=
getCurrentMinute
();
m_serverState
.
findOrCreate
(
time
).
addPigeonTimeError
(
total
);
getCurrentStatistic
().
addPigeonTimeError
(
total
);
}
public
void
addMessageDump
(
long
total
)
{
Long
time
=
getCurrentMinute
();
m_serverState
.
findOrCreate
(
time
).
addMessageDump
(
total
);
getCurrentStatistic
().
addMessageDump
(
total
);
}
public
void
addNetworkTimeError
(
long
total
)
{
Long
time
=
getCurrentMinute
();
m_serverState
.
findOrCreate
(
time
).
addNetworkTimeError
(
total
);
getCurrentStatistic
().
addNetworkTimeError
(
total
);
}
public
void
addMessageDumpLoss
(
long
total
)
{
Long
time
=
getCurrentMinute
();
m_serverState
.
findOrCreate
(
time
).
addMessageDumpLoss
(
total
);
getCurrentStatistic
().
addMessageDumpLoss
(
total
);
}
public
void
addMessageSize
(
String
domain
,
double
size
)
{
Long
time
=
getCurrentMinute
();
m_serverState
.
findOrCreate
(
time
).
addMessageSize
(
domain
,
size
);
addMessageSize
(
size
);
getCurrentStatistic
().
addMessageSize
(
domain
,
size
);
}
public
void
addMessageSize
(
double
size
)
{
Long
time
=
getCurrentMinute
();
m_serverState
.
findOrCreate
(
time
).
addMessageSize
(
size
);
public
void
addMessageSize
(
double
size
)
{
getCurrentStatistic
().
addMessageSize
(
size
);
}
public
void
addMessageTotal
(
String
domain
,
long
total
)
{
Long
time
=
getCurrentMinute
();
m_serverState
.
findOrCreate
(
time
).
addMessageTotal
(
domain
,
total
);
getCurrentStatistic
().
addMessageTotal
(
domain
,
total
);
}
public
void
addMessageTotal
(
long
total
)
{
Long
time
=
getCurrentMinute
();
m_serverState
.
findOrCreate
(
time
).
addMessageTotal
(
total
);
getCurrentStatistic
().
addMessageTotal
(
total
);
}
public
void
addMessageTotalLoss
(
String
domain
,
long
total
)
{
Long
time
=
getCurrentMinute
();
m_serverState
.
findOrCreate
(
time
).
addMessageTotalLoss
(
domain
,
total
);
addMessageTotalLoss
(
total
);
getCurrentStatistic
().
addMessageTotalLoss
(
domain
,
total
);
}
public
void
addMessageTotalLoss
(
long
total
)
{
Long
time
=
getCurrentMinute
();
m_serverState
.
findOrCreate
(
time
).
addMessageTotalLoss
(
total
);
getCurrentStatistic
().
addMessageTotalLoss
(
total
);
}
public
void
addProcessDelay
(
double
delay
)
{
Long
time
=
getCurrentMinute
();
m_serverState
.
findOrCreate
(
time
).
addProcessDelay
(
delay
);
getCurrentStatistic
().
addProcessDelay
(
delay
);
}
public
Statistic
findState
(
long
time
)
{
return
m_serverState
.
findOrCreate
(
time
);
}
p
ublic
Long
getCurrentMinute
()
{
p
rivate
Statistic
getCurrentStatistic
()
{
long
time
=
System
.
currentTimeMillis
();
return
time
-
time
%
(
60
*
1000
);
time
=
time
-
time
%
(
60
*
1000
);
synchronized
(
this
){
if
(
time
!=
m_currentMunite
)
{
m_currentMunite
=
time
;
m_currentStatistic
=
m_serverState
.
findOrCreate
(
time
);
}
}
return
m_currentStatistic
;
}
public
void
removeState
(
long
time
)
{
...
...
cat-core/src/main/java/com/dianping/cat/storage/dump/LocalMessageBucketManager.java
浏览文件 @
764e676c
...
...
@@ -376,6 +376,7 @@ public class LocalMessageBucketManager extends ContainerHolder implements Messag
double
amount
=
totalSize
-
lastTotalSize
;
m_lastTotalSizes
.
put
(
domain
,
totalSize
);
m_serverStateManager
.
addMessageSize
(
domain
,
amount
);
m_serverStateManager
.
addMessageSize
(
amount
);
}
}
...
...
cat-home/src/main/java/com/dianping/cat/report/service/impl/UtilizationReportService.java
浏览文件 @
764e676c
...
...
@@ -23,6 +23,7 @@ import com.dianping.cat.home.utilization.entity.UtilizationReport;
import
com.dianping.cat.message.Event
;
import
com.dianping.cat.report.service.AbstractReportService
;
import
com.dianping.cat.report.task.utilization.UtilizationReportMerger
;
import
com.dianping.cat.service.ReportConstants
;
public
class
UtilizationReportService
extends
AbstractReportService
<
UtilizationReport
>
{
...
...
@@ -49,14 +50,13 @@ public class UtilizationReportService extends AbstractReportService<UtilizationR
UtilizationReportMerger
merger
=
new
UtilizationReportMerger
(
new
UtilizationReport
(
domain
));
long
startTime
=
start
.
getTime
();
long
endTime
=
end
.
getTime
();
String
name
=
"utilization"
;
String
name
=
ReportConstants
.
REPORT_UTILIZATION
;
for
(;
startTime
<
endTime
;
startTime
=
startTime
+
TimeUtil
.
ONE_DAY
)
{
try
{
DailyReport
report
=
m_dailyReportDao
.
findByDomainNamePeriod
(
domain
,
name
,
new
Date
(
startTime
),
DailyReportEntity
.
READSET_FULL
);
String
xml
=
report
.
getContent
();
UtilizationReport
reportModel
=
com
.
dianping
.
cat
.
home
.
utilization
.
transform
.
DefaultSaxParser
.
parse
(
xml
);
reportModel
.
accept
(
merger
);
}
catch
(
Exception
e
)
{
...
...
cat-home/src/main/webapp/jsp/report/utilization/detail.jsp
浏览文件 @
764e676c
...
...
@@ -18,8 +18,6 @@
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=utilization&tab=tab1"
>
Machine Number
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=utilization&sort=urlCount&tab=tab1"
>
URL Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=utilization&sort=urlResponse&tab=tab1"
>
URL Response Time
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=utilization&sort=serviceCount&tab=tab1"
>
Service Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=utilization&sort=serviceResponse&tab=tab1"
>
Service Response Time
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=utilization&sort=sqlCount&tab=tab1"
>
SQL Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=utilization&sort=pigeonCallCount&tab=tab1"
>
Pigeon Call Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=utilization&sort=swallowCallCount&tab=tab1"
>
Swallow Call Count
</th>
...
...
@@ -33,8 +31,6 @@
<td
style=
"text-align:right"
>
${item.machineNumber}
</td>
<td
style=
"text-align:right"
>
${w:format(item.urlCount,'#,###,###,###,##0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.urlResponseTime,'0.0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.serviceCount,'#,###,###,###,##0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.serviceResponseTime,'0.0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.sqlCount,'#,###,###,###,##0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.pigeonCallCount,'#,###,###,###,##0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.swallowCallCount,'#,###,###,###,##0')}
</td>
...
...
@@ -51,8 +47,6 @@
<tr>
<th
class=
"left"
>
id
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=utilization&tab=tab2"
>
Machine Number
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=utilization&sort=urlCount&tab=tab2"
>
URL Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=utilization&sort=urlResponse&tab=tab2"
>
URL Response Time
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=utilization&sort=serviceCount&tab=tab2"
>
Service Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=utilization&sort=serviceResponse&tab=tab2"
>
Service Response Time
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=utilization&sort=sqlCount&tab=tab2"
>
SQL Count
</th>
...
...
@@ -66,8 +60,6 @@
<tr
class=
"${status.index mod 2 != 0 ? 'odd' : 'even'}"
>
<td>
${item.id}
</td>
<td
style=
"text-align:right"
>
${item.machineNumber}
</td>
<td
style=
"text-align:right"
>
${w:format(item.urlCount,'#,###,###,###,##0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.urlResponseTime,'0.0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.serviceCount,'#,###,###,###,##0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.serviceResponseTime,'0.0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.sqlCount,'#,###,###,###,##0')}
</td>
...
...
cat-home/src/main/webapp/jsp/report/utilization/utilizationHistory.jsp
浏览文件 @
764e676c
...
...
@@ -56,16 +56,14 @@
<table
class=
"table table-striped table-bordered table-condensed"
>
<tr>
<th
class=
"left"
>
id
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&tab=tab1"
>
Machine Number
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&sort=urlCount&tab=tab1"
>
URL Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&sort=urlResponse&tab=tab1"
>
URL Response Time
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&sort=serviceCount&tab=tab1"
>
Service Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&sort=serviceResponse&tab=tab1"
>
Service Response Time
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&sort=sqlCount&tab=tab1"
>
SQL Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&sort=pigeonCallCount&tab=tab1"
>
Pigeon Call Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&sort=swallowCallCount&tab=tab1"
>
Swallow Call Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&sort=memcacheCount&tab=tab1"
>
Memcache Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&sort=webScore&tab=tab1"
>
Web Score
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyUtilization&tab=tab1"
>
Machine Number
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyUtilization&sort=urlCount&tab=tab1"
>
URL Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyUtilization&sort=urlResponse&tab=tab1"
>
URL Response Time
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyUtilization&sort=sqlCount&tab=tab1"
>
SQL Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyUtilization&sort=pigeonCallCount&tab=tab1"
>
Pigeon Call Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyUtilization&sort=swallowCallCount&tab=tab1"
>
Swallow Call Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyUtilization&sort=memcacheCount&tab=tab1"
>
Memcache Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyUtilization&sort=webScore&tab=tab1"
>
Web Score
</th>
</tr>
<c:forEach
var=
"item"
items=
"
${
model
.
utilizationWebList
}
"
varStatus=
"status"
>
...
...
@@ -74,8 +72,6 @@
<td
style=
"text-align:right"
>
${item.machineNumber}
</td>
<td
style=
"text-align:right"
>
${w:format(item.urlCount,'#,###,###,###,##0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.urlResponseTime,'0.0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.serviceCount,'#,###,###,###,##0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.serviceResponseTime,'0.0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.sqlCount,'#,###,###,###,##0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.pigeonCallCount,'#,###,###,###,##0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.swallowCallCount,'#,###,###,###,##0')}
</td>
...
...
@@ -91,24 +87,20 @@
<table
class=
"table table-striped table-bordered table-condensed"
>
<tr>
<th
class=
"left"
>
id
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&tab=tab2"
>
Machine Number
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&sort=urlCount&tab=tab2"
>
URL Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&sort=urlResponse&tab=tab2"
>
URL Response Time
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&sort=serviceCount&tab=tab2"
>
Service Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&sort=serviceResponse&tab=tab2"
>
Service Response Time
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&sort=sqlCount&tab=tab2"
>
SQL Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&sort=pigeonCallCount&tab=tab2"
>
Pigeon Call Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&sort=swallowCallCount&tab=tab2"
>
Swallow Call Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&sort=memcacheCount&tab=tab2"
>
Memcache Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyHtilization&sort=serviceScore&tab=tab2"
>
Service Score
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyUtilization&tab=tab2"
>
Machine Number
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyUtilization&sort=serviceCount&tab=tab2"
>
Service Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyUtilization&sort=serviceResponse&tab=tab2"
>
Service Response Time
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyUtilization&sort=sqlCount&tab=tab2"
>
SQL Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyUtilization&sort=pigeonCallCount&tab=tab2"
>
Pigeon Call Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyUtilization&sort=swallowCallCount&tab=tab2"
>
Swallow Call Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyUtilization&sort=memcacheCount&tab=tab2"
>
Memcache Count
</th>
<th
style=
"text-align:right"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&op=historyUtilization&sort=serviceScore&tab=tab2"
>
Service Score
</th>
</tr>
<c:forEach
var=
"item"
items=
"
${
model
.
utilizationServiceList
}
"
varStatus=
"status"
>
<tr
class=
"${status.index mod 2 != 0 ? 'odd' : 'even'}"
>
<td>
${item.id}
</td>
<td
style=
"text-align:right"
>
${item.machineNumber}
</td>
<td
style=
"text-align:right"
>
${w:format(item.urlCount,'#,###,###,###,##0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.urlResponseTime,'0.0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.serviceCount,'#,###,###,###,##0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.serviceResponseTime,'0.0')}
</td>
<td
style=
"text-align:right"
>
${w:format(item.sqlCount,'#,###,###,###,##0')}
</td>
...
...
@@ -133,3 +125,13 @@
</table>
</div>
</a:body>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
var
tab
=
'
${payload.tab}
'
;
if
(
tab
==
'
tab2
'
){
$
(
'
#tab2Href
'
).
trigger
(
'
click
'
);
}
else
{
$
(
'
#tab1Href
'
).
trigger
(
'
click
'
);
}
});
</script>
cat-home/src/test/java/com/dianping/cat/report/task/utilization/UtilizationBuilderTest.java
浏览文件 @
764e676c
...
...
@@ -18,7 +18,7 @@ public class UtilizationBuilderTest extends ComponentTestCase{
DomainManager
manager
=
lookup
(
DomainManager
.
class
);
manager
.
initialize
();
builder
.
buildHourlyTask
(
"utilization"
,
CatString
.
CAT
,
new
SimpleDateFormat
(
"yyyyMMddHH"
).
parse
(
"2013082
505
"
));
builder
.
buildHourlyTask
(
"utilization"
,
CatString
.
CAT
,
new
SimpleDateFormat
(
"yyyyMMddHH"
).
parse
(
"2013082
617
"
));
}
@Test
...
...
@@ -27,7 +27,7 @@ public class UtilizationBuilderTest extends ComponentTestCase{
DomainManager
manager
=
lookup
(
DomainManager
.
class
);
manager
.
initialize
();
builder
.
buildDailyTask
(
"utilization"
,
CatString
.
CAT
,
new
SimpleDateFormat
(
"yyyyMMdd"
).
parse
(
"2013082
5
"
));
builder
.
buildDailyTask
(
"utilization"
,
CatString
.
CAT
,
new
SimpleDateFormat
(
"yyyyMMdd"
).
parse
(
"2013082
6
"
));
}
@Test
...
...
script/Cat.sql
浏览文件 @
764e676c
...
...
@@ -349,6 +349,18 @@ CREATE TABLE `topologyGraph` (
KEY
`period`
(
`period`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
21912
DEFAULT
CHARSET
=
utf8
COMMENT
=
'用于存储历史的拓扑图曲线'
;
CREATE
TABLE
`baseline`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`report_name`
varchar
(
100
)
DEFAULT
NULL
,
`index_key`
varchar
(
100
)
DEFAULT
NULL
,
`report_period`
datetime
DEFAULT
NULL
,
`data`
blob
,
`creation_date`
datetime
DEFAULT
NULL
,
PRIMARY
KEY
(
`id`
),
KEY
`ix_indexkey_reportperiod`
(
`index_key`
,
`report_period`
),
KEY
`ix_reportperiod`
(
`report_period`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
5062
DEFAULT
CHARSET
=
utf8
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录