Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
61f01af6
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,发现更多精彩内容 >>
提交
61f01af6
编写于
9月 21, 2012
作者:
Y
youyong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify the test
上级
6b6e74ef
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
63 addition
and
31 deletion
+63
-31
cat-consumer/src/main/java/com/dianping/cat/consumer/cross/CrossAnalyzer.java
...n/java/com/dianping/cat/consumer/cross/CrossAnalyzer.java
+41
-22
cat-consumer/src/main/resources/META-INF/plexus/components.xml
...onsumer/src/main/resources/META-INF/plexus/components.xml
+4
-4
cat-home/src/main/java/com/dianping/cat/report/task/health/HealthReportCreator.java
.../dianping/cat/report/task/health/HealthReportCreator.java
+8
-2
cat-home/src/main/java/com/dianping/cat/report/view/NavigationBar.java
...main/java/com/dianping/cat/report/view/NavigationBar.java
+2
-3
cat-home/src/test/java/com/dianping/cat/demo/TestSendMessage.java
.../src/test/java/com/dianping/cat/demo/TestSendMessage.java
+8
-0
未找到文件。
cat-consumer/src/main/java/com/dianping/cat/consumer/cross/CrossAnalyzer.java
浏览文件 @
61f01af6
...
...
@@ -56,12 +56,6 @@ public class CrossAnalyzer extends AbstractMessageAnalyzer<CrossReport> implemen
return
m_reports
.
keySet
();
}
private
String
getIpFromMessageId
(
String
messageId
)
{
MessageId
id
=
MessageId
.
parse
(
messageId
);
return
id
.
getIpAddress
();
}
public
CrossReport
getReport
(
String
domain
)
{
CrossReport
report
=
m_reports
.
get
(
domain
);
...
...
@@ -137,26 +131,51 @@ public class CrossAnalyzer extends AbstractMessageAnalyzer<CrossReport> implemen
return
crossInfo
;
}
private
CrossInfo
parsePigeonServerTransaction
(
Transaction
t
,
MessageTree
tree
)
{
CrossInfo
crossInfo
=
new
CrossInfo
();
String
localIp
=
tree
.
getIpAddress
();
List
<
Message
>
messages
=
t
.
getChildren
();
for
(
Message
message
:
messages
)
{
if
(
message
instanceof
Event
)
{
if
(
message
.
getType
().
equals
(
"PigeonService.client"
))
{
String
name
=
message
.
getName
();
int
index
=
name
.
indexOf
(
":"
);
if
(
index
>
0
)
{
name
=
name
.
substring
(
0
,
index
);
public
boolean
isIp
(
String
ip
)
{
boolean
result
=
false
;
try
{
if
(
ip
.
matches
(
"\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"
))
{
String
s
[]
=
ip
.
split
(
"\\."
);
if
(
Integer
.
parseInt
(
s
[
0
])
<=
255
)
{
if
(
Integer
.
parseInt
(
s
[
1
])
<=
255
)
{
if
(
Integer
.
parseInt
(
s
[
2
])
<=
255
)
{
if
(
Integer
.
parseInt
(
s
[
3
])
<=
255
)
{
result
=
true
;
}
}
}
crossInfo
.
setRemoteAddress
(
name
);
break
;
}
}
}
catch
(
Exception
e
)
{
//ignore
}
return
result
;
}
private
CrossInfo
parsePigeonServerTransaction
(
Transaction
t
,
MessageTree
tree
)
{
CrossInfo
crossInfo
=
new
CrossInfo
();
String
localIp
=
tree
.
getIpAddress
();
// List<Message> messages = t.getChildren();
// for (Message message : messages) {
// if (message instanceof Event) {
// if (message.getType().equals("PigeonService.client")) {
// String name = message.getName();
// int index = name.indexOf(":");
// if (index > 0) {
// name = name.substring(0, index);
// }
// if (isIp(name)) {
// crossInfo.setRemoteAddress(name);
// }
// break;
// }
// }
// }
if
(
crossInfo
.
getRemoteAddress
().
equals
(
UNKNOWN
))
{
String
remoteIp
=
getIpFromMessageId
(
tree
.
getMessageId
());
MessageId
id
=
MessageId
.
parse
(
tree
.
getMessageId
());
String
remoteIp
=
id
.
getIpAddress
();
crossInfo
.
setRemoteAddress
(
remoteIp
);
}
crossInfo
.
setLocalAddress
(
localIp
);
...
...
@@ -213,7 +232,7 @@ public class CrossAnalyzer extends AbstractMessageAnalyzer<CrossReport> implemen
DefaultXmlBuilder
builder
=
new
DefaultXmlBuilder
(
true
);
Bucket
<
String
>
reportBucket
=
null
;
Transaction
t
=
Cat
.
getProducer
().
newTransaction
(
"Checkpoint"
,
getClass
().
getSimpleName
());
t
.
setStatus
(
Message
.
SUCCESS
);
try
{
reportBucket
=
m_bucketManager
.
getReportBucket
(
m_startTime
,
"cross"
);
...
...
cat-consumer/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
61f01af6
...
...
@@ -5,8 +5,8 @@
<implementation>
com.dianping.cat.consumer.DefaultAnalyzerFactory
</implementation>
</component>
<component>
<role>
com.dianping.cat.consumer.sql
parse
.SqlParseManager
</role>
<implementation>
com.dianping.cat.consumer.sql
parse
.SqlParseManager
</implementation>
<role>
com.dianping.cat.consumer.sql.SqlParseManager
</role>
<implementation>
com.dianping.cat.consumer.sql.SqlParseManager
</implementation>
<requirements>
<requirement>
<role>
com.dainping.cat.consumer.dal.report.SqltableDao
</role>
...
...
@@ -130,7 +130,7 @@
<role>
com.dainping.cat.consumer.dal.report.ReportDao
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.sql
parse
.SqlParseManager
</role>
<role>
com.dianping.cat.consumer.sql.SqlParseManager
</role>
</requirement>
</requirements>
</component>
...
...
@@ -146,7 +146,7 @@
<role>
com.dainping.cat.consumer.dal.report.ReportDao
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.consumer.sql
parse
.SqlParseManager
</role>
<role>
com.dianping.cat.consumer.sql.SqlParseManager
</role>
</requirement>
</requirements>
</component>
...
...
cat-home/src/main/java/com/dianping/cat/report/task/health/HealthReportCreator.java
浏览文件 @
61f01af6
...
...
@@ -359,7 +359,10 @@ public class HealthReportCreator {
m_healthReport
.
setUrl
(
temp
);
}
TransactionType
service
=
types
.
get
(
"Service"
);
TransactionType
service
=
types
.
get
(
"PigeonService"
);
if
(
service
==
null
)
{
service
=
types
.
get
(
"Service"
);
}
if
(
service
!=
null
)
{
BaseInfo
serviceBaseInfo
=
buildBaseInfo
(
service
);
Service
temp
=
new
Service
();
...
...
@@ -372,7 +375,10 @@ public class HealthReportCreator {
m_healthReport
.
setService
(
temp
);
}
TransactionType
call
=
types
.
get
(
"Call"
);
TransactionType
call
=
types
.
get
(
"PigeonCall"
);
if
(
call
==
null
)
{
call
=
types
.
get
(
"Call"
);
}
if
(
call
!=
null
)
{
BaseInfo
callBaseInfo
=
buildBaseInfo
(
call
);
Call
temp
=
new
Call
();
...
...
cat-home/src/main/java/com/dianping/cat/report/view/NavigationBar.java
浏览文件 @
61f01af6
...
...
@@ -31,14 +31,13 @@ public class NavigationBar {
ReportPage
.
TASK
,
ReportPage
.
LOGVIEW
,
ReportPage
.
DATABASE
,
ReportPage
.
HEALTH
,
ReportPage
.
MONTHREPORT
ReportPage
.
MONTHREPORT
,
ReportPage
.
LOGVIEW
};
}
}
cat-home/src/test/java/com/dianping/cat/demo/TestSendMessage.java
浏览文件 @
61f01af6
...
...
@@ -9,6 +9,14 @@ import com.dianping.cat.message.Transaction;
public
class
TestSendMessage
{
@Test
public
void
sendException
()
throws
Exception
{
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
Cat
.
getProducer
().
logError
(
new
OutOfMemoryError
());
}
Thread
.
sleep
(
1000
);
}
@Test
public
void
sendSendUrlErrorMessage
()
throws
Exception
{
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录