Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
6109ef9a
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,发现更多精彩内容 >>
提交
6109ef9a
编写于
3月 29, 2012
作者:
F
Frankie Wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
model service output filter
上级
1a917a49
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
138 addition
and
23 deletion
+138
-23
cat-consumer/pom.xml
cat-consumer/pom.xml
+1
-1
cat-consumer/src/main/resources/META-INF/plexus/components.xml
...onsumer/src/main/resources/META-INF/plexus/components.xml
+1
-1
cat-core/pom.xml
cat-core/pom.xml
+1
-1
cat-core/src/main/java/com/dianping/cat/configuration/NetworkInterfaceManager.java
...m/dianping/cat/configuration/NetworkInterfaceManager.java
+55
-0
cat-home/pom.xml
cat-home/pom.xml
+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
+34
-4
cat-home/src/main/java/com/dianping/cat/report/page/model/Payload.java
...main/java/com/dianping/cat/report/page/model/Payload.java
+35
-12
cat-home/src/main/java/com/dianping/cat/report/page/problem/Handler.java
...in/java/com/dianping/cat/report/page/problem/Handler.java
+1
-1
cat-home/src/test/java/com/dianping/cat/AllTests.java
cat-home/src/test/java/com/dianping/cat/AllTests.java
+7
-0
cat-job/pom.xml
cat-job/pom.xml
+1
-1
pom.xml
pom.xml
+1
-1
未找到文件。
cat-consumer/pom.xml
浏览文件 @
6109ef9a
...
...
@@ -30,7 +30,7 @@
<plugin>
<groupId>
com.site.maven.plugins
</groupId>
<artifactId>
maven-codegen-plugin
</artifactId>
<version>
1.0.1
4
</version>
<version>
1.0.1
5
</version>
<executions>
<execution>
<id>
generate problem report model
</id>
...
...
cat-consumer/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
6109ef9a
...
...
@@ -4,7 +4,7 @@
<role>
com.dianping.cat.consumer.AnalyzerFactory
</role>
<implementation>
com.dianping.cat.consumer.DefaultAnalyzerFactory
</implementation>
<configuration>
<local>
fals
e
</local>
<local>
tru
e
</local>
</configuration>
</component>
<component>
...
...
cat-core/pom.xml
浏览文件 @
6109ef9a
...
...
@@ -39,7 +39,7 @@
<plugin>
<groupId>
com.site.maven.plugins
</groupId>
<artifactId>
maven-codegen-plugin
</artifactId>
<version>
1.0.1
3
</version>
<version>
1.0.1
5
</version>
<executions>
<execution>
<id>
generate configuration model
</id>
...
...
cat-core/src/main/java/com/dianping/cat/configuration/NetworkInterfaceManager.java
0 → 100644
浏览文件 @
6109ef9a
package
com.dianping.cat.configuration
;
import
java.net.Inet4Address
;
import
java.net.InetAddress
;
import
java.net.NetworkInterface
;
import
java.net.SocketException
;
import
java.util.Collections
;
import
java.util.List
;
public
enum
NetworkInterfaceManager
{
INSTANCE
;
private
InetAddress
m_local
;
private
NetworkInterfaceManager
()
{
load
();
}
private
void
load
()
{
try
{
List
<
NetworkInterface
>
nis
=
Collections
.
list
(
NetworkInterface
.
getNetworkInterfaces
());
InetAddress
local
=
null
;
for
(
NetworkInterface
ni
:
nis
)
{
if
(
ni
.
isUp
())
{
List
<
InetAddress
>
addresses
=
Collections
.
list
(
ni
.
getInetAddresses
());
for
(
InetAddress
address
:
addresses
)
{
if
(
address
instanceof
Inet4Address
)
{
if
(
address
.
isLoopbackAddress
()
||
address
.
isSiteLocalAddress
())
{
if
(
local
==
null
)
{
local
=
address
;
}
else
if
(
local
.
isLoopbackAddress
()
&&
address
.
isSiteLocalAddress
())
{
local
=
address
;
}
}
}
}
}
}
m_local
=
local
;
}
catch
(
SocketException
e
)
{
e
.
printStackTrace
();
}
}
public
String
getLocalHostName
()
{
return
m_local
.
getCanonicalHostName
();
}
public
String
getLocalHostAddress
()
{
return
m_local
.
getHostAddress
();
}
}
cat-home/pom.xml
浏览文件 @
6109ef9a
...
...
@@ -89,7 +89,7 @@
<plugin>
<groupId>
com.site.maven.plugins
</groupId>
<artifactId>
maven-codegen-plugin
</artifactId>
<version>
1.0.1
2
</version>
<version>
1.0.1
5
</version>
<executions>
<execution>
<id>
generate plexus component descriptor
</id>
...
...
cat-home/src/main/java/com/dianping/cat/report/page/model/Handler.java
浏览文件 @
6109ef9a
...
...
@@ -6,12 +6,13 @@ import javax.servlet.ServletException;
import
com.dianping.cat.consumer.event.model.entity.EventName
;
import
com.dianping.cat.consumer.event.model.entity.EventType
;
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
;
import
com.dianping.cat.consumer.transaction.model.entity.Duration
;
import
com.dianping.cat.consumer.transaction.model.entity.Range
;
import
com.dianping.cat.consumer.transaction.model.entity.TransactionName
;
import
com.dianping.cat.consumer.transaction.model.entity.TransactionType
;
import
com.dianping.cat.consumer.transaction.model.transform.DefaultXmlBuilder
;
import
com.dianping.cat.report.ReportPage
;
import
com.dianping.cat.report.page.model.event.LocalEventService
;
import
com.dianping.cat.report.page.model.logview.LocalLogViewService
;
...
...
@@ -55,7 +56,7 @@ public class Handler extends ContainerHolder implements PageHandler<Context> {
return
filter
.
buildXml
((
com
.
dianping
.
cat
.
consumer
.
event
.
model
.
IEntity
<?>)
dataModel
);
}
else
if
(
"problem"
.
equals
(
report
))
{
ProblemReportFilter
filter
=
new
ProblemReportFilter
();
ProblemReportFilter
filter
=
new
ProblemReportFilter
(
payload
.
getIpAddress
(),
payload
.
getThreadId
()
);
return
filter
.
buildXml
((
com
.
dianping
.
cat
.
consumer
.
problem
.
model
.
IEntity
<?>)
dataModel
);
}
else
{
...
...
@@ -152,10 +153,39 @@ public class Handler extends ContainerHolder implements PageHandler<Context> {
}
static
class
ProblemReportFilter
extends
com
.
dianping
.
cat
.
consumer
.
problem
.
model
.
transform
.
DefaultXmlBuilder
{
// TODO
private
String
m_ipAddress
;
private
String
m_threadId
;
public
ProblemReportFilter
(
String
ipAddress
,
String
threadId
)
{
m_ipAddress
=
ipAddress
;
m_threadId
=
threadId
;
}
@Override
public
void
visitMachine
(
Machine
machine
)
{
if
(
m_ipAddress
==
null
)
{
super
.
visitMachine
(
machine
);
}
else
if
(
machine
.
getIp
().
equals
(
m_ipAddress
))
{
super
.
visitMachine
(
machine
);
}
else
{
// skip it
}
}
@Override
public
void
visitThread
(
JavaThread
thread
)
{
if
(
m_threadId
==
null
)
{
super
.
visitThread
(
thread
);
}
else
if
(
thread
.
getId
().
equals
(
m_threadId
))
{
super
.
visitThread
(
thread
);
}
else
{
// skip it
}
}
}
static
class
TransactionReportFilter
extends
DefaultXmlBuilder
{
static
class
TransactionReportFilter
extends
com
.
dianping
.
cat
.
consumer
.
transaction
.
model
.
transform
.
DefaultXmlBuilder
{
private
String
m_type
;
private
String
m_name
;
...
...
cat-home/src/main/java/com/dianping/cat/report/page/model/Payload.java
浏览文件 @
6109ef9a
...
...
@@ -19,9 +19,16 @@ public class Payload implements ActionPayload<ReportPage, Action> {
@FieldMeta
(
"type"
)
private
String
m_type
;
@FieldMeta
(
"name"
)
private
String
m_name
;
@FieldMeta
(
"ip"
)
private
String
m_ipAddress
;
@FieldMeta
(
"thread"
)
private
String
m_threadId
;
@Override
public
Action
getAction
()
{
return
m_action
;
...
...
@@ -35,6 +42,14 @@ public class Payload implements ActionPayload<ReportPage, Action> {
}
}
public
String
getIpAddress
()
{
return
m_ipAddress
;
}
public
String
getName
()
{
return
m_name
;
}
@Override
public
ReportPage
getPage
()
{
return
m_page
;
...
...
@@ -56,10 +71,26 @@ public class Payload implements ActionPayload<ReportPage, Action> {
}
}
public
String
getThreadId
()
{
return
m_threadId
;
}
public
String
getType
()
{
return
m_type
;
}
public
void
setAction
(
String
action
)
{
m_action
=
Action
.
getByName
(
action
,
Action
.
XML
);
}
public
void
setIpAddress
(
String
ipAddress
)
{
m_ipAddress
=
ipAddress
;
}
public
void
setName
(
String
name
)
{
m_name
=
name
;
}
@Override
public
void
setPage
(
String
page
)
{
m_page
=
ReportPage
.
getByName
(
page
,
ReportPage
.
MODEL
);
...
...
@@ -69,21 +100,13 @@ public class Payload implements ActionPayload<ReportPage, Action> {
m_path
=
path
;
}
public
String
getType
(
)
{
return
m_type
;
public
void
setThreadId
(
String
threadId
)
{
m_threadId
=
threadId
;
}
public
void
setType
(
String
type
)
{
m_type
=
type
;
}
public
String
getName
()
{
return
m_name
;
}
public
void
setName
(
String
name
)
{
m_name
=
name
;
}
m_type
=
type
;
}
@Override
public
void
validate
(
ActionContext
<?>
ctx
)
{
...
...
cat-home/src/main/java/com/dianping/cat/report/page/problem/Handler.java
浏览文件 @
6109ef9a
...
...
@@ -63,7 +63,7 @@ public class Handler implements PageHandler<Context> {
ModelRequest
request
=
new
ModelRequest
(
domain
,
payload
.
getPeriod
())
//
.
setProperty
(
"date"
,
date
)
//
.
setProperty
(
"ip"
,
payload
.
getIpAddress
())
//
.
setProperty
(
"thread"
,
payload
.
get
IpAddress
());
.
setProperty
(
"thread"
,
payload
.
get
ThreadId
());
if
(
m_service
.
isEligable
(
request
))
{
ModelResponse
<
ProblemReport
>
response
=
m_service
.
invoke
(
request
);
...
...
cat-home/src/test/java/com/dianping/cat/AllTests.java
浏览文件 @
6109ef9a
...
...
@@ -5,6 +5,8 @@ import org.junit.runners.Suite;
import
org.junit.runners.Suite.SuiteClasses
;
import
com.dianping.cat.report.page.ip.DisplayModelTest
;
import
com.dianping.cat.report.page.model.EventReportFilterTest
;
import
com.dianping.cat.report.page.model.TransactionReportFilterTest
;
import
com.dianping.cat.report.page.transaction.TransactionReportMergerTest
;
@RunWith
(
Suite
.
class
)
...
...
@@ -13,6 +15,11 @@ import com.dianping.cat.report.page.transaction.TransactionReportMergerTest;
/* .report.page.ip */
DisplayModelTest
.
class
,
/* .report.page.model */
EventReportFilterTest
.
class
,
TransactionReportFilterTest
.
class
,
/* .report.page.transaction */
TransactionReportMergerTest
.
class
...
...
cat-job/pom.xml
浏览文件 @
6109ef9a
...
...
@@ -85,7 +85,7 @@
<manifest>
<addClasspath>
true
</addClasspath>
<classpathPrefix>
lib/
</classpathPrefix>
<mainClass>
com.dianping.cat.job.
job.BrowserAnalyzer
</mainClass>
<mainClass>
com.dianping.cat.job.
sql.SqlJobMain
</mainClass>
</manifest>
</archive>
</configuration>
...
...
pom.xml
浏览文件 @
6109ef9a
...
...
@@ -63,7 +63,7 @@
<dependency>
<groupId>
com.site.dal
</groupId>
<artifactId>
dal-jdbc
</artifactId>
<version>
1.0.
1
</version>
<version>
1.0.
2
</version>
</dependency>
<dependency>
<groupId>
com.site.app
</groupId>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录