Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
94bacad2
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,发现更多精彩内容 >>
提交
94bacad2
编写于
11月 27, 2014
作者:
J
jialinsun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
web monitor refactor
上级
14136f4f
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
746 addition
and
351 deletion
+746
-351
cat-broker/src/test/java/com/dianping/cat/broker/SingleTest.java
...ker/src/test/java/com/dianping/cat/broker/SingleTest.java
+29
-32
cat-home/src/main/java/com/dianping/cat/helper/TimeHelper.java
...ome/src/main/java/com/dianping/cat/helper/TimeHelper.java
+15
-0
cat-home/src/main/java/com/dianping/cat/report/page/web/Handler.java
...c/main/java/com/dianping/cat/report/page/web/Handler.java
+156
-63
cat-home/src/main/java/com/dianping/cat/report/page/web/Model.java
...src/main/java/com/dianping/cat/report/page/web/Model.java
+20
-0
cat-home/src/main/java/com/dianping/cat/report/page/web/Payload.java
...c/main/java/com/dianping/cat/report/page/web/Payload.java
+53
-12
cat-home/src/main/java/com/dianping/cat/report/page/web/graph/WebGraphCreator.java
...m/dianping/cat/report/page/web/graph/WebGraphCreator.java
+152
-89
cat-home/src/main/webapp/js/baseGraph.js
cat-home/src/main/webapp/js/baseGraph.js
+3
-3
cat-home/src/main/webapp/jsp/report/app/linechart.jsp
cat-home/src/main/webapp/jsp/report/app/linechart.jsp
+1
-1
cat-home/src/main/webapp/jsp/report/app/speed.jsp
cat-home/src/main/webapp/jsp/report/app/speed.jsp
+1
-1
cat-home/src/main/webapp/jsp/report/web/web.jsp
cat-home/src/main/webapp/jsp/report/web/web.jsp
+191
-148
cat-home/src/main/webapp/jsp/report/web/webDetail.jsp
cat-home/src/main/webapp/jsp/report/web/webDetail.jsp
+123
-0
script/Cat.sql
script/Cat.sql
+2
-2
未找到文件。
cat-broker/src/test/java/com/dianping/cat/broker/SingleTest.java
浏览文件 @
94bacad2
...
@@ -12,18 +12,25 @@ public class SingleTest {
...
@@ -12,18 +12,25 @@ public class SingleTest {
public
void
test
()
throws
Exception
{
public
void
test
()
throws
Exception
{
while
(
true
)
{
while
(
true
)
{
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
URL
url
=
new
URL
(
buildUrl
(
i
));
try
{
URLConnection
URLconnection
=
url
.
openConnection
();
URL
url
=
new
URL
(
buildUrl
(
i
));
URLconnection
.
setRequestProperty
(
"User-Agent"
,
URLConnection
URLconnection
=
url
.
openConnection
();
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon;)"
);
URLconnection
.
setConnectTimeout
(
500
);
HttpURLConnection
httpConnection
=
(
HttpURLConnection
)
URLconnection
;
URLconnection
.
setReadTimeout
(
500
);
int
responseCode
=
httpConnection
.
getResponseCode
();
URLconnection
.
setRequestProperty
(
"User-Agent"
,
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon;)"
);
if
(
responseCode
==
HttpURLConnection
.
HTTP_OK
)
{
System
.
out
.
println
(
"ok"
);
HttpURLConnection
httpConnection
=
(
HttpURLConnection
)
URLconnection
;
}
else
{
int
responseCode
=
httpConnection
.
getResponseCode
();
System
.
out
.
println
(
responseCode
);
if
(
responseCode
==
HttpURLConnection
.
HTTP_OK
)
{
System
.
out
.
println
(
"ok"
);
}
else
{
System
.
out
.
println
(
responseCode
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
}
Thread
.
sleep
(
1000
);
Thread
.
sleep
(
1000
);
...
@@ -33,28 +40,18 @@ public class SingleTest {
...
@@ -33,28 +40,18 @@ public class SingleTest {
private
String
buildUrl
(
int
i
)
{
private
String
buildUrl
(
int
i
)
{
StringBuilder
sb
=
new
StringBuilder
(
128
);
StringBuilder
sb
=
new
StringBuilder
(
128
);
sb
.
append
(
"http://localhost:2765/broker-service/api/single?v=1&ts=123456&tu=http://j1.s1.dpfile.com/lib/1.0/cdn-perf/res/cdn_small.png/dnsLookup&d=1000&hs=200&ec=100"
);
int
hs
=
200
;
int
ec
=
100
;
if
(
i
%
2
==
1
)
{
hs
=
300
;
ec
=
200
;
}
sb
.
append
(
"http://localhost:2765/broker-service/api/single?v=1&ts=123456&tu=http://j1.s1.dpfile.com/lib/1.0/cdn-perf/res/cdn_small.png/dnsLookup&d=1000&hs="
)
.
append
(
hs
).
append
(
"&ec="
).
append
(
ec
);
return
sb
.
toString
();
return
sb
.
toString
();
}
}
// @Test
// public void test2() throws Exception{
// for (int i = 0; i < 1000; i++) {
// URL url = new URL("http://localhost:2281/cat/r/jsError?error=Script%20error.&file=&line=0×tamp=1371196520045");
// URLConnection URLconnection = url.openConnection();
// URLconnection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon;)");
// URLconnection.setRequestProperty("referer", "http://www.dianping.com/shop/2340226");
//
// HttpURLConnection httpConnection = (HttpURLConnection) URLconnection;
// int responseCode = httpConnection.getResponseCode();
//
// if (responseCode == HttpURLConnection.HTTP_OK) {
// } else {
// }
// Thread.sleep(100);
// }
// }
}
}
cat-home/src/main/java/com/dianping/cat/helper/TimeHelper.java
浏览文件 @
94bacad2
...
@@ -45,6 +45,21 @@ public class TimeHelper {
...
@@ -45,6 +45,21 @@ public class TimeHelper {
return
cal
.
getTime
();
return
cal
.
getTime
();
}
}
public
static
Date
getCurrentDay
(
long
timestamp
)
{
return
getCurrentDay
(
timestamp
,
0
);
}
public
static
Date
getCurrentDay
(
long
timestamp
,
int
index
)
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTimeInMillis
(
timestamp
);
cal
.
set
(
Calendar
.
HOUR_OF_DAY
,
0
);
cal
.
set
(
Calendar
.
MINUTE
,
0
);
cal
.
set
(
Calendar
.
SECOND
,
0
);
cal
.
set
(
Calendar
.
MILLISECOND
,
0
);
cal
.
add
(
Calendar
.
DAY_OF_MONTH
,
index
);
return
cal
.
getTime
();
}
public
static
Date
getCurrentHour
()
{
public
static
Date
getCurrentHour
()
{
Calendar
cal
=
Calendar
.
getInstance
();
Calendar
cal
=
Calendar
.
getInstance
();
...
...
cat-home/src/main/java/com/dianping/cat/report/page/web/Handler.java
浏览文件 @
94bacad2
...
@@ -6,8 +6,10 @@ import java.util.Collection;
...
@@ -6,8 +6,10 @@ import java.util.Collection;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
javax.servlet.ServletException
;
import
javax.servlet.ServletException
;
...
@@ -22,15 +24,16 @@ import com.dianping.cat.Constants;
...
@@ -22,15 +24,16 @@ import com.dianping.cat.Constants;
import
com.dianping.cat.Monitor
;
import
com.dianping.cat.Monitor
;
import
com.dianping.cat.config.url.UrlPatternConfigManager
;
import
com.dianping.cat.config.url.UrlPatternConfigManager
;
import
com.dianping.cat.configuration.url.pattern.entity.PatternItem
;
import
com.dianping.cat.configuration.url.pattern.entity.PatternItem
;
import
com.dianping.cat.helper.TimeHelper
;
import
com.dianping.cat.report.ReportPage
;
import
com.dianping.cat.report.ReportPage
;
import
com.dianping.cat.report.page.JsonBuilder
;
import
com.dianping.cat.report.page.JsonBuilder
;
import
com.dianping.cat.report.page.LineChart
;
import
com.dianping.cat.report.page.LineChart
;
import
com.dianping.cat.report.page.PayloadNormalizer
;
import
com.dianping.cat.report.page.PayloadNormalizer
;
import
com.dianping.cat.report.page.PieChart
;
import
com.dianping.cat.report.page.PieChart
;
import
com.dianping.cat.report.page.web.graph.WebGraphCreator
;
import
com.dianping.cat.report.page.web.graph.WebGraphCreator
;
import
com.site.helper.Splitters
;
public
class
Handler
implements
PageHandler
<
Context
>
{
public
class
Handler
implements
PageHandler
<
Context
>
{
@Inject
@Inject
private
JspViewer
m_jspViewer
;
private
JspViewer
m_jspViewer
;
...
@@ -46,6 +49,74 @@ public class Handler implements PageHandler<Context> {
...
@@ -46,6 +49,74 @@ public class Handler implements PageHandler<Context> {
@Inject
@Inject
private
WebGraphCreator
m_graphCreator
;
private
WebGraphCreator
m_graphCreator
;
private
Pair
<
Map
<
String
,
LineChart
>,
List
<
PieChart
>>
buildDisplayInfo
(
QueryEntity
query
,
String
title
)
{
Pair
<
Map
<
String
,
LineChart
>,
List
<
PieChart
>>
charts
=
m_graphCreator
.
queryBaseInfo
(
query
,
title
);
Map
<
String
,
LineChart
>
lineCharts
=
charts
.
getKey
();
List
<
PieChart
>
pieCharts
=
charts
.
getValue
();
return
new
Pair
<
Map
<
String
,
LineChart
>,
List
<
PieChart
>>(
lineCharts
,
pieCharts
);
}
private
void
buildInfoCharts
(
Model
model
,
QueryEntity
currentQuery
,
QueryEntity
compareQuery
)
{
Map
<
String
,
LineChart
>
lineCharts
=
new
LinkedHashMap
<
String
,
LineChart
>();
List
<
PieChart
>
pieCharts
=
new
LinkedList
<
PieChart
>();
Pair
<
Map
<
String
,
LineChart
>,
List
<
PieChart
>>
currentPair
=
buildDisplayInfo
(
currentQuery
,
"当前值"
);
lineCharts
.
putAll
(
currentPair
.
getKey
());
pieCharts
.
addAll
(
currentPair
.
getValue
());
if
(
compareQuery
!=
null
)
{
Pair
<
Map
<
String
,
LineChart
>,
List
<
PieChart
>>
comparePair
=
buildDisplayInfo
(
compareQuery
,
"对比值"
);
for
(
Entry
<
String
,
LineChart
>
entry
:
comparePair
.
getKey
().
entrySet
())
{
LineChart
linechart
=
entry
.
getValue
();
LineChart
l
=
lineCharts
.
get
(
entry
.
getKey
());
if
(
l
!=
null
)
{
l
.
add
(
linechart
.
getSubTitles
().
get
(
0
),
linechart
.
getValueObjects
().
get
(
0
));
}
}
pieCharts
.
addAll
(
comparePair
.
getValue
());
model
.
setCompareStart
(
compareQuery
.
getStart
());
model
.
setCompareEnd
(
compareQuery
.
getEnd
());
}
for
(
Entry
<
String
,
LineChart
>
entry
:
lineCharts
.
entrySet
())
{
if
(
WebGraphCreator
.
SUCESS_PERCENT
.
equals
(
entry
.
getKey
()))
{
LineChart
linechart
=
entry
.
getValue
();
linechart
.
setMinYlable
(
m_graphCreator
.
queryMinYlable
(
linechart
.
getValueObjects
()));
linechart
.
setMaxYlabel
(
100.0
);
}
}
model
.
setLineCharts
(
lineCharts
);
model
.
setPieCharts
(
pieCharts
);
}
private
Pair
<
QueryEntity
,
QueryEntity
>
buildQueryEntities
(
Payload
payload
)
{
Pair
<
Date
,
Date
>
startPair
=
payload
.
getHistoryStartDatePair
();
Pair
<
Date
,
Date
>
endPair
=
payload
.
getHistoryEndDatePair
();
List
<
String
>
urls
=
Splitters
.
by
(
";"
).
split
(
payload
.
getUrl
());
List
<
String
>
channels
=
Splitters
.
by
(
";"
).
split
(
payload
.
getChannel
());
List
<
String
>
cities
=
Splitters
.
by
(
";"
).
split
(
payload
.
getCity
());
String
type
=
payload
.
getType
();
QueryEntity
current
=
buildQueryEntity
(
startPair
.
getKey
(),
endPair
.
getKey
(),
urls
.
get
(
0
),
type
,
channels
.
get
(
0
),
cities
.
get
(
0
));
QueryEntity
compare
=
null
;
if
(
startPair
.
getValue
()
!=
null
&&
endPair
.
getValue
()
!=
null
&&
urls
.
size
()
==
2
)
{
compare
=
buildQueryEntity
(
startPair
.
getValue
(),
endPair
.
getValue
(),
urls
.
get
(
1
),
Monitor
.
TYPE_INFO
,
channels
.
get
(
1
),
cities
.
get
(
1
));
}
return
new
Pair
<
QueryEntity
,
QueryEntity
>(
current
,
compare
);
}
private
QueryEntity
buildQueryEntity
(
Date
start
,
Date
end
,
String
url
,
String
type
,
String
channel
,
String
city
)
{
QueryEntity
queryEntity
=
new
QueryEntity
(
start
,
end
,
url
);
queryEntity
.
addPar
(
"metricType"
,
Constants
.
METRIC_USER_MONITOR
).
addPar
(
"type"
,
type
).
addPar
(
"channel"
,
channel
)
.
addPar
(
"city"
,
city
);
return
queryEntity
;
}
@Override
@Override
@PayloadMeta
(
Payload
.
class
)
@PayloadMeta
(
Payload
.
class
)
@InboundActionMeta
(
name
=
"web"
)
@InboundActionMeta
(
name
=
"web"
)
...
@@ -60,81 +131,42 @@ public class Handler implements PageHandler<Context> {
...
@@ -60,81 +131,42 @@ public class Handler implements PageHandler<Context> {
Payload
payload
=
ctx
.
getPayload
();
Payload
payload
=
ctx
.
getPayload
();
normalize
(
model
,
payload
);
normalize
(
model
,
payload
);
Collection
<
PatternItem
>
rules
=
m_patternManager
.
queryUrlPatternRules
();
Pair
<
QueryEntity
,
QueryEntity
>
queryEntities
=
buildQueryEntities
(
payload
);
QueryEntity
currentQuery
=
queryEntities
.
getKey
();
long
start
=
payload
.
getHistoryStartDate
().
getTime
();
QueryEntity
compareQuery
=
queryEntities
.
getValue
();
long
end
=
payload
.
getHistoryEndDate
().
getTime
();
start
=
start
-
start
%
TimeHelper
.
ONE_HOUR
;
end
=
end
-
end
%
TimeHelper
.
ONE_HOUR
;
Date
startDate
=
new
Date
(
start
);
Date
endDate
=
new
Date
(
end
);
String
type
=
payload
.
getType
();
String
channel
=
payload
.
getChannel
();
String
city
=
payload
.
getCity
();
Map
<
String
,
String
>
pars
=
new
LinkedHashMap
<
String
,
String
>();
String
url
=
payload
.
getUrl
();
if
(
url
==
null
&&
rules
.
size
()
>
0
)
{
PatternItem
patternItem
=
new
ArrayList
<
PatternItem
>(
rules
).
get
(
0
);
url
=
patternItem
.
getName
();
payload
.
setGroup
(
patternItem
.
getGroup
());
payload
.
setUrl
(
url
);
}
pars
.
put
(
"metricType"
,
Constants
.
METRIC_USER_MONITOR
);
pars
.
put
(
"type"
,
type
);
pars
.
put
(
"channel"
,
channel
);
pars
.
put
(
"city"
,
city
);
Action
action
=
payload
.
getAction
();
Action
action
=
payload
.
getAction
();
switch
(
action
)
{
switch
(
action
)
{
case
VIEW:
case
VIEW:
if
(
url
!=
null
)
{
if
(
Monitor
.
TYPE_INFO
.
equals
(
payload
.
getType
()))
{
if
(
Monitor
.
TYPE_INFO
.
equals
(
type
))
{
buildInfoCharts
(
model
,
currentQuery
,
compareQuery
);
Pair
<
Map
<
String
,
LineChart
>,
List
<
PieChart
>>
charts
=
m_graphCreator
.
queryBaseInfo
(
startDate
,
endDate
,
}
else
{
url
,
pars
);
Pair
<
LineChart
,
PieChart
>
pair
=
m_graphCreator
.
queryErrorInfo
(
currentQuery
);
Map
<
String
,
LineChart
>
lineCharts
=
charts
.
getKey
();
List
<
PieChart
>
pieCharts
=
charts
.
getValue
();
model
.
setLineChart
(
pair
.
getKey
());
model
.
setPieChart
(
pair
.
getValue
());
model
.
setLineCharts
(
lineCharts
);
model
.
setPieCharts
(
pieCharts
);
}
else
{
Pair
<
LineChart
,
PieChart
>
pair
=
m_graphCreator
.
queryErrorInfo
(
startDate
,
endDate
,
url
,
pars
);
model
.
setLineChart
(
pair
.
getKey
());
model
.
setPieChart
(
pair
.
getValue
());
}
}
}
model
.
setStart
(
startDate
);
model
.
setStart
(
currentQuery
.
getStart
()
);
model
.
setEnd
(
endDate
);
model
.
setEnd
(
currentQuery
.
getEnd
()
);
model
.
setPattermItems
(
rules
);
model
.
setPattermItems
(
m_patternManager
.
queryUrlPatternRules
()
);
model
.
setAction
(
Action
.
VIEW
);
model
.
setAction
(
Action
.
VIEW
);
model
.
setPage
(
ReportPage
.
WEB
);
model
.
setCityInfo
(
m_cityManager
.
getCityInfo
());
model
.
setCityInfo
(
m_cityManager
.
getCityInfo
());
break
;
break
;
case
JSON:
case
JSON:
if
(
url
!=
null
)
{
Map
<
String
,
Object
>
jsonObjs
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
jsonObjs
=
new
HashMap
<
String
,
Object
>();
if
(
Monitor
.
TYPE_INFO
.
equals
(
type
))
{
if
(
Monitor
.
TYPE_INFO
.
equals
(
payload
.
getType
()))
{
Pair
<
Map
<
String
,
LineChart
>,
List
<
PieChart
>>
charts
=
m_graphCreator
.
queryBaseInfo
(
startDate
,
endDate
,
Pair
<
Map
<
String
,
LineChart
>,
List
<
PieChart
>>
currentPair
=
buildDisplayInfo
(
currentQuery
,
"当前值"
);
url
,
pars
);
jsonObjs
.
put
(
"lineCharts"
,
charts
.
getKey
());
jsonObjs
.
put
(
"lineCharts"
,
currentPair
.
getKey
());
jsonObjs
.
put
(
"pieCharts"
,
charts
.
getValue
());
jsonObjs
.
put
(
"pieCharts"
,
currentPair
.
getValue
());
}
else
{
}
else
{
Pair
<
LineChart
,
PieChart
>
pair
=
m_graphCreator
.
queryErrorInfo
(
startDate
,
endDate
,
url
,
pars
);
Pair
<
LineChart
,
PieChart
>
pair
=
m_graphCreator
.
queryErrorInfo
(
currentQuery
);
jsonObjs
.
put
(
"lineChart"
,
pair
.
getKey
());
jsonObjs
.
put
(
"lineChart"
,
pair
.
getKey
());
jsonObjs
.
put
(
"pieChart"
,
pair
.
getValue
());
jsonObjs
.
put
(
"pieChart"
,
pair
.
getValue
());
}
model
.
setJson
(
new
JsonBuilder
().
toJson
(
jsonObjs
));
}
}
model
.
setJson
(
new
JsonBuilder
().
toJson
(
jsonObjs
));
break
;
break
;
}
}
...
@@ -145,7 +177,68 @@ public class Handler implements PageHandler<Context> {
...
@@ -145,7 +177,68 @@ public class Handler implements PageHandler<Context> {
private
void
normalize
(
Model
model
,
Payload
payload
)
{
private
void
normalize
(
Model
model
,
Payload
payload
)
{
model
.
setPage
(
ReportPage
.
WEB
);
model
.
setPage
(
ReportPage
.
WEB
);
Collection
<
PatternItem
>
rules
=
m_patternManager
.
queryUrlPatternRules
();
String
url
=
payload
.
getUrl
();
if
(
url
==
null
&&
rules
.
size
()
>
0
)
{
PatternItem
patternItem
=
new
ArrayList
<
PatternItem
>(
rules
).
get
(
0
);
url
=
patternItem
.
getName
();
payload
.
setGroup
(
patternItem
.
getGroup
());
payload
.
setUrl
(
url
);
}
m_normalizePayload
.
normalize
(
model
,
payload
);
m_normalizePayload
.
normalize
(
model
,
payload
);
}
}
public
class
QueryEntity
{
private
String
m_url
;
private
Date
m_start
;
private
Date
m_end
;
private
Map
<
String
,
String
>
m_pars
=
new
HashMap
<
String
,
String
>();
public
QueryEntity
(
Date
start
,
Date
end
,
String
url
)
{
m_start
=
start
;
m_end
=
end
;
m_url
=
url
;
}
public
QueryEntity
addPar
(
String
par
,
String
value
)
{
m_pars
.
put
(
par
,
value
);
return
this
;
}
public
Date
getEnd
()
{
return
m_end
;
}
public
Map
<
String
,
String
>
getPars
()
{
return
m_pars
;
}
public
Date
getStart
()
{
return
m_start
;
}
public
String
getType
()
{
return
m_pars
.
get
(
"type"
);
}
public
String
getUrl
()
{
return
m_url
;
}
public
QueryEntity
setEnd
(
Date
end
)
{
m_end
=
end
;
return
this
;
}
public
QueryEntity
setStart
(
Date
start
)
{
m_start
=
start
;
return
this
;
}
}
}
}
cat-home/src/main/java/com/dianping/cat/report/page/web/Model.java
浏览文件 @
94bacad2
...
@@ -31,6 +31,10 @@ public class Model extends AbstractReportModel<Action, Context> {
...
@@ -31,6 +31,10 @@ public class Model extends AbstractReportModel<Action, Context> {
private
Date
m_end
;
private
Date
m_end
;
private
Date
m_compareStart
;
private
Date
m_compareEnd
;
private
String
m_cityInfo
;
private
String
m_cityInfo
;
private
String
m_json
;
private
String
m_json
;
...
@@ -47,6 +51,14 @@ public class Model extends AbstractReportModel<Action, Context> {
...
@@ -47,6 +51,14 @@ public class Model extends AbstractReportModel<Action, Context> {
return
m_cityInfo
;
return
m_cityInfo
;
}
}
public
Date
getCompareEnd
()
{
return
m_compareEnd
;
}
public
Date
getCompareStart
()
{
return
m_compareStart
;
}
@Override
@Override
public
Action
getDefaultAction
()
{
public
Action
getDefaultAction
()
{
return
Action
.
VIEW
;
return
Action
.
VIEW
;
...
@@ -121,6 +133,14 @@ public class Model extends AbstractReportModel<Action, Context> {
...
@@ -121,6 +133,14 @@ public class Model extends AbstractReportModel<Action, Context> {
m_cityInfo
=
cityInfo
;
m_cityInfo
=
cityInfo
;
}
}
public
void
setCompareEnd
(
Date
compareEnd
)
{
m_compareEnd
=
compareEnd
;
}
public
void
setCompareStart
(
Date
compareStart
)
{
m_compareStart
=
compareStart
;
}
public
void
setEnd
(
Date
end
)
{
public
void
setEnd
(
Date
end
)
{
m_end
=
end
;
m_end
=
end
;
}
}
...
...
cat-home/src/main/java/com/dianping/cat/report/page/web/Payload.java
浏览文件 @
94bacad2
...
@@ -3,9 +3,11 @@ package com.dianping.cat.report.page.web;
...
@@ -3,9 +3,11 @@ package com.dianping.cat.report.page.web;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Date
;
import
org.unidal.tuple.Pair
;
import
org.unidal.web.mvc.ActionContext
;
import
org.unidal.web.mvc.ActionContext
;
import
org.unidal.web.mvc.payload.annotation.FieldMeta
;
import
org.unidal.web.mvc.payload.annotation.FieldMeta
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.Monitor
;
import
com.dianping.cat.Monitor
;
import
com.dianping.cat.helper.TimeHelper
;
import
com.dianping.cat.helper.TimeHelper
;
import
com.dianping.cat.report.ReportPage
;
import
com.dianping.cat.report.ReportPage
;
...
@@ -24,7 +26,7 @@ public class Payload extends AbstractReportPayload<Action> {
...
@@ -24,7 +26,7 @@ public class Payload extends AbstractReportPayload<Action> {
private
String
m_city
=
"上海市"
;
private
String
m_city
=
"上海市"
;
@FieldMeta
(
"channel"
)
@FieldMeta
(
"channel"
)
private
String
m_channel
;
private
String
m_channel
=
""
;
@FieldMeta
(
"group"
)
@FieldMeta
(
"group"
)
private
String
m_group
;
private
String
m_group
;
...
@@ -55,29 +57,68 @@ public class Payload extends AbstractReportPayload<Action> {
...
@@ -55,29 +57,68 @@ public class Payload extends AbstractReportPayload<Action> {
return
m_group
;
return
m_group
;
}
}
public
Date
getHistoryEndDate
()
{
private
Date
generateDate
(
String
time
,
long
start
)
{
Date
date
=
null
;
String
[]
times
=
time
.
split
(
":"
);
if
(
times
.
length
==
2
)
{
int
hour
=
Integer
.
parseInt
(
times
[
0
]);
int
minute
=
Integer
.
parseInt
(
times
[
1
]);
if
(
minute
>
0
)
{
hour
+=
1
;
}
date
=
new
Date
(
TimeHelper
.
getCurrentDay
(
start
,
0
).
getTime
()
+
hour
*
TimeHelper
.
ONE_HOUR
);
if
(
date
.
equals
(
TimeHelper
.
getCurrentDay
(
start
,
1
)))
{
date
=
new
Date
(
date
.
getTime
()
-
TimeHelper
.
ONE_MINUTE
);
}
}
else
{
date
=
TimeHelper
.
getCurrentHour
(
1
);
}
return
date
;
}
public
Pair
<
Date
,
Date
>
getHistoryEndDatePair
()
{
Date
currentEnd
=
TimeHelper
.
getCurrentHour
(
1
);
Date
compareEnd
=
null
;
try
{
try
{
if
(
m_customEnd
!=
null
&&
m_customEnd
.
length
()
>
0
)
{
if
(
m_customEnd
!=
null
&&
m_customEnd
.
length
()
>
0
)
{
return
m_format
.
parse
(
m_customEnd
);
String
[]
ends
=
m_customEnd
.
split
(
";"
);
}
else
{
Pair
<
Date
,
Date
>
startDatePair
=
getHistoryStartDatePair
();
return
TimeHelper
.
getCurrentHour
(
1
);
long
start
=
startDatePair
.
getKey
().
getTime
();
currentEnd
=
generateDate
(
ends
[
0
],
start
);
if
(
ends
.
length
==
2
)
{
start
=
startDatePair
.
getValue
().
getTime
();
compareEnd
=
generateDate
(
ends
[
1
],
start
);
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
TimeHelper
.
getCurrentHour
(
1
);
Cat
.
logError
(
e
);
}
}
return
new
Pair
<
Date
,
Date
>(
currentEnd
,
compareEnd
);
}
}
public
Date
getHistoryStartDate
()
{
public
Pair
<
Date
,
Date
>
getHistoryStartDatePair
()
{
Date
currentStart
=
TimeHelper
.
getCurrentDay
();
Date
compareStart
=
null
;
try
{
try
{
if
(
m_customStart
!=
null
&&
m_customStart
.
length
()
>
0
)
{
if
(
m_customStart
!=
null
&&
m_customStart
.
length
()
>
0
)
{
String
[]
starts
=
m_customStart
.
split
(
";"
);
return
m_format
.
parse
(
m_customStart
);
Date
current
=
m_format
.
parse
(
starts
[
0
]);
}
else
{
currentStart
=
new
Date
(
current
.
getTime
()
-
current
.
getTime
()
%
TimeHelper
.
ONE_HOUR
);
return
TimeHelper
.
getCurrentHour
(-
2
);
if
(
starts
.
length
==
2
)
{
Date
compare
=
m_format
.
parse
(
starts
[
1
]);
compareStart
=
new
Date
(
compare
.
getTime
()
-
compare
.
getTime
()
%
TimeHelper
.
ONE_HOUR
);
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
TimeHelper
.
getCurrentHour
(-
2
);
Cat
.
logError
(
e
);
}
}
return
new
Pair
<
Date
,
Date
>(
currentStart
,
compareStart
);
}
}
@Override
@Override
...
...
cat-home/src/main/java/com/dianping/cat/report/page/web/graph/WebGraphCreator.java
浏览文件 @
94bacad2
package
com.dianping.cat.report.page.web.graph
;
package
com.dianping.cat.report.page.web.graph
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Calendar
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -21,16 +24,17 @@ import com.dianping.cat.report.page.LineChart;
...
@@ -21,16 +24,17 @@ import com.dianping.cat.report.page.LineChart;
import
com.dianping.cat.report.page.PieChart
;
import
com.dianping.cat.report.page.PieChart
;
import
com.dianping.cat.report.page.PieChart.Item
;
import
com.dianping.cat.report.page.PieChart.Item
;
import
com.dianping.cat.report.page.model.metric.MetricReportMerger
;
import
com.dianping.cat.report.page.model.metric.MetricReportMerger
;
import
com.dianping.cat.report.page.web.Handler.QueryEntity
;
public
class
WebGraphCreator
extends
AbstractGraphCreator
{
public
class
WebGraphCreator
extends
AbstractGraphCreator
{
private
static
final
String
COUNT
=
"
每分钟访问量(次数
)"
;
private
static
final
String
COUNT
=
"
访问量(次数/5分钟
)"
;
private
static
final
String
AVG
=
"
每分钟响应时间(ms
)"
;
private
static
final
String
AVG
=
"
平均响应时间(毫秒/5分钟
)"
;
p
rivate
static
final
String
SUCESS_PERCENT
=
"每分钟调用成功率(%
)"
;
p
ublic
static
final
String
SUCESS_PERCENT
=
"访问成功率(%/5分钟
)"
;
private
List
<
PieChart
>
buildDetailPieChart
(
MetricReport
report
)
{
private
List
<
PieChart
>
buildDetailPieChart
(
MetricReport
report
,
String
title
)
{
Map
<
String
,
Statistic
>
statics
=
report
.
getStatistics
();
Map
<
String
,
Statistic
>
statics
=
report
.
getStatistics
();
List
<
PieChart
>
charts
=
new
ArrayList
<
PieChart
>();
List
<
PieChart
>
charts
=
new
ArrayList
<
PieChart
>();
...
@@ -47,107 +51,106 @@ public class WebGraphCreator extends AbstractGraphCreator {
...
@@ -47,107 +51,106 @@ public class WebGraphCreator extends AbstractGraphCreator {
item
.
setTitle
(
tmp
.
getId
());
item
.
setTitle
(
tmp
.
getId
());
items
.
add
(
item
);
items
.
add
(
item
);
}
}
chart
.
setTitle
(
entry
.
getKey
());
chart
.
setTitle
(
entry
.
getKey
()
+
"【"
+
title
+
"】"
);
chart
.
addItems
(
items
);
chart
.
addItems
(
items
);
charts
.
add
(
chart
);
charts
.
add
(
chart
);
}
}
return
charts
;
return
charts
;
}
}
public
Pair
<
LineChart
,
PieChart
>
buildErrorChartData
(
final
Map
<
String
,
double
[]>
datas
,
Date
startDate
,
public
Pair
<
LineChart
,
PieChart
>
buildCodeChartData
(
final
Map
<
String
,
Double
[]>
dataWithOutFutures
,
String
type
)
{
Date
endDate
,
final
Map
<
String
,
double
[]>
dataWithOutFutures
)
{
LineChart
lineChart
=
new
LineChart
();
LineChart
lineChart
=
new
LineChart
();
int
step
=
m_dataExtractor
.
getStep
(
);
lineChart
.
setUnit
(
""
);
lineChart
.
set
Start
(
startDate
);
lineChart
.
set
HtmlTitle
(
type
+
"平均分布(个/5分钟)"
);
lineChart
.
setStep
(
step
*
TimeHelper
.
ONE_MINUTE
);
PieChart
pieChart
=
new
PieChart
();
PieChart
pieChart
=
new
PieChart
();
List
<
PieChart
.
Item
>
items
=
new
ArrayList
<
PieChart
.
Item
>();
List
<
PieChart
.
Item
>
items
=
new
ArrayList
<
PieChart
.
Item
>();
pieChart
.
addItems
(
items
);
pieChart
.
addItems
(
items
);
for
(
Entry
<
String
,
d
ouble
[]>
entry
:
dataWithOutFutures
.
entrySet
())
{
for
(
Entry
<
String
,
D
ouble
[]>
entry
:
dataWithOutFutures
.
entrySet
())
{
String
key
=
entry
.
getKey
();
String
key
=
entry
.
getKey
();
double
[]
value
=
entry
.
getValue
();
Double
[]
value
=
entry
.
getValue
();
Map
<
Long
,
Double
>
all
=
convertToMap
(
datas
.
get
(
key
),
startDate
,
1
);
Map
<
Long
,
Double
>
current
=
convertToMap
(
dataWithOutFutures
.
get
(
key
),
startDate
,
step
);
addLastMinuteData
(
current
,
all
,
m_lastMinute
,
endDate
);
lineChart
.
setSize
(
value
.
length
);
lineChart
.
add
(
entry
.
getKey
(),
current
);
double
sum
=
computeSum
(
current
);
lineChart
.
add
(
key
,
value
);
double
sum
=
computeSum
(
value
);
items
.
add
(
new
Item
().
setTitle
(
entry
.
getKey
()).
setNumber
(
sum
));
items
.
add
(
new
Item
().
setTitle
(
entry
.
getKey
()).
setNumber
(
sum
));
}
}
return
new
Pair
<
LineChart
,
PieChart
>(
lineChart
,
pieChart
);
return
new
Pair
<
LineChart
,
PieChart
>(
lineChart
,
pieChart
);
}
}
private
Map
<
String
,
LineChart
>
buildInfoChartData
(
final
Map
<
String
,
double
[]>
datas
,
Date
startDate
,
Date
end
Date
,
private
Map
<
String
,
LineChart
>
buildInfoChartData
(
final
Map
<
String
,
Double
[]>
dataWithOutFutures
,
Date
start
Date
,
final
Map
<
String
,
double
[]>
dataWithOutFutures
)
{
Date
endDate
,
String
title
)
{
Map
<
String
,
LineChart
>
charts
=
new
LinkedHashMap
<
String
,
LineChart
>();
Map
<
String
,
LineChart
>
charts
=
new
LinkedHashMap
<
String
,
LineChart
>();
int
step
=
m_dataExtractor
.
getStep
();
for
(
Entry
<
String
,
Double
[]>
entry
:
dataWithOutFutures
.
entrySet
())
{
for
(
Entry
<
String
,
double
[]>
entry
:
dataWithOutFutures
.
entrySet
())
{
String
key
=
entry
.
getKey
();
String
key
=
entry
.
getKey
();
d
ouble
[]
value
=
entry
.
getValue
();
D
ouble
[]
value
=
entry
.
getValue
();
LineChart
lineChart
=
new
LineChart
();
LineChart
lineChart
=
new
LineChart
();
lineChart
.
setId
(
key
);
lineChart
.
setId
(
key
);
lineChart
.
setUnit
(
""
);
lineChart
.
setTitle
(
key
);
lineChart
.
setTitle
(
key
);
lineChart
.
setStart
(
startDate
);
lineChart
.
setHtmlTitle
(
key
);
lineChart
.
setSize
(
value
.
length
);
lineChart
.
add
(
title
,
value
);
lineChart
.
setStep
(
step
*
TimeHelper
.
ONE_MINUTE
);
Map
<
Long
,
Double
>
all
=
convertToMap
(
datas
.
get
(
key
),
startDate
,
1
);
Map
<
Long
,
Double
>
current
=
convertToMap
(
dataWithOutFutures
.
get
(
key
),
startDate
,
step
);
addLastMinuteData
(
current
,
all
,
m_lastMinute
,
endDate
);
lineChart
.
add
(
entry
.
getKey
(),
current
);
charts
.
put
(
key
,
lineChart
);
charts
.
put
(
key
,
lineChart
);
}
}
return
charts
;
return
charts
;
}
}
public
double
computeSum
(
Map
<
Long
,
Double
>
data
)
{
public
double
computeSum
(
Double
[]
data
)
{
double
result
=
0
;
double
result
=
0
;
for
(
double
d
:
data
.
values
())
{
for
(
int
i
=
0
;
i
<
data
.
length
;
i
++)
{
result
=
result
+
d
;
if
(
data
[
i
]
!=
null
)
{
result
=
result
+
data
[
i
];
}
}
}
return
result
;
return
result
;
}
}
private
Map
<
String
,
d
ouble
[]>
fetchMetricCodeInfo
(
MetricReport
report
)
{
private
Map
<
String
,
D
ouble
[]>
fetchMetricCodeInfo
(
MetricReport
report
)
{
Map
<
String
,
MetricItem
>
items
=
report
.
getMetricItems
();
Map
<
String
,
MetricItem
>
items
=
report
.
getMetricItems
();
Map
<
String
,
double
[]>
datas
=
new
LinkedHashMap
<
String
,
d
ouble
[]>();
Map
<
String
,
Double
[]>
datas
=
new
LinkedHashMap
<
String
,
D
ouble
[]>();
for
(
Entry
<
String
,
MetricItem
>
item
:
items
.
entrySet
())
{
for
(
Entry
<
String
,
MetricItem
>
item
:
items
.
entrySet
())
{
String
id
=
item
.
getKey
();
String
id
=
item
.
getKey
();
int
index
=
id
.
indexOf
(
"|"
);
int
index
=
id
.
indexOf
(
"|"
);
String
key
=
id
.
substring
(
index
+
1
);
String
key
=
id
.
substring
(
index
+
1
);
Map
<
Integer
,
Segment
>
segments
=
item
.
getValue
().
getSegments
();
Map
<
Integer
,
Segment
>
segments
=
item
.
getValue
().
getSegments
();
d
ouble
[]
data
=
datas
.
get
(
key
);
D
ouble
[]
data
=
datas
.
get
(
key
);
if
(
data
==
null
)
{
if
(
data
==
null
)
{
data
=
new
double
[
60
];
data
=
new
Double
[
12
];
datas
.
put
(
key
,
data
);
datas
.
put
(
key
,
data
);
}
}
for
(
Segment
segment
:
segments
.
values
())
{
for
(
Segment
segment
:
segments
.
values
())
{
int
count
=
segment
.
getCount
();
dataInc
(
data
,
segment
.
getId
()
/
5
,
segment
.
getCount
());
int
minute
=
segment
.
getId
();
data
[
minute
]
=
count
;
}
}
}
}
return
datas
;
return
datas
;
}
}
private
Map
<
String
,
double
[]>
fetchMetricInfoData
(
MetricReport
report
)
{
private
void
dataInc
(
Double
[]
datas
,
int
index
,
double
value
)
{
Map
<
String
,
double
[]>
data
=
new
LinkedHashMap
<
String
,
double
[]>();
if
(
datas
[
index
]
!=
null
)
{
datas
[
index
]
+=
value
;
}
else
{
datas
[
index
]
=
value
;
}
}
private
Map
<
String
,
Double
[]>
fetchMetricInfoData
(
MetricReport
report
)
{
Map
<
String
,
Double
[]>
data
=
new
LinkedHashMap
<
String
,
Double
[]>();
Double
[]
count
=
new
Double
[
12
];
Double
[]
avg
=
new
Double
[
12
];
Double
[]
avgCount
=
new
Double
[
12
];
Double
[]
avgSum
=
new
Double
[
12
];
Double
[]
error
=
new
Double
[
12
];
Double
[]
successPercent
=
new
Double
[
12
];
double
[]
count
=
new
double
[
60
];
for
(
int
i
=
0
;
i
<
successPercent
.
length
;
i
++)
{
double
[]
avg
=
new
double
[
60
];
successPercent
[
i
]
=
100.0
;
double
[]
error
=
new
double
[
60
];
}
double
[]
successPercent
=
new
double
[
60
];
data
.
put
(
COUNT
,
count
);
data
.
put
(
COUNT
,
count
);
data
.
put
(
AVG
,
avg
);
data
.
put
(
AVG
,
avg
);
...
@@ -160,77 +163,137 @@ public class WebGraphCreator extends AbstractGraphCreator {
...
@@ -160,77 +163,137 @@ public class WebGraphCreator extends AbstractGraphCreator {
Map
<
Integer
,
Segment
>
segments
=
item
.
getValue
().
getSegments
();
Map
<
Integer
,
Segment
>
segments
=
item
.
getValue
().
getSegments
();
for
(
Segment
segment
:
segments
.
values
())
{
for
(
Segment
segment
:
segments
.
values
())
{
int
id
=
segment
.
getId
();
int
id
=
segment
.
getId
()
/
5
;
if
(
key
.
endsWith
(
Monitor
.
HIT
))
{
if
(
key
.
endsWith
(
Monitor
.
HIT
))
{
count
[
id
]
=
segment
.
getCount
(
);
dataInc
(
count
,
id
,
segment
.
getCount
()
);
}
else
if
(
key
.
endsWith
(
Monitor
.
ERROR
))
{
}
else
if
(
key
.
endsWith
(
Monitor
.
ERROR
))
{
error
[
id
]
=
segment
.
getCount
(
);
dataInc
(
error
,
id
,
segment
.
getCount
()
);
}
else
if
(
key
.
endsWith
(
Monitor
.
AVG
))
{
}
else
if
(
key
.
endsWith
(
Monitor
.
AVG
))
{
avg
[
id
]
=
segment
.
getAvg
();
dataInc
(
avgCount
,
id
,
segment
.
getCount
());
dataInc
(
avgSum
,
id
,
segment
.
getSum
());
}
}
}
}
}
}
for
(
int
i
=
0
;
i
<
60
;
i
++)
{
for
(
int
i
=
0
;
i
<
12
;
i
++)
{
double
sum
=
count
[
i
];
if
(
avgSum
[
i
]
!=
null
&&
avgCount
[
i
]
!=
null
)
{
double
success
=
count
[
i
]
-
error
[
i
];
avg
[
i
]
=
avgSum
[
i
]
/
avgCount
[
i
];
}
}
if
(
sum
>
0
)
{
for
(
int
i
=
0
;
i
<
12
;
i
++)
{
successPercent
[
i
]
=
success
/
sum
*
100.0
;
if
(
count
[
i
]
!=
null
)
{
}
else
{
double
sum
=
count
[
i
];
successPercent
[
i
]
=
100
;
double
success
=
count
[
i
]
-
(
error
[
i
]
!=
null
?
error
[
i
]
:
0.0
);
if
(
sum
>
0
)
{
successPercent
[
i
]
=
success
/
sum
*
100.0
;
}
else
{
successPercent
[
i
]
=
100.0
;
}
}
}
}
}
return
data
;
return
data
;
}
}
private
Map
<
String
,
double
[]>
prepareAllData
(
MetricReport
all
,
String
url
,
Map
<
String
,
String
>
pars
,
Date
startDate
,
protected
void
mergeValue
(
Map
<
String
,
Double
[]>
all
,
Map
<
String
,
Double
[]>
item
,
int
size
,
int
index
)
{
Date
endDate
)
{
for
(
Entry
<
String
,
Double
[]>
entry
:
item
.
entrySet
())
{
long
start
=
startDate
.
getTime
(),
end
=
endDate
.
getTime
();
String
key
=
entry
.
getKey
();
int
totalSize
=
(
int
)
((
end
-
start
)
/
TimeHelper
.
ONE_MINUTE
);
Double
[]
value
=
entry
.
getValue
();
Map
<
String
,
double
[]>
sourceValue
=
new
LinkedHashMap
<
String
,
double
[]>();
Double
[]
result
=
all
.
get
(
key
);
int
index
=
0
;
String
type
=
pars
.
get
(
"type"
);
if
(
result
==
null
)
{
result
=
new
Double
[
size
];
all
.
put
(
key
,
result
);
if
(
SUCESS_PERCENT
.
equals
(
key
))
{
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
result
[
i
]
=
100.0
;
}
}
}
if
(
value
!=
null
)
{
int
length
=
value
.
length
;
int
pos
=
index
;
for
(
int
i
=
0
;
i
<
length
&&
pos
<
size
;
i
++,
pos
++)
{
result
[
pos
]
=
value
[
i
];
}
}
}
}
private
Map
<
String
,
Double
[]>
prepareAllData
(
MetricReport
all
,
QueryEntity
query
)
{
long
start
=
query
.
getStart
().
getTime
(),
end
=
query
.
getEnd
().
getTime
();
Date
currentDay
=
TimeHelper
.
getCurrentDay
(
start
);
int
totalSize
=
queryDuration
(
currentDay
,
288
);
Map
<
String
,
Double
[]>
sourceValue
=
new
LinkedHashMap
<
String
,
Double
[]>();
String
type
=
query
.
getPars
().
get
(
"type"
);
MetricReportMerger
merger
=
new
MetricReportMerger
(
all
);
MetricReportMerger
merger
=
new
MetricReportMerger
(
all
);
for
(;
start
<
end
;
start
+=
TimeHelper
.
ONE_HOUR
)
{
for
(;
start
<
end
;
start
+=
TimeHelper
.
ONE_HOUR
)
{
MetricReport
report
=
m_metricReportService
.
queryUserMonitorReport
(
url
,
pars
,
new
Date
(
start
));
MetricReport
report
=
m_metricReportService
.
queryUserMonitorReport
(
query
.
getUrl
(),
query
.
getPars
(),
new
Date
(
start
));
int
index
=
(
int
)
((
start
-
currentDay
.
getTime
())
/
(
TimeHelper
.
ONE_MINUTE
*
5
));
if
(
Monitor
.
TYPE_INFO
.
equals
(
type
))
{
if
(
Monitor
.
TYPE_INFO
.
equals
(
type
))
{
Map
<
String
,
d
ouble
[]>
currentValues
=
fetchMetricInfoData
(
report
);
Map
<
String
,
D
ouble
[]>
currentValues
=
fetchMetricInfoData
(
report
);
merge
Map
(
sourceValue
,
currentValues
,
totalSize
,
index
);
merge
Value
(
sourceValue
,
currentValues
,
totalSize
,
index
);
report
.
accept
(
merger
);
report
.
accept
(
merger
);
}
else
{
}
else
{
Map
<
String
,
d
ouble
[]>
currentValues
=
fetchMetricCodeInfo
(
report
);
Map
<
String
,
D
ouble
[]>
currentValues
=
fetchMetricCodeInfo
(
report
);
merge
Map
(
sourceValue
,
currentValues
,
totalSize
,
index
);
merge
Value
(
sourceValue
,
currentValues
,
totalSize
,
index
);
}
}
index
++;
}
}
return
sourceValue
;
return
sourceValue
;
}
}
public
Pair
<
Map
<
String
,
LineChart
>,
List
<
PieChart
>>
queryBaseInfo
(
Date
startDate
,
Date
endDate
,
String
url
,
public
Pair
<
Map
<
String
,
LineChart
>,
List
<
PieChart
>>
queryBaseInfo
(
QueryEntity
queryEntity
,
String
title
)
{
Map
<
String
,
String
>
pars
)
{
MetricReport
report
=
new
MetricReport
(
queryEntity
.
getUrl
());
M
etricReport
report
=
new
MetricReport
(
url
);
M
ap
<
String
,
Double
[]>
oldCurrentValues
=
prepareAllData
(
report
,
queryEntity
);
Map
<
String
,
double
[]>
oldCurrentValues
=
prepareAllData
(
report
,
url
,
pars
,
startDate
,
endDate
);
Map
<
String
,
LineChart
>
lineCharts
=
buildInfoChartData
(
oldCurrentValues
,
queryEntity
.
getStart
(),
Map
<
String
,
double
[]>
allCurrentValues
=
m_dataExtractor
.
extract
(
oldCurrentValues
);
queryEntity
.
getEnd
(),
title
);
Map
<
String
,
double
[]>
dataWithOutFutures
=
removeFutureData
(
endDate
,
allCurrentValues
);
List
<
PieChart
>
pieCharts
=
buildDetailPieChart
(
report
,
title
);
Map
<
String
,
LineChart
>
lineCharts
=
buildInfoChartData
(
oldCurrentValues
,
startDate
,
endDate
,
dataWithOutFutures
);
List
<
PieChart
>
pieCharts
=
buildDetailPieChart
(
report
);
return
new
Pair
<
Map
<
String
,
LineChart
>,
List
<
PieChart
>>(
lineCharts
,
pieCharts
);
return
new
Pair
<
Map
<
String
,
LineChart
>,
List
<
PieChart
>>(
lineCharts
,
pieCharts
);
}
}
public
Pair
<
LineChart
,
PieChart
>
queryErrorInfo
(
Date
startDate
,
Date
endDate
,
String
url
,
Map
<
String
,
String
>
pars
)
{
private
int
queryDuration
(
Date
period
,
int
defaultValue
)
{
MetricReport
report
=
new
MetricReport
(
url
);
Calendar
cal
=
Calendar
.
getInstance
();
Map
<
String
,
double
[]>
oldCurrentValues
=
prepareAllData
(
report
,
url
,
pars
,
startDate
,
endDate
);
Map
<
String
,
double
[]>
allCurrentValues
=
m_dataExtractor
.
extract
(
oldCurrentValues
);
cal
.
set
(
Calendar
.
HOUR_OF_DAY
,
0
);
Map
<
String
,
double
[]>
dataWithOutFutures
=
removeFutureData
(
endDate
,
allCurrentValues
);
cal
.
set
(
Calendar
.
MINUTE
,
0
);
cal
.
set
(
Calendar
.
SECOND
,
0
);
cal
.
set
(
Calendar
.
MILLISECOND
,
0
);
if
(
cal
.
getTime
().
equals
(
period
))
{
long
start
=
cal
.
getTimeInMillis
();
long
current
=
System
.
currentTimeMillis
();
int
length
=
(
int
)
(
current
-
current
%
300000
-
start
)
/
300000
;
return
buildErrorChartData
(
oldCurrentValues
,
startDate
,
endDate
,
dataWithOutFutures
);
return
length
<
0
?
0
:
length
;
}
return
defaultValue
;
}
public
Pair
<
LineChart
,
PieChart
>
queryErrorInfo
(
QueryEntity
queryEntity
)
{
MetricReport
report
=
new
MetricReport
(
queryEntity
.
getUrl
());
Map
<
String
,
Double
[]>
oldCurrentValues
=
prepareAllData
(
report
,
queryEntity
);
return
buildCodeChartData
(
oldCurrentValues
,
queryEntity
.
getType
());
}
}
public
double
queryMinYlable
(
final
List
<
Double
[]>
datas
)
{
double
min
=
Double
.
MAX_VALUE
;
for
(
Double
[]
data
:
datas
)
{
List
<
Double
>
dataList
=
Arrays
.
asList
(
data
);
double
tmp
=
Collections
.
min
(
dataList
);
if
(
min
>
tmp
)
{
min
=
tmp
;
}
}
return
min
;
}
}
}
cat-home/src/main/webapp/js/baseGraph.js
浏览文件 @
94bacad2
...
@@ -171,7 +171,7 @@ function graphMetricChart(container, data) {
...
@@ -171,7 +171,7 @@ function graphMetricChart(container, data) {
});
});
}
}
function
parseMetricLineDataFor
App
(
data
)
{
function
parseMetricLineDataFor
Day
(
data
)
{
var
res
=
[];
var
res
=
[];
data
.
subTitles
.
forEach
(
function
(
title
,
i
)
{
data
.
subTitles
.
forEach
(
function
(
title
,
i
)
{
var
series
=
{}
var
series
=
{}
...
@@ -182,7 +182,7 @@ function parseMetricLineDataForApp(data) {
...
@@ -182,7 +182,7 @@ function parseMetricLineDataForApp(data) {
return
res
;
return
res
;
}
}
function
graphMetricChartFor
App
(
container
,
data
,
datePair
)
{
function
graphMetricChartFor
Day
(
container
,
data
,
datePair
)
{
Highcharts
.
setOptions
({
Highcharts
.
setOptions
({
global
:
{
global
:
{
useUTC
:
true
useUTC
:
true
...
@@ -190,7 +190,7 @@ function graphMetricChartForApp(container, data, datePair) {
...
@@ -190,7 +190,7 @@ function graphMetricChartForApp(container, data, datePair) {
});
});
var
ylabelMin
=
data
.
minYlabel
;
var
ylabelMin
=
data
.
minYlabel
;
var
ylabelMax
=
data
.
maxYlabel
;
var
ylabelMax
=
data
.
maxYlabel
;
var
_data
=
parseMetricLineDataFor
App
(
data
);
var
_data
=
parseMetricLineDataFor
Day
(
data
);
$
(
container
).
highcharts
(
$
(
container
).
highcharts
(
{
{
chart
:
{
chart
:
{
...
...
cat-home/src/main/webapp/jsp/report/app/linechart.jsp
浏览文件 @
94bacad2
...
@@ -261,7 +261,7 @@
...
@@ -261,7 +261,7 @@
}
}
var
data
=
$
{
model
.
lineChart
.
jsonString
};
var
data
=
$
{
model
.
lineChart
.
jsonString
};
graphMetricChartFor
App
(
document
graphMetricChartFor
Day
(
document
.
getElementById
(
'
${model.lineChart.id}
'
),
data
,
datePair
);
.
getElementById
(
'
${model.lineChart.id}
'
),
data
,
datePair
);
});
});
</script>
</script>
...
...
cat-home/src/main/webapp/jsp/report/app/speed.jsp
浏览文件 @
94bacad2
...
@@ -173,7 +173,7 @@
...
@@ -173,7 +173,7 @@
var
data
=
$
{
model
.
appSpeedDisplayInfo
.
lineChart
.
jsonString
};
var
data
=
$
{
model
.
appSpeedDisplayInfo
.
lineChart
.
jsonString
};
graphMetricChartFor
App
(
document
.
getElementById
(
'
${model.appSpeedDisplayInfo.lineChart.id}
'
),
graphMetricChartFor
Day
(
document
.
getElementById
(
'
${model.appSpeedDisplayInfo.lineChart.id}
'
),
data
,
datePair
);
data
,
datePair
);
});
});
</script>
</script>
...
...
cat-home/src/main/webapp/jsp/report/web/web.jsp
浏览文件 @
94bacad2
...
@@ -17,6 +17,28 @@
...
@@ -17,6 +17,28 @@
<res:useJs
value=
"
${
res
.
js
.
local
[
'bootstrap-datetimepicker.min.js'
]
}
"
target=
"head-js"
/>
<res:useJs
value=
"
${
res
.
js
.
local
[
'bootstrap-datetimepicker.min.js'
]
}
"
target=
"head-js"
/>
<res:useJs
value=
"
${
res
.
js
.
local
[
'baseGraph.js'
]
}
"
target=
"head-js"
/>
<res:useJs
value=
"
${
res
.
js
.
local
[
'baseGraph.js'
]
}
"
target=
"head-js"
/>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
var
urlData
=
$
{
model
.
items
};
var
cityData
=
$
{
model
.
cityInfo
};
function
check
()
{
var
value
=
document
.
getElementById
(
"
checkbox
"
).
checked
;
if
(
value
==
true
)
{
$
(
'
#history
'
).
slideDown
();
$
(
'
#startTime2
'
).
val
(
$
(
'
#startTime
'
).
val
());
$
(
'
#endTime2
'
).
val
(
$
(
'
#endTime
'
).
val
());
$
(
"
#group2
"
).
val
(
$
(
"
#group
"
).
val
());
$
(
"
#group2
"
).
change
();
$
(
"
#url2
"
).
val
(
$
(
"
#url
"
).
val
());
$
(
"
#province2
"
).
val
(
$
(
"
#province
"
).
val
());
$
(
'
#province2
'
).
change
();
$
(
"
#city2
"
).
val
(
$
(
"
#city
"
).
val
());
$
(
"
#channel2
"
).
val
(
$
(
"
#channel
"
).
val
());
$
(
"
#type2
"
).
val
(
$
(
"
#type
"
).
val
());
}
else
{
$
(
'
#history
'
).
slideUp
();
}
}
function
query
(){
function
query
(){
var
group
=
$
(
"
#group
"
).
val
();
var
group
=
$
(
"
#group
"
).
val
();
var
url
=
$
(
"
#url
"
).
val
();
var
url
=
$
(
"
#url
"
).
val
();
...
@@ -26,66 +48,93 @@
...
@@ -26,66 +48,93 @@
var
start
=
$
(
"
#startTime
"
).
val
();
var
start
=
$
(
"
#startTime
"
).
val
();
var
end
=
$
(
"
#endTime
"
).
val
();
var
end
=
$
(
"
#endTime
"
).
val
();
var
value
=
document
.
getElementById
(
"
checkbox
"
).
checked
;
if
(
value
)
{
var
start2
=
$
(
"
#startTime2
"
).
val
();
var
end2
=
$
(
"
#endTime2
"
).
val
();
var
group2
=
$
(
"
#group2
"
).
val
();
var
url2
=
$
(
"
#url2
"
).
val
();
var
city2
=
$
(
"
#city2
"
).
val
();
var
channel2
=
$
(
"
#channel2
"
).
val
();
var
split
=
"
;
"
;
start
+=
split
+
start2
;
end
+=
split
+
end2
;
url
+=
split
+
url2
;
group
+=
split
+
group2
;
city
+=
split
+
city2
;
channel
+=
split
+
channel2
;
}
window
.
location
.
href
=
"
?url=
"
+
url
+
"
&group=
"
+
group
+
"
&city=
"
+
city
+
"
&type=
"
+
type
+
"
&channel=
"
+
channel
+
"
&startDate=
"
+
start
+
"
&endDate=
"
+
end
;
window
.
location
.
href
=
"
?url=
"
+
url
+
"
&group=
"
+
group
+
"
&city=
"
+
city
+
"
&type=
"
+
type
+
"
&channel=
"
+
channel
+
"
&startDate=
"
+
start
+
"
&endDate=
"
+
end
;
}
}
$
(
document
).
ready
(
function
()
{
function
groupChange
(){
$
(
'
#datetimepicker1
'
).
datetimepicker
();
var
key
;
$
(
'
#datetimepicker2
'
).
datetimepicker
();
var
url
;
$
(
'
#startTime
'
).
val
(
"
${w:format(model.start,'yyyy-MM-dd HH:mm')}
"
);
if
(
$
(
this
).
attr
(
"
id
"
)
==
"
group
"
)
{
$
(
'
#endTime
'
).
val
(
"
${w:format(model.end,'yyyy-MM-dd HH:mm')}
"
);
key
=
$
(
'
#group
'
).
val
();
$
(
'
#type
'
).
val
(
'
${payload.type}
'
);
url
=
document
.
getElementById
(
'
url
'
);
$
(
'
#channel
'
).
val
(
'
${payload.channel}
'
);
}
else
{
$
(
'
#url
'
).
val
(
'
${payload.url}
'
);
key
=
$
(
"
#group2
"
).
val
();
url
=
document
.
getElementById
(
"
url2
"
);
var
cityData
=
$
{
model
.
cityInfo
};
var
select
=
$
(
'
#province
'
);
var
urlData
=
$
{
model
.
items
};
var
group
=
$
(
'
#group
'
);
function
groupChange
(){
var
key
=
$
(
"
#group
"
).
val
();
var
value
=
urlData
[
key
];
var
url
=
document
.
getElementById
(
"
url
"
);
url
.
length
=
0
;
for
(
var
prop
in
value
)
{
var
opt
=
$
(
'
<option />
'
);
opt
.
html
(
value
[
prop
].
pattern
);
opt
.
val
(
value
[
prop
].
name
);
opt
.
appendTo
(
url
);
}
}
}
group
.
on
(
'
change
'
,
groupChange
);
url
.
length
=
0
;
var
value
=
urlData
[
key
];
function
provinceChange
(){
for
(
var
prop
in
value
)
{
var
key
=
$
(
"
#province
"
).
val
();
var
opt
=
$
(
'
<option />
'
);
var
value
=
cityData
[
key
];
opt
.
html
(
value
[
prop
].
pattern
);
opt
.
val
(
value
[
prop
].
name
);
opt
.
appendTo
(
url
);
}
}
function
typeChange
(){
var
type
=
$
(
'
#type
'
).
val
();
if
(
type
!=
"
info
"
){
$
(
'
#history
'
).
slideUp
();
document
.
getElementById
(
"
checkbox
"
).
checked
=
false
;
document
.
getElementById
(
"
checkbox
"
).
style
.
visibility
=
'
hidden
'
;
document
.
getElementById
(
"
checkboxLabel
"
).
style
.
visibility
=
'
hidden
'
;
}
else
{
document
.
getElementById
(
"
checkbox
"
).
style
.
visibility
=
'
visible
'
;
document
.
getElementById
(
"
checkboxLabel
"
).
style
.
visibility
=
'
visible
'
;
}
}
function
provinceChange
(){
var
select
;
var
key
;
if
(
$
(
this
).
attr
(
"
id
"
)
==
"
province
"
)
{
key
=
$
(
"
#province
"
).
val
();
select
=
document
.
getElementById
(
"
city
"
);
select
=
document
.
getElementById
(
"
city
"
);
select
.
length
=
0
;
}
else
{
for
(
var
prop
in
value
)
{
key
=
$
(
"
#province2
"
).
val
();
var
opt
=
$
(
'
<option />
'
);
select
=
document
.
getElementById
(
"
city2
"
);
var
city
=
value
[
prop
].
city
;
if
(
city
==
''
){
opt
.
html
(
'
ALL
'
);
}
else
{
opt
.
html
(
city
);
}
var
province
=
value
[
prop
].
province
;
if
(
province
==
''
){
opt
.
val
(
''
);
}
else
{
opt
.
val
(
province
+
'
-
'
+
city
);
}
opt
.
appendTo
(
select
);
}
}
}
select
.
on
(
'
change
'
,
provinceChange
);
var
value
=
cityData
[
key
];
select
.
length
=
0
;
for
(
var
prop
in
value
)
{
var
opt
=
$
(
'
<option />
'
);
var
city
=
value
[
prop
].
city
;
if
(
city
==
''
){
opt
.
html
(
'
ALL
'
);
}
else
{
opt
.
html
(
city
);
}
var
province
=
value
[
prop
].
province
;
if
(
province
==
''
){
opt
.
val
(
''
);
}
else
{
opt
.
val
(
province
+
'
-
'
+
city
);
}
opt
.
appendTo
(
select
);
}
}
function
init
(
province
,
group
)
{
for
(
var
prop
in
cityData
)
{
for
(
var
prop
in
cityData
)
{
if
(
cityData
.
hasOwnProperty
(
prop
))
{
if
(
cityData
.
hasOwnProperty
(
prop
))
{
var
opt
=
$
(
'
<option />
'
);
var
opt
=
$
(
'
<option />
'
);
...
@@ -96,7 +145,7 @@
...
@@ -96,7 +145,7 @@
opt
.
html
(
prop
);
opt
.
html
(
prop
);
}
}
opt
.
val
(
prop
);
opt
.
val
(
prop
);
opt
.
appendTo
(
select
);
opt
.
appendTo
(
$
(
'
#
'
+
province
)
);
}
}
}
}
...
@@ -106,29 +155,97 @@
...
@@ -106,29 +155,97 @@
opt
.
val
(
prop
);
opt
.
val
(
prop
);
opt
.
html
(
prop
);
opt
.
html
(
prop
);
opt
.
appendTo
(
group
);
opt
.
appendTo
(
$
(
'
#
'
+
group
)
);
}
}
}
}
}
$
(
document
).
ready
(
function
()
{
$
(
'
#datetimepicker1
'
).
datetimepicker
();
$
(
'
#datetimepicker2
'
).
datetimepicker
({
pickDate
:
false
});
$
(
'
#startTime
'
).
val
(
"
${w:format(model.start,'yyyy-MM-dd HH:mm')}
"
);
$
(
'
#endTime
'
).
val
(
"
${w:format(model.end,'HH:mm')}
"
);
$
(
'
#datetimepicker3
'
).
datetimepicker
();
$
(
'
#datetimepicker4
'
).
datetimepicker
({
pickDate
:
false
});
var
city
=
'
${payload.city}
'
;
$
(
'
#group
'
).
on
(
'
change
'
,
groupChange
);
var
array
=
city
.
split
(
'
-
'
);
$
(
'
#group2
'
).
on
(
'
change
'
,
groupChange
);
$
(
'
#province
'
).
on
(
'
change
'
,
provinceChange
);
$
(
'
#province2
'
).
on
(
'
change
'
,
provinceChange
);
init
(
'
province
'
,
'
group
'
);
init
(
'
province2
'
,
'
group2
'
);
$
(
'
#type
'
).
on
(
'
change
'
,
typeChange
);
var
type
=
'
${payload.type}
'
;
$
(
'
#type
'
).
val
(
type
);
$
(
'
#type
'
).
change
();
var
channels
=
'
${payload.channel}
'
.
split
(
'
;
'
);
var
channel
=
channels
[
0
];
var
channel2
=
channels
[
1
];
var
urls
=
'
${payload.url}
'
.
split
(
'
;
'
);
var
url
=
urls
[
0
];
var
url2
=
urls
[
1
];
var
cities
=
'
${payload.city}
'
.
split
(
'
;
'
);
var
city
=
cities
[
0
];
var
city2
=
cities
[
1
];
var
groups
=
'
${payload.group}
'
.
split
(
'
;
'
);
var
group
=
groups
[
0
];
var
group2
=
groups
[
1
];
$
(
'
#group
'
).
val
(
group
);
$
(
'
#group
'
).
change
();
$
(
"
#url
"
).
val
(
url
);
var
array
=
city
.
split
(
'
-
'
);
$
(
'
#province
'
).
val
(
array
[
0
]);
$
(
'
#province
'
).
val
(
array
[
0
]);
provinceC
hange
();
$
(
'
#province
'
).
c
hange
();
if
(
array
.
length
==
2
){
if
(
array
.
length
==
2
){
$
(
"
#city
"
).
val
(
city
);
$
(
"
#city
"
).
val
(
city
);
}
}
$
(
'
#channel
'
).
val
(
channel
);
$
(
'
#group
'
).
val
(
'
${payload.group}
'
);
var
datePair
=
{};
groupChange
();
datePair
[
"
当前值
"
]
=
"
${w:format(model.start,'yyyy-MM-dd')}
"
;
$
(
"
#url
"
).
val
(
'
${payload.url}
'
);
if
(
typeof
url2
!=
'
undefined
'
&&
typeof
group2
!=
'
undefined
'
&&
typeof
city2
!=
'
undefined
'
&&
typeof
channel2
!=
'
undefined
'
)
{
$
(
'
#history
'
).
slideDown
();
document
.
getElementById
(
"
checkbox
"
).
checked
=
true
;
$
(
'
#group2
'
).
val
(
group2
);
$
(
'
#group2
'
).
change
();
$
(
"
#url
"
).
val
(
url2
);
var
array2
=
city2
.
split
(
'
-
'
);
$
(
'
#province2
'
).
val
(
array2
[
0
]);
$
(
'
#province2
'
).
change
();
if
(
array2
.
length
==
2
){
$
(
"
#city2
"
).
val
(
city2
);
}
$
(
'
#channel2
'
).
val
(
channel2
);
if
(
'
${model.compareStart}
'
.
length
>
0
&&
'
${model.compareEnd}
'
.
length
>
0
)
{
$
(
'
#startTime2
'
).
val
(
"
${w:format(model.compareStart,'yyyy-MM-dd HH:mm')}
"
);
$
(
'
#endTime2
'
).
val
(
"
${w:format(model.compareEnd,'HH:mm')}
"
);
}
datePair
[
"
对比值
"
]
=
"
${w:format(model.compareStart,'yyyy-MM-dd')}
"
;
}
<c:choose>
<c:choose>
<c:when
test=
"
${
payload
.
type
eq
'info'
}
"
>
<c:when
test=
"
${
payload
.
type
eq
'info'
}
"
>
<c:forEach
var=
"item"
items=
"
${
model
.
lineCharts
}
"
varStatus=
"status"
>
<c:forEach
var=
"item"
items=
"
${
model
.
lineCharts
}
"
varStatus=
"status"
>
var
data
=
$
{
item
.
jsonString
};
var
data
=
$
{
item
.
jsonString
};
graphMetricChart
(
document
.
getElementById
(
'
${item.id}
'
),
data
);
graphMetricChartForDay
(
document
.
getElementById
(
'
${item.id}
'
),
data
,
datePair
);
</c:forEach>
</c:forEach>
<c:forEach
var=
"item"
items=
"
${
model
.
pieCharts
}
"
varStatus=
"status"
>
<c:forEach
var=
"item"
items=
"
${
model
.
pieCharts
}
"
varStatus=
"status"
>
var
data
=
$
{
item
.
jsonString
};
var
data
=
$
{
item
.
jsonString
};
...
@@ -136,93 +253,19 @@
...
@@ -136,93 +253,19 @@
</c:forEach>
</c:forEach>
</c:when>
</c:when>
<c:otherwise>
<c:otherwise>
graphMetricChart
(
document
.
getElementById
(
'
lineChart
'
),
$
{
model
.
lineChart
.
jsonString
});
<c:forEach
var=
"item"
items=
"
${
model
.
lineChart
.
subTitles
}
"
varStatus=
"status"
>
graphPieChart
(
document
.
getElementById
(
'
pieChart
'
),
$
{
model
.
pieChart
.
jsonString
});
datePair
[
'
${item}
'
]
=
datePair
[
"
当前值
"
];
</c:forEach>
graphMetricChartForDay
(
document
.
getElementById
(
'
lineChart
'
),
$
{
model
.
lineChart
.
jsonString
},
datePair
);
graphPieChart
(
document
.
getElementById
(
'
pieChart
'
),
$
{
model
.
pieChart
.
jsonString
});
</c:otherwise>
</c:otherwise>
</c:choose>
</c:choose>
});
});
</script>
</script>
<div
class=
"report"
>
<%@include
file=
"webDetail.jsp"
%>
<table>
<tr>
<th
class=
"left"
>
组
<select
style=
"width: 100px;"
name=
"group"
id=
"group"
>
</select>
URL
<select
style=
"width: 600px;"
name=
"url"
id=
"url"
></select>
省份
<select
style=
"width: 100px;"
name=
"province"
id=
"province"
>
</select>
城市
<select
style=
"width: 100px;"
name=
"city"
id=
"city"
>
</select>
运营商
<select
style=
"width: 120px;"
name=
"channel"
id=
"channel"
>
<option
value=
""
>
ALL
</option>
<option
value=
"中国电信"
>
中国电信
</option>
<option
value=
"中国移动"
>
中国移动
</option>
<option
value=
"中国联通"
>
中国联通
</option>
<option
value=
"中国铁通"
>
中国铁通
</option>
<option
value=
"其他"
>
其他
</option>
<option
value=
"国外其他"
>
国外其他
</option>
</select>
查询类型
<select
style=
"width: 120px;"
name=
"type"
id=
"type"
>
<option
value=
"info"
>
访问情况
</option>
<option
value=
"httpStatus"
>
HttpStatus
</option>
<option
value=
"errorCode"
>
Code
</option>
</select>
</th>
</tr>
<tr>
<th
class=
"right"
>
开始时间
<div
id=
"datetimepicker1"
class=
"input-append date"
style=
"margin-bottom: 0px;"
>
<input
id=
"startTime"
name=
"startTime"
style=
"height: 30px; width: 150px;"
data-format=
"yyyy-MM-dd hh:mm"
type=
"text"
></input>
<span
class=
"add-on"
>
<i
data-time-icon=
"icon-time"
data-date-icon=
"icon-calendar"
>
</i>
</span>
</div>
结束时间
<div
id=
"datetimepicker2"
class=
"input-append date"
style=
"margin-bottom: 0px;"
>
<input
id=
"endTime"
name=
"endTime"
style=
"height: 30px; width: 150px;"
data-format=
"yyyy-MM-dd hh:mm"
type=
"text"
></input>
<span
class=
"add-on"
>
<i
data-time-icon=
"icon-time"
data-date-icon=
"icon-calendar"
>
</i>
</span>
</div>
<input
class=
"btn btn-primary "
value=
" 查询 "
onclick=
"query()"
type=
"submit"
>
</div>
</th>
</tr>
</table>
<c:choose>
<c:when
test=
"
${
payload
.
type
eq
'info'
}
"
>
<div>
<c:forEach
var=
"item"
items=
"
${
model
.
lineCharts
}
"
varStatus=
"status"
>
<div
style=
"float: left;"
>
<div
id=
"${item.id}"
style=
"width:450px; height:380px;"
></div>
</div>
</c:forEach></div>
<div>
<c:forEach
var=
"item"
items=
"
${
model
.
pieCharts
}
"
varStatus=
"status"
>
<div
style=
"float: left;"
>
<h5
class=
"text-center"
>
${item.title}
</h5>
<div
id=
"${item.title}"
style=
"width:600px; height:450px;"
></div>
</div>
</c:forEach></div>
</c:when>
<c:otherwise>
<div
class=
"row-fluid"
>
<div
class=
"span6"
>
<div
id=
"lineChart"
style=
"width:550px; height:400px;"
></div>
</div>
<div
class=
"span6"
>
<div
id=
"pieChart"
style=
"width:550px; height:400px;"
></div>
</div>
</div>
</c:otherwise>
</c:choose>
<table
class=
"footer"
>
<tr>
<td>
[ end ]
</td>
</tr>
</table>
</div>
</a:body>
</a:body>
<style
type=
"text/css"
>
.row-fluid
.span6
{
width
:
87%
;
}
</style>
cat-home/src/main/webapp/jsp/report/web/webDetail.jsp
0 → 100644
浏览文件 @
94bacad2
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<div
class=
"report"
>
<table>
<tr>
<th
class=
"left"
>
<div
id=
"datetimepicker1"
class=
"input-append date"
style=
"margin-bottom: 0px;"
>
<input
id=
"startTime"
name=
"time"
style=
"height: 30px; width: 150px;"
data-format=
"yyyy-MM-dd hh:mm"
type=
"text"
></input>
<span
class=
"add-on"
>
<i
data-time-icon=
"icon-time"
data-date-icon=
"icon-calendar"
>
</i>
</span></div>
结束
<div
id=
"datetimepicker2"
class=
"input-append date"
style=
"margin-bottom: 0px;"
>
<input
id=
"endTime"
name=
"time2"
style=
"height: 30px; width: 70px;"
data-format=
"hh:mm"
type=
"text"
></input>
<span
class=
"add-on"
>
<i
data-time-icon=
"icon-time"
data-date-icon=
"icon-calendar"
>
</i>
</span>
</div>
组
<select
style=
"width: 100px;"
name=
"group"
id=
"group"
>
</select>
URL
<select
style=
"width: 500px;"
name=
"url"
id=
"url"
></select>
省份
<select
style=
"width: 100px;"
name=
"province"
id=
"province"
>
</select>
城市
<select
style=
"width: 100px;"
name=
"city"
id=
"city"
>
</select>
</th>
</tr>
<tr>
<th
class=
"left"
>
运营商
<select
style=
"width: 100px;"
name=
"channel"
id=
"channel"
>
<option
value=
""
>
ALL
</option>
<option
value=
"中国电信"
>
中国电信
</option>
<option
value=
"中国移动"
>
中国移动
</option>
<option
value=
"中国联通"
>
中国联通
</option>
<option
value=
"中国铁通"
>
中国铁通
</option>
<option
value=
"其他"
>
其他
</option>
<option
value=
"国外其他"
>
国外其他
</option>
</select>
查询类型
<select
style=
"width: 100px;"
name=
"type"
id=
"type"
>
<option
value=
"info"
>
访问情况
</option>
<option
value=
"httpStatus"
>
HttpStatus
</option>
<option
value=
"errorCode"
>
Code
</option>
</select>
<input
class=
"btn btn-primary "
value=
" 查询 "
onclick=
"query()"
type=
"submit"
>
<input
class=
"btn btn-primary"
id=
"checkbox"
onclick=
"check()"
type=
"checkbox"
/>
<label
for=
"checkbox"
id=
"checkboxLabel"
style=
"display: -webkit-inline-box"
>
选择对比
</label>
</th>
</tr>
</table>
<table
id=
"history"
style=
"display: none"
>
<tr>
<th
class=
"left"
>
<div
id=
"datetimepicker3"
class=
"input-append date"
style=
"margin-bottom: 0px;"
>
<input
id=
"startTime2"
name=
"time"
style=
"height: 30px; width: 150px;"
data-format=
"yyyy-MM-dd hh:mm"
type=
"text"
></input>
<span
class=
"add-on"
>
<i
data-time-icon=
"icon-time"
data-date-icon=
"icon-calendar"
>
</i>
</span></div>
结束
<div
id=
"datetimepicker4"
class=
"input-append date"
style=
"margin-bottom: 0px;"
>
<input
id=
"endTime2"
name=
"time2"
style=
"height: 30px; width: 70px;"
data-format=
"hh:mm"
type=
"text"
></input>
<span
class=
"add-on"
>
<i
data-time-icon=
"icon-time"
data-date-icon=
"icon-calendar"
>
</i>
</span>
</div>
组
<select
style=
"width: 100px;"
name=
"group2"
id=
"group2"
>
</select>
URL
<select
style=
"width: 500px;"
name=
"url2"
id=
"url2"
></select>
省份
<select
style=
"width: 100px;"
name=
"province2"
id=
"province2"
>
</select>
城市
<select
style=
"width: 100px;"
name=
"city2"
id=
"city2"
>
</select>
</th></tr>
<tr>
<th
class=
"left"
>
运营商
<select
style=
"width: 100px;"
name=
"channel2"
id=
"channel2"
>
<option
value=
""
>
ALL
</option>
<option
value=
"中国电信"
>
中国电信
</option>
<option
value=
"中国移动"
>
中国移动
</option>
<option
value=
"中国联通"
>
中国联通
</option>
<option
value=
"中国铁通"
>
中国铁通
</option>
<option
value=
"其他"
>
其他
</option>
<option
value=
"国外其他"
>
国外其他
</option>
</select>
</th>
</tr>
</table>
<c:choose>
<c:when
test=
"
${
payload
.
type
eq
'info'
}
"
>
<div>
<c:forEach
var=
"item"
items=
"
${
model
.
lineCharts
}
"
varStatus=
"status"
>
<div
style=
"float: left;"
>
<div
id=
"${item.id}"
style=
"float: left; width: 95%;"
></div>
</div>
</c:forEach></div>
<div>
<c:forEach
var=
"item"
items=
"
${
model
.
pieCharts
}
"
varStatus=
"status"
>
<div
style=
"float: left;"
>
<h5
class=
"text-center"
>
${item.title}
</h5>
<div
id=
"${item.title}"
style=
"width:600px; height:450px;"
></div>
</div>
</c:forEach></div>
</c:when>
<c:otherwise>
<div
class=
"row-fluid"
>
<div
class=
"span6"
>
<div
id=
"lineChart"
style=
"float: left; width: 100%;"
></div>
</div>
<div
class=
"span6"
>
<div
id=
"pieChart"
style=
"width:550px; height:400px;"
></div>
</div>
</div>
</c:otherwise>
</c:choose>
<table
class=
"footer"
>
<tr>
<td>
[ end ]
</td>
</tr>
</table>
</div>
\ No newline at end of file
script/Cat.sql
浏览文件 @
94bacad2
...
@@ -353,7 +353,7 @@ CREATE TABLE `app_command_data_1` (
...
@@ -353,7 +353,7 @@ CREATE TABLE `app_command_data_1` (
`city`
smallint
NOT
NULL
COMMENT
'城市'
,
`city`
smallint
NOT
NULL
COMMENT
'城市'
,
`operator`
tinyint
NOT
NULL
COMMENT
'运营商'
,
`operator`
tinyint
NOT
NULL
COMMENT
'运营商'
,
`network`
tinyint
NOT
NULL
COMMENT
'网络类型'
,
`network`
tinyint
NOT
NULL
COMMENT
'网络类型'
,
`app_version`
small
int
NOT
NULL
COMMENT
'版本'
,
`app_version`
int
NOT
NULL
COMMENT
'版本'
,
`connect_type`
tinyint
NOT
NULL
COMMENT
'访问类型,是否长连接'
,
`connect_type`
tinyint
NOT
NULL
COMMENT
'访问类型,是否长连接'
,
`code`
smallint
NOT
NULL
COMMENT
'返回码'
,
`code`
smallint
NOT
NULL
COMMENT
'返回码'
,
`platform`
tinyint
NOT
NULL
COMMENT
'平台'
,
`platform`
tinyint
NOT
NULL
COMMENT
'平台'
,
...
@@ -374,7 +374,7 @@ CREATE TABLE `app_speed_data_1` (
...
@@ -374,7 +374,7 @@ CREATE TABLE `app_speed_data_1` (
`city`
smallint
NOT
NULL
COMMENT
'城市'
,
`city`
smallint
NOT
NULL
COMMENT
'城市'
,
`operator`
tinyint
NOT
NULL
COMMENT
'运营商'
,
`operator`
tinyint
NOT
NULL
COMMENT
'运营商'
,
`network`
tinyint
NOT
NULL
COMMENT
'网络类型'
,
`network`
tinyint
NOT
NULL
COMMENT
'网络类型'
,
`app_version`
small
int
NOT
NULL
COMMENT
'版本'
,
`app_version`
int
NOT
NULL
COMMENT
'版本'
,
`platform`
tinyint
NOT
NULL
COMMENT
'平台'
,
`platform`
tinyint
NOT
NULL
COMMENT
'平台'
,
`access_number`
bigint
NOT
NULL
COMMENT
'访问量'
,
`access_number`
bigint
NOT
NULL
COMMENT
'访问量'
,
`slow_access_number`
bigint
NOT
NULL
COMMENT
'慢用户访问量'
,
`slow_access_number`
bigint
NOT
NULL
COMMENT
'慢用户访问量'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录