Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
cff0eeb0
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,发现更多精彩内容 >>
提交
cff0eeb0
编写于
5月 19, 2014
作者:
Y
youyong205
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify the cat problem
上级
760db3dc
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
216 addition
and
212 deletion
+216
-212
cat-broker/src/main/java/com/dianping/cat/broker/api/page/MonitorEntity.java
.../java/com/dianping/cat/broker/api/page/MonitorEntity.java
+30
-30
cat-broker/src/main/java/com/dianping/cat/broker/api/page/MonitorManager.java
...java/com/dianping/cat/broker/api/page/MonitorManager.java
+7
-14
cat-broker/src/main/java/com/dianping/cat/broker/api/page/RequestUtils.java
...n/java/com/dianping/cat/broker/api/page/RequestUtils.java
+15
-15
cat-broker/src/main/java/com/dianping/cat/broker/api/page/batch/Handler.java
.../java/com/dianping/cat/broker/api/page/batch/Handler.java
+15
-2
cat-home/src/main/java/com/dianping/cat/report/page/userMonitor/Action.java
...java/com/dianping/cat/report/page/userMonitor/Action.java
+4
-4
cat-home/src/main/java/com/dianping/cat/report/page/userMonitor/CityManager.java
...com/dianping/cat/report/page/userMonitor/CityManager.java
+23
-26
cat-home/src/main/java/com/dianping/cat/report/page/userMonitor/Model.java
.../java/com/dianping/cat/report/page/userMonitor/Model.java
+47
-47
cat-home/src/main/java/com/dianping/cat/report/page/userMonitor/Payload.java
...ava/com/dianping/cat/report/page/userMonitor/Payload.java
+26
-26
cat-home/src/main/java/com/dianping/cat/report/page/userMonitor/UserMonitorConvert.java
...nping/cat/report/page/userMonitor/UserMonitorConvert.java
+42
-42
cat-home/src/main/java/com/dianping/cat/report/page/userMonitor/graph/DefaultUserMonitGraphCreator.java
.../page/userMonitor/graph/DefaultUserMonitGraphCreator.java
+3
-3
cat-home/src/main/webapp/js/baseGraph.js
cat-home/src/main/webapp/js/baseGraph.js
+3
-2
cat-home/src/main/webapp/jsp/report/userMonitor.jsp
cat-home/src/main/webapp/jsp/report/userMonitor.jsp
+1
-1
未找到文件。
cat-broker/src/main/java/com/dianping/cat/broker/api/page/MonitorEntity.java
浏览文件 @
cff0eeb0
...
...
@@ -18,72 +18,72 @@ public class MonitorEntity {
private
String
m_ip
;
public
String
getChannel
()
{
return
m_channel
;
}
public
String
getCity
()
{
return
m_city
;
}
public
void
setCity
(
String
city
)
{
m_city
=
city
;
public
double
getDuration
(
)
{
return
m_duration
;
}
public
String
get
Channel
()
{
return
m_
channel
;
public
String
get
ErrorCode
()
{
return
m_
errorCode
;
}
public
void
setChannel
(
String
channel
)
{
m_channel
=
channel
;
}
public
String
getHttpStatus
(
)
{
return
m_httpStatus
;
}
public
String
getIp
()
{
return
m_ip
;
}
public
void
setIp
(
String
ip
)
{
m_ip
=
ip
;
public
String
getTargetUrl
(
)
{
return
m_targetUrl
;
}
public
long
getTimestamp
()
{
return
m_timestamp
;
}
public
MonitorEntity
setTimestamp
(
long
timestamp
)
{
m_timestamp
=
timestamp
;
return
this
;
public
void
setChannel
(
String
channel
)
{
m_channel
=
channel
;
}
public
String
getTargetUrl
(
)
{
return
m_targetUrl
;
public
void
setCity
(
String
city
)
{
m_city
=
city
;
}
public
MonitorEntity
set
TargetUrl
(
String
targetUrl
)
{
m_
targetUrl
=
targetUrl
;
public
MonitorEntity
set
Duration
(
double
duration
)
{
m_
duration
=
duration
;
return
this
;
}
public
double
getDuration
()
{
return
m_duration
;
}
public
MonitorEntity
setDuration
(
double
duration
)
{
m_duration
=
duration
;
public
MonitorEntity
setErrorCode
(
String
errorCode
)
{
m_errorCode
=
errorCode
;
return
this
;
}
public
String
getHttpStatus
()
{
return
m_httpStatus
;
}
public
MonitorEntity
setHttpStatus
(
String
httpStatus
)
{
m_httpStatus
=
httpStatus
;
return
this
;
}
public
String
getErrorCode
(
)
{
return
m_errorCode
;
public
void
setIp
(
String
ip
)
{
m_ip
=
ip
;
}
public
MonitorEntity
setErrorCode
(
String
errorCode
)
{
m_errorCode
=
errorCode
;
public
MonitorEntity
setTargetUrl
(
String
targetUrl
)
{
m_targetUrl
=
targetUrl
;
return
this
;
}
public
MonitorEntity
setTimestamp
(
long
timestamp
)
{
m_timestamp
=
timestamp
;
return
this
;
}
...
...
cat-broker/src/main/java/com/dianping/cat/broker/api/page/MonitorManager.java
浏览文件 @
cff0eeb0
...
...
@@ -102,23 +102,15 @@ public class MonitorManager implements Initializable, LogEnabled {
String
url
=
getFormatUrl
(
targetUrl
);
if
(
url
!=
null
)
{
System
.
out
.
println
(
entity
);
Transaction
t
=
Cat
.
newTransaction
(
"Monitor"
,
url
);
try
{
IpInfo
ip
=
m_ipService
.
findIpInfoByString
(
entity
.
getIp
());
if
(
ip
==
null
)
{
System
.
out
.
println
(
"hack!!"
);
ip
=
new
IpInfo
();
ip
.
setChannel
(
"中国电信"
);
ip
.
setCity
(
"上海市"
);
ip
.
setProvince
(
"上海市"
);
}
String
ip
=
entity
.
getIp
();
IpInfo
ipInfo
=
m_ipService
.
findIpInfoByString
(
ip
);
if
(
ip
!=
null
)
{
String
city
=
ip
.
getProvince
()
+
"-"
+
ip
.
getCity
();
String
channel
=
ip
.
getChannel
();
if
(
ip
Info
!=
null
)
{
String
city
=
ip
Info
.
getProvince
()
+
"-"
+
ipInfo
.
getCity
();
String
channel
=
ip
Info
.
getChannel
();
String
httpCode
=
entity
.
getHttpStatus
();
String
errorCode
=
entity
.
getErrorCode
();
long
timestamp
=
entity
.
getTimestamp
();
...
...
@@ -149,6 +141,8 @@ public class MonitorManager implements Initializable, LogEnabled {
defaultMetric
.
setStatus
(
"C"
);
defaultMetric
.
addData
(
String
.
valueOf
(
1
));
}
}
else
{
m_logger
.
error
(
String
.
format
(
"ip service can't resolve ip: "
,
ip
));
}
t
.
setStatus
(
Transaction
.
SUCCESS
);
}
catch
(
Exception
e
)
{
...
...
@@ -199,7 +193,6 @@ public class MonitorManager implements Initializable, LogEnabled {
@Override
public
void
shutdown
()
{
}
}
}
cat-broker/src/main/java/com/dianping/cat/broker/api/page/RequestUtils.java
浏览文件 @
cff0eeb0
...
...
@@ -4,21 +4,6 @@ import javax.servlet.http.HttpServletRequest;
public
class
RequestUtils
{
public
String
getRemoteIp
(
HttpServletRequest
request
)
{
String
ip
=
filterXForwardedForIP
(
request
.
getHeader
(
"x-forwarded-for"
));
if
(
ip
==
null
||
ip
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ip
))
{
ip
=
request
.
getHeader
(
"Proxy-Client-IP"
);
}
if
(
ip
==
null
||
ip
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ip
))
{
ip
=
request
.
getHeader
(
"WL-Proxy-Client-IP"
);
}
if
(
ip
==
null
||
ip
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ip
))
{
ip
=
request
.
getRemoteAddr
();
}
return
ip
;
}
private
String
filterXForwardedForIP
(
String
ip
)
{
if
(
ip
==
null
||
ip
.
trim
().
length
()
==
0
)
{
return
null
;
...
...
@@ -47,4 +32,19 @@ public class RequestUtils {
}
}
public
String
getRemoteIp
(
HttpServletRequest
request
)
{
String
ip
=
filterXForwardedForIP
(
request
.
getHeader
(
"x-forwarded-for"
));
if
(
ip
==
null
||
ip
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ip
))
{
ip
=
request
.
getHeader
(
"Proxy-Client-IP"
);
}
if
(
ip
==
null
||
ip
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ip
))
{
ip
=
request
.
getHeader
(
"WL-Proxy-Client-IP"
);
}
if
(
ip
==
null
||
ip
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ip
))
{
ip
=
request
.
getRemoteAddr
();
}
return
ip
;
}
}
\ No newline at end of file
cat-broker/src/main/java/com/dianping/cat/broker/api/page/batch/Handler.java
浏览文件 @
cff0eeb0
...
...
@@ -3,19 +3,22 @@ package com.dianping.cat.broker.api.page.batch;
import
java.io.IOException
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
com.dianping.cat.broker.api.ApiPage
;
import
com.dianping.cat.broker.api.page.MonitorEntity
;
import
com.dianping.cat.broker.api.page.MonitorManager
;
import
com.dianping.cat.broker.api.page.RequestUtils
;
import
org.codehaus.plexus.logging.LogEnabled
;
import
org.codehaus.plexus.logging.Logger
;
import
org.unidal.lookup.annotation.Inject
;
import
org.unidal.web.mvc.PageHandler
;
import
org.unidal.web.mvc.annotation.InboundActionMeta
;
import
org.unidal.web.mvc.annotation.OutboundActionMeta
;
import
org.unidal.web.mvc.annotation.PayloadMeta
;
public
class
Handler
implements
PageHandler
<
Context
>
{
public
class
Handler
implements
PageHandler
<
Context
>
,
LogEnabled
{
@Inject
private
JspViewer
m_jspViewer
;
...
...
@@ -25,6 +28,8 @@ public class Handler implements PageHandler<Context> {
@Inject
private
RequestUtils
m_util
;
private
Logger
m_logger
;
@Override
@PayloadMeta
(
Payload
.
class
)
@InboundActionMeta
(
name
=
"batch"
)
...
...
@@ -37,7 +42,8 @@ public class Handler implements PageHandler<Context> {
public
void
handleOutbound
(
Context
ctx
)
throws
ServletException
,
IOException
{
Model
model
=
new
Model
(
ctx
);
Payload
payload
=
ctx
.
getPayload
();
String
userIp
=
m_util
.
getRemoteIp
(
ctx
.
getHttpServletRequest
());
HttpServletRequest
request
=
ctx
.
getHttpServletRequest
();
String
userIp
=
m_util
.
getRemoteIp
(
request
);
if
(
userIp
!=
null
)
{
String
content
=
payload
.
getContent
();
...
...
@@ -61,6 +67,8 @@ public class Handler implements PageHandler<Context> {
}
}
}
}
else
{
m_logger
.
info
(
"unknown http request, x-forwarded-for:"
+
request
.
getHeader
(
"x-forwarded-for"
));
}
model
.
setAction
(
Action
.
VIEW
);
...
...
@@ -70,4 +78,9 @@ public class Handler implements PageHandler<Context> {
m_jspViewer
.
view
(
ctx
,
model
);
}
}
@Override
public
void
enableLogging
(
Logger
logger
)
{
m_logger
=
logger
;
}
}
cat-home/src/main/java/com/dianping/cat/report/page/userMonitor/Action.java
浏览文件 @
cff0eeb0
...
...
@@ -5,10 +5,6 @@ public enum Action implements org.unidal.web.mvc.Action {
private
String
m_name
;
private
Action
(
String
name
)
{
m_name
=
name
;
}
public
static
Action
getByName
(
String
name
,
Action
defaultAction
)
{
for
(
Action
action
:
Action
.
values
())
{
if
(
action
.
getName
().
equals
(
name
))
{
...
...
@@ -19,6 +15,10 @@ public enum Action implements org.unidal.web.mvc.Action {
return
defaultAction
;
}
private
Action
(
String
name
)
{
m_name
=
name
;
}
@Override
public
String
getName
()
{
return
m_name
;
...
...
cat-home/src/main/java/com/dianping/cat/report/page/userMonitor/CityManager.java
浏览文件 @
cff0eeb0
...
...
@@ -17,10 +17,10 @@ public class CityManager implements Initializable {
public
Map
<
String
,
List
<
City
>>
maps
=
new
TreeMap
<
String
,
List
<
City
>>();
public
String
getCityInfo
(){
public
String
getCityInfo
()
{
return
new
JsonBuilder
().
toJson
(
maps
);
}
@Override
public
void
initialize
()
throws
InitializationException
{
try
{
...
...
@@ -29,23 +29,20 @@ public class CityManager implements Initializable {
for
(
String
temp
:
cities
)
{
String
[]
tabs
=
temp
.
split
(
"\\|"
);
if
(
tabs
.
length
>
3
){
String
province
=
tabs
[
1
];
String
city
=
tabs
[
2
];
List
<
City
>
list
=
maps
.
get
(
province
);
if
(
list
==
null
)
{
list
=
new
ArrayList
<
City
>();
list
.
add
(
new
City
(
province
,
""
));
maps
.
put
(
province
,
list
);
}
list
.
add
(
new
City
(
province
,
city
));
}
else
{
System
.
out
.
println
(
temp
);
if
(
tabs
.
length
>
3
)
{
String
province
=
tabs
[
1
];
String
city
=
tabs
[
2
];
List
<
City
>
list
=
maps
.
get
(
province
);
if
(
list
==
null
)
{
list
=
new
ArrayList
<
City
>();
list
.
add
(
new
City
(
province
,
""
));
maps
.
put
(
province
,
list
);
}
list
.
add
(
new
City
(
province
,
city
));
}
}
}
catch
(
IOException
e
)
{
...
...
@@ -64,20 +61,20 @@ public class CityManager implements Initializable {
m_city
=
city
;
}
public
String
getProvince
()
{
return
m_province
;
}
public
void
setProvince
(
String
province
)
{
m_province
=
province
;
}
public
String
getCity
()
{
return
m_city
;
}
public
String
getProvince
()
{
return
m_province
;
}
public
void
setCity
(
String
city
)
{
m_city
=
city
;
}
public
void
setProvince
(
String
province
)
{
m_province
=
province
;
}
}
}
cat-home/src/main/java/com/dianping/cat/report/page/userMonitor/Model.java
浏览文件 @
cff0eeb0
...
...
@@ -29,54 +29,40 @@ public class Model extends AbstractReportModel<Action, Context> {
private
String
m_cityInfo
;
public
String
getCityInfo
()
{
return
m_cityInfo
;
}
public
void
setCityInfo
(
String
cityInfo
)
{
m_cityInfo
=
cityInfo
;
}
public
Date
getStart
()
{
return
m_start
;
}
public
void
setStart
(
Date
start
)
{
m_start
=
start
;
}
public
Date
getEnd
()
{
return
m_end
;
public
Model
(
Context
ctx
)
{
super
(
ctx
);
}
public
void
setEnd
(
Date
end
)
{
m_end
=
end
;
public
List
<
String
>
getCities
(
)
{
return
m_cities
;
}
public
List
<
PatternItem
>
getPattermItems
()
{
return
m_pattermItems
;
}
public
String
getCityInfo
()
{
return
m_cityInfo
;
}
public
void
setPattermItems
(
List
<
PatternItem
>
pattermItems
)
{
m_pattermItems
=
pattermItems
;
@Override
public
Action
getDefaultAction
()
{
return
Action
.
VIEW
;
}
public
Model
(
Context
ctx
)
{
super
(
ctx
);
@Override
public
String
getDomain
()
{
return
getDisplayDomain
();
}
@Override
public
Action
getDefaultAction
()
{
return
Action
.
VIEW
;
public
Collection
<
String
>
getDomains
()
{
return
new
ArrayList
<
String
>()
;
}
public
List
<
String
>
getCities
()
{
return
m_
cities
;
public
Date
getEnd
()
{
return
m_
end
;
}
public
void
setCities
(
List
<
String
>
cities
)
{
m_cities
=
cities
;
}
public
LineChart
getLineChart
(
)
{
return
m_lineChart
;
}
public
List
<
LineChart
>
getLineCharts
()
{
if
(
m_lineCharts
!=
null
){
...
...
@@ -86,34 +72,48 @@ public class Model extends AbstractReportModel<Action, Context> {
}
}
public
void
setLineCharts
(
Map
<
String
,
LineChart
>
lineCharts
)
{
m_lineCharts
=
lineChart
s
;
public
List
<
PatternItem
>
getPattermItems
(
)
{
return
m_pattermItem
s
;
}
@Override
public
String
getDomain
()
{
return
getDisplayDomain
();
public
PieChart
getPieChart
()
{
return
m_pieChart
;
}
public
Date
getStart
()
{
return
m_start
;
}
@Override
public
Collection
<
String
>
getDomains
()
{
return
new
ArrayList
<
String
>();
public
void
setCities
(
List
<
String
>
cities
)
{
m_cities
=
cities
;
}
public
LineChart
getLineChart
(
)
{
return
m_lineChart
;
public
void
setCityInfo
(
String
cityInfo
)
{
m_cityInfo
=
cityInfo
;
}
public
void
setEnd
(
Date
end
)
{
m_end
=
end
;
}
public
void
setLineChart
(
LineChart
lineChart
)
{
m_lineChart
=
lineChart
;
}
public
PieChart
getPieChart
()
{
return
m_pieChart
;
}
public
void
setLineCharts
(
Map
<
String
,
LineChart
>
lineCharts
)
{
m_lineCharts
=
lineCharts
;
}
public
void
setPattermItems
(
List
<
PatternItem
>
pattermItems
)
{
m_pattermItems
=
pattermItems
;
}
public
void
setPieChart
(
PieChart
pieChart
)
{
m_pieChart
=
pieChart
;
}
public
void
setStart
(
Date
start
)
{
m_start
=
start
;
}
}
cat-home/src/main/java/com/dianping/cat/report/page/userMonitor/Payload.java
浏览文件 @
cff0eeb0
...
...
@@ -35,6 +35,19 @@ public class Payload extends AbstractReportPayload<Action> {
super
(
ReportPage
.
USERMONITOR
);
}
@Override
public
Action
getAction
()
{
return
m_action
;
}
public
String
getChannel
()
{
return
m_channel
;
}
public
String
getCity
()
{
return
m_city
;
}
public
Date
getHistoryEndDate
()
{
try
{
if
(
m_customEnd
!=
null
&&
m_customEnd
.
length
()
>
0
)
{
...
...
@@ -60,57 +73,44 @@ public class Payload extends AbstractReportPayload<Action> {
}
}
@Override
public
Action
getAction
()
{
return
m_action
;
}
@Override
public
ReportPage
getPage
()
{
return
m_page
;
}
public
void
setAction
(
String
action
)
{
m_action
=
Action
.
getByName
(
action
,
Action
.
VIEW
);
}
@Override
public
void
setPage
(
String
page
)
{
m_page
=
ReportPage
.
getByName
(
page
,
ReportPage
.
USERMONITOR
);
public
String
getType
()
{
return
m_type
;
}
public
String
getUrl
()
{
return
m_url
;
}
public
void
set
Url
(
String
url
)
{
m_
url
=
url
;
public
void
set
Action
(
String
action
)
{
m_
action
=
Action
.
getByName
(
action
,
Action
.
VIEW
)
;
}
public
String
getCity
(
)
{
return
m_city
;
public
void
setChannel
(
String
channel
)
{
m_channel
=
channel
;
}
public
void
setCity
(
String
city
)
{
m_city
=
city
;
}
public
String
getChannel
()
{
return
m_channel
;
}
public
void
setChannel
(
String
channel
)
{
m_channel
=
channel
;
}
public
String
getType
()
{
return
m_type
;
@Override
public
void
setPage
(
String
page
)
{
m_page
=
ReportPage
.
getByName
(
page
,
ReportPage
.
USERMONITOR
);
}
public
void
setType
(
String
type
)
{
m_type
=
type
;
}
public
void
setUrl
(
String
url
)
{
m_url
=
url
;
}
@Override
public
void
validate
(
ActionContext
<?>
ctx
)
{
if
(
m_action
==
null
)
{
...
...
cat-home/src/main/java/com/dianping/cat/report/page/userMonitor/UserMonitorConvert.java
浏览文件 @
cff0eeb0
...
...
@@ -24,6 +24,10 @@ public class UserMonitorConvert extends BaseVisitor {
m_channel
=
channel
;
}
public
MetricReport
getReport
()
{
return
m_report
;
}
public
void
mergeMetricItem
(
MetricItem
from
,
MetricItem
to
)
{
for
(
Segment
temp
:
to
.
getSegments
().
values
())
{
Segment
target
=
from
.
findOrCreateSegment
(
temp
.
getId
());
...
...
@@ -40,40 +44,6 @@ public class UserMonitorConvert extends BaseVisitor {
}
}
public
MetricReport
getReport
()
{
return
m_report
;
}
@Override
public
void
visitMetricItem
(
MetricItem
metricItem
)
{
try
{
String
id
=
metricItem
.
getId
();
String
[]
temp
=
id
.
split
(
":"
);
String
city
=
temp
[
2
];
String
channel
=
temp
[
3
];
String
info
=
temp
[
4
];
if
(
validate
(
city
,
channel
,
info
))
{
MetricItem
item
=
m_report
.
findOrCreateMetricItem
(
info
);
mergeMetricItem
(
item
,
metricItem
);
}
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
}
@Override
public
void
visitMetricReport
(
MetricReport
metricReport
)
{
m_report
=
new
MetricReport
(
metricReport
.
getProduct
());
super
.
visitMetricReport
(
metricReport
);
}
@Override
public
void
visitSegment
(
Segment
segment
)
{
super
.
visitSegment
(
segment
);
}
private
boolean
validate
(
String
city
,
String
channel
,
String
info
)
{
if
(
Monitor
.
TYPE_INFO
.
equals
(
m_type
))
{
if
(
validateCity
(
city
)
&&
validateChannel
(
channel
)
&&
validateInfo
(
info
))
{
...
...
@@ -91,16 +61,16 @@ public class UserMonitorConvert extends BaseVisitor {
return
false
;
}
private
boolean
validate
Info
(
String
info
)
{
if
(
Monitor
.
HIT
.
equals
(
info
)
||
Monitor
.
ERROR
.
equals
(
info
))
{
private
boolean
validate
Channel
(
String
channel
)
{
if
(
StringUtils
.
isEmpty
(
m_channel
)
||
channel
.
equals
(
m_channel
))
{
return
true
;
}
else
{
return
false
;
}
}
private
boolean
validate
HttpStatus
(
String
info
)
{
if
(
info
.
startsWith
(
Monitor
.
HTTP_STATUS
))
{
private
boolean
validate
City
(
String
city
)
{
if
(
StringUtils
.
isEmpty
(
m_city
)
||
city
.
contains
(
m_city
))
{
return
true
;
}
else
{
return
false
;
...
...
@@ -115,20 +85,50 @@ public class UserMonitorConvert extends BaseVisitor {
}
}
private
boolean
validate
City
(
String
city
)
{
if
(
StringUtils
.
isEmpty
(
m_city
)
||
city
.
contains
(
m_city
))
{
private
boolean
validate
HttpStatus
(
String
info
)
{
if
(
info
.
startsWith
(
Monitor
.
HTTP_STATUS
))
{
return
true
;
}
else
{
return
false
;
}
}
private
boolean
validate
Channel
(
String
channel
)
{
if
(
StringUtils
.
isEmpty
(
m_channel
)
||
channel
.
equals
(
m_channel
))
{
private
boolean
validate
Info
(
String
info
)
{
if
(
Monitor
.
HIT
.
equals
(
info
)
||
Monitor
.
ERROR
.
equals
(
info
))
{
return
true
;
}
else
{
return
false
;
}
}
@Override
public
void
visitMetricItem
(
MetricItem
metricItem
)
{
try
{
String
id
=
metricItem
.
getId
();
String
[]
temp
=
id
.
split
(
":"
);
String
city
=
temp
[
2
];
String
channel
=
temp
[
3
];
String
info
=
temp
[
4
];
if
(
validate
(
city
,
channel
,
info
))
{
MetricItem
item
=
m_report
.
findOrCreateMetricItem
(
info
);
mergeMetricItem
(
item
,
metricItem
);
}
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
}
@Override
public
void
visitMetricReport
(
MetricReport
metricReport
)
{
m_report
=
new
MetricReport
(
metricReport
.
getProduct
());
super
.
visitMetricReport
(
metricReport
);
}
@Override
public
void
visitSegment
(
Segment
segment
)
{
super
.
visitSegment
(
segment
);
}
}
cat-home/src/main/java/com/dianping/cat/report/page/userMonitor/graph/DefaultUserMonitGraphCreator.java
浏览文件 @
cff0eeb0
...
...
@@ -21,11 +21,11 @@ import com.dianping.cat.report.page.PieChart.Item;
public
class
DefaultUserMonitGraphCreator
extends
GraphCreatorBase
implements
UserMonitorGraphCreator
{
private
static
final
String
COUNT
=
"
COUNT
"
;
private
static
final
String
COUNT
=
"
访问量
"
;
private
static
final
String
AVG
=
"
AVG
"
;
private
static
final
String
AVG
=
"
响应时间
"
;
private
static
final
String
SUCESS_PERCENT
=
"
SUCESS_PERCENT
"
;
private
static
final
String
SUCESS_PERCENT
=
"
调用成功率
"
;
public
Pair
<
LineChart
,
PieChart
>
buildErrorChartData
(
final
Map
<
String
,
double
[]>
datas
,
Date
startDate
,
Date
endDate
,
final
Map
<
String
,
double
[]>
dataWithOutFutures
)
{
...
...
cat-home/src/main/webapp/js/baseGraph.js
浏览文件 @
cff0eeb0
...
...
@@ -96,6 +96,7 @@ function graphMetricChart(container, data) {
useUTC
:
false
}
});
var
ylabelMin
=
data
.
minYlable
;
var
_data
=
parseMetricLineData
(
data
);
$
(
container
).
highcharts
(
{
...
...
@@ -119,7 +120,7 @@ function graphMetricChart(container, data) {
}
},
yAxis
:
{
min
:
0.0
min
:
ylabelMin
},
credits
:
{
enabled
:
false
...
...
@@ -147,7 +148,7 @@ function graphMetricChart(container, data) {
+
this
.
series
.
name
+
'
</b><br/>
'
+
Highcharts
.
dateFormat
(
'
%Y-%m-%d %H:%M
'
,
this
.
x
)
+
'
'
+
Number
(
this
.
y
).
toFixed
(
2
);
this
.
x
)
+
'
'
+
Number
(
this
.
y
).
toFixed
(
1
);
}
},
series
:
_data
...
...
cat-home/src/main/webapp/jsp/report/userMonitor.jsp
浏览文件 @
cff0eeb0
...
...
@@ -138,7 +138,7 @@
data-time-icon=
"icon-time"
data-date-icon=
"icon-calendar"
>
</i>
</span>
</div>
<input
class=
"btn btn-primary
btn-small"
value=
"查询
"
<input
class=
"btn btn-primary
"
value=
" 查询
"
onclick=
"query()"
type=
"submit"
></div>
</th>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录