Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
0946b4f0
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,发现更多精彩内容 >>
提交
0946b4f0
编写于
7月 17, 2014
作者:
Y
youyong205
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #399 from zengwei0771/master
app data collect refactor
上级
a48945e6
aa9de7a4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
34 deletion
+32
-34
cat-broker/src/main/java/com/dianping/cat/broker/api/app/BucketHandler.java
...n/java/com/dianping/cat/broker/api/app/BucketHandler.java
+19
-4
cat-broker/src/main/java/com/dianping/cat/broker/api/page/batch/Handler.java
.../java/com/dianping/cat/broker/api/page/batch/Handler.java
+12
-9
cat-core/src/main/java/com/dianping/cat/config/app/AppDataService.java
...main/java/com/dianping/cat/config/app/AppDataService.java
+1
-21
未找到文件。
cat-broker/src/main/java/com/dianping/cat/broker/api/app/BucketHandler.java
浏览文件 @
0946b4f0
...
...
@@ -11,6 +11,7 @@ import java.util.Map.Entry;
import
org.unidal.helper.Threads.Task
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.app.AppDataCommand
;
import
com.dianping.cat.config.app.AppDataService
;
public
class
BucketHandler
implements
Task
{
...
...
@@ -126,10 +127,24 @@ public class BucketHandler implements Task {
Date
period
=
new
Date
(
m_startTime
-
minute
*
ONE_MINUTE
);
try
{
m_appDataService
.
insert
(
period
,
minute
,
appData
.
getCommand
(),
appData
.
getCity
(),
appData
.
getOperator
(),
appData
.
getNetwork
(),
appData
.
getVersion
(),
appData
.
getConnectType
(),
appData
.
getCode
(),
appData
.
getPlatform
(),
appData
.
getCount
(),
appData
.
getResponseTime
(),
appData
.
getResponseByte
(),
appData
.
getResponseByte
());
AppDataCommand
proto
=
new
AppDataCommand
();
proto
.
setPeriod
(
period
);
proto
.
setMinuteOrder
(
minute
);
proto
.
setCommandId
(
appData
.
getCommand
());
proto
.
setCity
(
appData
.
getCity
());
proto
.
setOperator
(
appData
.
getOperator
());
proto
.
setNetwork
(
appData
.
getNetwork
());
proto
.
setAppVersion
(
appData
.
getVersion
());
proto
.
setConnnectType
(
appData
.
getConnectType
());
proto
.
setCode
(
appData
.
getCode
());
proto
.
setPlatform
(
appData
.
getPlatform
());
proto
.
setAccessNumber
(
appData
.
getCount
());
proto
.
setResponseSumTime
(
appData
.
getResponseTime
());
proto
.
setRequestPackage
(
appData
.
getRequestByte
());
proto
.
setResponsePackage
(
appData
.
getResponseByte
());
proto
.
setCreationDate
(
new
Date
());
m_appDataService
.
insert
(
proto
);
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
...
...
cat-broker/src/main/java/com/dianping/cat/broker/api/page/batch/Handler.java
浏览文件 @
0946b4f0
...
...
@@ -120,14 +120,17 @@ public class Handler implements PageHandler<Context>, LogEnabled {
String
content
=
payload
.
getContent
();
String
records
[]
=
content
.
split
(
"\n"
);
IpInfo
ipInfo
=
m_ipService
.
findIpInfoByString
(
userIp
);
String
province
=
ipInfo
.
getProvince
();
String
operatorStr
=
ipInfo
.
getChannel
();
Integer
cityId
=
m_appConfigManager
.
getCities
().
get
(
province
);
Integer
operatorId
=
m_appConfigManager
.
getOperators
().
get
(
operatorStr
);
if
(
cityId
!=
null
&&
operatorId
!=
null
)
{
for
(
String
record
:
records
)
{
processOneRecord
(
cityId
,
operatorId
,
record
);
if
(
ipInfo
!=
null
)
{
String
province
=
ipInfo
.
getProvince
();
String
operatorStr
=
ipInfo
.
getChannel
();
Integer
cityId
=
m_appConfigManager
.
getCities
().
get
(
province
);
Integer
operatorId
=
m_appConfigManager
.
getOperators
().
get
(
operatorStr
);
if
(
cityId
!=
null
&&
operatorId
!=
null
)
{
for
(
String
record
:
records
)
{
processOneRecord
(
cityId
,
operatorId
,
record
);
}
}
}
}
else
{
...
...
@@ -158,7 +161,7 @@ public class Handler implements PageHandler<Context>, LogEnabled {
appData
.
setCity
(
cityId
);
appData
.
setOperator
(
operatorId
);
appData
.
setCount
(
1
);
m_appDataConsumer
.
enqueue
(
appData
);
}
}
catch
(
Exception
e
)
{
...
...
cat-core/src/main/java/com/dianping/cat/config/app/AppDataService.java
浏览文件 @
0946b4f0
...
...
@@ -32,27 +32,7 @@ public class AppDataService {
public
static
final
String
DELAY_AVG
=
"成功延时(ms)"
;
public
void
insert
(
Date
period
,
int
minute
,
int
commandId
,
int
city
,
int
operator
,
int
network
,
int
appVersion
,
int
connectType
,
int
code
,
int
platform
,
int
count
,
int
responseSumTime
,
int
requestPackage
,
int
responsePackage
)
throws
DalException
{
AppDataCommand
proto
=
new
AppDataCommand
();
proto
.
setPeriod
(
period
);
proto
.
setMinuteOrder
(
minute
);
proto
.
setCommandId
(
commandId
);
proto
.
setCity
(
city
);
proto
.
setOperator
(
operator
);
proto
.
setNetwork
(
network
);
proto
.
setAppVersion
(
appVersion
);
proto
.
setConnnectType
(
connectType
);
proto
.
setCode
(
code
);
proto
.
setPlatform
(
platform
);
proto
.
setAccessNumber
(
count
);
proto
.
setResponseSumTime
(
responseSumTime
);
proto
.
setRequestPackage
(
requestPackage
);
proto
.
setResponsePackage
(
responsePackage
);
proto
.
setCreationDate
(
new
Date
());
public
void
insert
(
AppDataCommand
proto
)
throws
DalException
{
m_dao
.
insertData
(
proto
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录