Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
2c551c7b
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,发现更多精彩内容 >>
提交
2c551c7b
编写于
6月 27, 2012
作者:
Y
You Yong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify the heartbeat
上级
499621ee
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
52 addition
and
18 deletion
+52
-18
cat-consumer/src/main/resources/META-INF/dal/model/heartbeat-report-model.xml
...n/resources/META-INF/dal/model/heartbeat-report-model.xml
+7
-7
cat-core/src/main/java/com/dianping/cat/Cat.java
cat-core/src/main/java/com/dianping/cat/Cat.java
+1
-0
cat-core/src/main/java/com/dianping/cat/message/internal/DefaultMessageManager.java
.../dianping/cat/message/internal/DefaultMessageManager.java
+5
-1
cat-core/src/main/java/com/dianping/cat/message/io/InMemoryQueue.java
.../main/java/com/dianping/cat/message/io/InMemoryQueue.java
+1
-1
cat-core/src/main/java/com/dianping/cat/message/io/InMemorySender.java
...main/java/com/dianping/cat/message/io/InMemorySender.java
+1
-0
cat-home/src/main/java/com/dianping/cat/report/page/heartbeat/Handler.java
.../java/com/dianping/cat/report/page/heartbeat/Handler.java
+1
-1
cat-home/src/main/java/com/dianping/cat/report/page/model/Handler.java
...main/java/com/dianping/cat/report/page/model/Handler.java
+36
-8
未找到文件。
cat-consumer/src/main/resources/META-INF/dal/model/heartbeat-report-model.xml
浏览文件 @
2c551c7b
...
...
@@ -22,20 +22,20 @@
<attribute
name=
"pigeon-thread-count"
value-type=
"int"
primitive=
"true"
/>
<attribute
name=
"new-gc-count"
value-type=
"long"
primitive=
"true"
/>
<attribute
name=
"old-gc-count"
value-type=
"long"
primitive=
"true"
/>
<attribute
name=
"memory-free"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"heap-usage"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"none-heap-usage"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"memory-free"
value-type=
"double"
primitive=
"true"
format=
"0.0"
/>
<attribute
name=
"heap-usage"
value-type=
"double"
primitive=
"true"
format=
"0.0"
/>
<attribute
name=
"none-heap-usage"
value-type=
"double"
primitive=
"true"
format=
"0.0"
/>
<attribute
name=
"system-load-average"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"cat-message-produced"
value-type=
"long"
primitive=
"true"
/>
<attribute
name=
"cat-message-overflow"
value-type=
"long"
primitive=
"true"
/>
<attribute
name=
"cat-message-size"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"cat-message-size"
value-type=
"double"
primitive=
"true"
format=
"0.0"
/>
<entity-ref
name=
"disk"
type=
"list"
names=
"disks"
/>
</entity>
<entity
name=
"disk"
>
<attribute
name=
"path"
value-type=
"String"
key=
"true"
/>
<attribute
name=
"total"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"free"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"usable"
value-type=
"double"
primitive=
"true"
/>
<attribute
name=
"total"
value-type=
"double"
primitive=
"true"
format=
"0.0"
/>
<attribute
name=
"free"
value-type=
"double"
primitive=
"true"
format=
"0.0"
/>
<attribute
name=
"usable"
value-type=
"double"
primitive=
"true"
format=
"0.0"
/>
</entity>
</model>
...
...
cat-core/src/main/java/com/dianping/cat/Cat.java
浏览文件 @
2c551c7b
...
...
@@ -57,6 +57,7 @@ public class Cat {
public
static
MessageProducer
getProducer
()
{
if
(!
isInitialized
())
{
initializeForDev
();
System
.
out
.
println
(
">>>>>>>>>>>>>>>>>>> for Dev"
);
}
return
getInstance
().
m_producer
;
...
...
cat-core/src/main/java/com/dianping/cat/message/internal/DefaultMessageManager.java
浏览文件 @
2c551c7b
...
...
@@ -221,10 +221,14 @@ public class DefaultMessageManager extends ContainerHolder implements MessageMan
}
boolean
shouldThrottle
(
MessageTree
tree
)
{
if
(!
isCatEnabled
()){
return
true
;
}
if
(
tree
.
getMessage
()
!=
null
&&
"Heartbeat"
.
equals
(
tree
.
getMessage
().
getName
()))
{
return
false
;
}
int
threadCount
=
ManagementFactory
.
getThreadMXBean
().
getThreadCount
();
return
threadCount
>
m_domain
.
getMaxThreads
();
...
...
cat-core/src/main/java/com/dianping/cat/message/io/InMemoryQueue.java
浏览文件 @
2c551c7b
...
...
@@ -26,7 +26,7 @@ public class InMemoryQueue implements LogEnabled, Initializable {
@Override
public
void
initialize
()
throws
InitializationException
{
if
(
m_queueSize
<=
0
)
{
m_queue
=
new
LinkedBlockingQueue
<
MessageTree
>();
m_queue
=
new
LinkedBlockingQueue
<
MessageTree
>(
1000
);
}
else
{
m_queue
=
new
LinkedBlockingQueue
<
MessageTree
>(
m_queueSize
);
}
...
...
cat-core/src/main/java/com/dianping/cat/message/io/InMemorySender.java
浏览文件 @
2c551c7b
...
...
@@ -31,6 +31,7 @@ public class InMemorySender implements MessageSender {
}
public
void
setQueue
(
InMemoryQueue
queue
)
{
System
.
out
.
println
(
"sdfsdf"
);
m_queue
=
queue
;
}
...
...
cat-home/src/main/java/com/dianping/cat/report/page/heartbeat/Handler.java
浏览文件 @
2c551c7b
...
...
@@ -71,7 +71,7 @@ public class Handler implements PageHandler<Context> {
String
domain
=
payload
.
getDomain
();
String
date
=
String
.
valueOf
(
payload
.
getDate
());
ModelRequest
request
=
new
ModelRequest
(
domain
,
payload
.
getPeriod
())
//
.
setProperty
(
"date"
,
date
);
.
setProperty
(
"date"
,
date
)
.
setProperty
(
"ip"
,
payload
.
getIpAddress
())
;
if
(
m_service
.
isEligable
(
request
))
{
ModelResponse
<
HeartbeatReport
>
response
=
m_service
.
invoke
(
request
);
...
...
cat-home/src/main/java/com/dianping/cat/report/page/model/Handler.java
浏览文件 @
2c551c7b
package
com.dianping.cat.report.page.model
;
import
java.io.IOException
;
import
java.util.Set
;
import
javax.servlet.ServletException
;
...
...
@@ -8,6 +9,7 @@ import org.apache.commons.lang.StringUtils;
import
com.dianping.cat.consumer.event.model.entity.EventName
;
import
com.dianping.cat.consumer.event.model.entity.EventType
;
import
com.dianping.cat.consumer.heartbeat.model.entity.HeartbeatReport
;
import
com.dianping.cat.consumer.problem.model.entity.JavaThread
;
import
com.dianping.cat.consumer.problem.model.entity.Machine
;
import
com.dianping.cat.consumer.transaction.model.IEntity
;
...
...
@@ -27,6 +29,7 @@ import com.dianping.cat.report.page.model.spi.ModelRequest;
import
com.dianping.cat.report.page.model.spi.ModelResponse
;
import
com.dianping.cat.report.page.model.spi.ModelService
;
import
com.dianping.cat.report.page.model.transaction.LocalTransactionService
;
import
com.dianping.cat.report.view.StringSortHelper
;
import
com.site.lookup.ContainerHolder
;
import
com.site.lookup.annotation.Inject
;
import
com.site.web.mvc.PageHandler
;
...
...
@@ -58,20 +61,30 @@ public class Handler extends ContainerHolder implements PageHandler<Context> {
private
String
doFilter
(
Payload
payload
,
Object
dataModel
)
{
String
report
=
payload
.
getReport
();
String
ipAddress
=
payload
.
getIpAddress
();
if
(
"transaction"
.
equals
(
report
))
{
TransactionReportFilter
filter
=
new
TransactionReportFilter
(
payload
.
getType
(),
payload
.
getName
(),
payload
.
getIpAddress
());
TransactionReportFilter
filter
=
new
TransactionReportFilter
(
payload
.
getType
(),
payload
.
getName
(),
ipAddress
);
return
filter
.
buildXml
((
IEntity
<?>)
dataModel
);
}
else
if
(
"event"
.
equals
(
report
))
{
EventReportFilter
filter
=
new
EventReportFilter
(
payload
.
getType
(),
payload
.
getName
(),
payload
.
getIpAddress
()
);
EventReportFilter
filter
=
new
EventReportFilter
(
payload
.
getType
(),
payload
.
getName
(),
ipAddress
);
return
filter
.
buildXml
((
com
.
dianping
.
cat
.
consumer
.
event
.
model
.
IEntity
<?>)
dataModel
);
}
else
if
(
"problem"
.
equals
(
report
))
{
ProblemReportFilter
filter
=
new
ProblemReportFilter
(
payload
.
getIpAddress
()
,
payload
.
getThreadId
());
ProblemReportFilter
filter
=
new
ProblemReportFilter
(
ipAddress
,
payload
.
getThreadId
());
return
filter
.
buildXml
((
com
.
dianping
.
cat
.
consumer
.
problem
.
model
.
IEntity
<?>)
dataModel
);
}
else
if
(
"heartbeat"
.
equals
(
report
))
{
if
(
StringUtils
.
isEmpty
(
ipAddress
))
{
HeartbeatReport
reportModel
=
(
HeartbeatReport
)
dataModel
;
Set
<
String
>
ips
=
reportModel
.
getIps
();
if
(
ips
.
size
()
>
0
)
{
ipAddress
=
StringSortHelper
.
sort
(
ips
).
get
(
0
);
}
}
HeartBeatReportFilter
filter
=
new
HeartBeatReportFilter
(
ipAddress
);
return
filter
.
buildXml
((
com
.
dianping
.
cat
.
consumer
.
heartbeat
.
model
.
IEntity
<?>)
dataModel
);
}
else
{
return
String
.
valueOf
(
dataModel
);
}
...
...
@@ -257,10 +270,10 @@ public class Handler extends ContainerHolder implements PageHandler<Context> {
}
@Override
public
void
visitAllDuration
(
AllDuration
duration
){
public
void
visitAllDuration
(
AllDuration
duration
)
{
}
@Override
public
void
visitName
(
TransactionName
name
)
{
if
(
m_type
==
null
)
{
...
...
@@ -295,4 +308,19 @@ public class Handler extends ContainerHolder implements PageHandler<Context> {
}
}
}
static
class
HeartBeatReportFilter
extends
com
.
dianping
.
cat
.
consumer
.
heartbeat
.
model
.
transform
.
DefaultXmlBuilder
{
private
String
m_ip
;
public
HeartBeatReportFilter
(
String
ip
)
{
m_ip
=
ip
;
}
@Override
public
void
visitMachine
(
com
.
dianping
.
cat
.
consumer
.
heartbeat
.
model
.
entity
.
Machine
machine
)
{
if
(
machine
.
getIp
().
equals
(
m_ip
))
{
super
.
visitMachine
(
machine
);
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录