Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
29fc6ed9
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,发现更多精彩内容 >>
提交
29fc6ed9
编写于
10月 24, 2014
作者:
Y
youyong205
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #571 from jialinsun/master
develop milestone for cross report
上级
6c84f3e7
d70cbb41
变更
29
隐藏空白更改
内联
并排
Showing
29 changed file
with
705 addition
and
218 deletion
+705
-218
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/build/ComponentsConfigurator.java
...m/dianping/cat/consumer/build/ComponentsConfigurator.java
+1
-1
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/cross/CrossAnalyzer.java
...n/java/com/dianping/cat/consumer/cross/CrossAnalyzer.java
+74
-12
cat-consumer-advanced/src/main/resources/META-INF/dal/model/cross-report-model.xml
.../main/resources/META-INF/dal/model/cross-report-model.xml
+2
-0
cat-consumer-advanced/src/main/resources/META-INF/plexus/components.xml
...dvanced/src/main/resources/META-INF/plexus/components.xml
+3
-0
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/cross/Configurator.java
...st/java/com/dianping/cat/consumer/cross/Configurator.java
+17
-5
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/cross/CrossAnalyzerTest.java
...va/com/dianping/cat/consumer/cross/CrossAnalyzerTest.java
+17
-1
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/cross/CrossInfoTest.java
...t/java/com/dianping/cat/consumer/cross/CrossInfoTest.java
+20
-11
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/performance/CrossPerformanceTest.java
...anping/cat/consumer/performance/CrossPerformanceTest.java
+55
-14
cat-consumer-advanced/src/test/resources/com/dianping/cat/consumer/cross/cross_analyzer.xml
...ources/com/dianping/cat/consumer/cross/cross_analyzer.xml
+2
-2
cat-consumer-advanced/src/test/resources/com/dianping/cat/consumer/cross/cross_analyzer_caller.xml
...com/dianping/cat/consumer/cross/cross_analyzer_caller.xml
+12
-0
cat-consumer-advanced/src/test/resources/com/dianping/cat/consumer/cross/cross_analyzer_merger.xml
...com/dianping/cat/consumer/cross/cross_analyzer_merger.xml
+2
-2
cat-core/src/main/java/com/dianping/cat/service/DefaultReportManager.java
...n/java/com/dianping/cat/service/DefaultReportManager.java
+7
-2
cat-core/src/main/java/com/dianping/cat/service/HostinfoService.java
...c/main/java/com/dianping/cat/service/HostinfoService.java
+2
-2
cat-home/src/main/java/com/dianping/cat/report/page/cross/CrossMethodVisitor.java
...om/dianping/cat/report/page/cross/CrossMethodVisitor.java
+9
-1
cat-home/src/main/java/com/dianping/cat/report/page/cross/Handler.java
...main/java/com/dianping/cat/report/page/cross/Handler.java
+36
-30
cat-home/src/main/java/com/dianping/cat/report/page/cross/display/CrossAppSwitch.java
...ianping/cat/report/page/cross/display/CrossAppSwitch.java
+9
-0
cat-home/src/main/java/com/dianping/cat/report/page/cross/display/HostInfo.java
.../com/dianping/cat/report/page/cross/display/HostInfo.java
+47
-13
cat-home/src/main/java/com/dianping/cat/report/page/cross/display/MethodInfo.java
...om/dianping/cat/report/page/cross/display/MethodInfo.java
+49
-14
cat-home/src/main/java/com/dianping/cat/report/page/cross/display/NameComparator.java
...ianping/cat/report/page/cross/display/NameComparator.java
+2
-2
cat-home/src/main/java/com/dianping/cat/report/page/cross/display/ProjectInfo.java
...m/dianping/cat/report/page/cross/display/ProjectInfo.java
+51
-21
cat-home/src/main/java/com/dianping/cat/report/page/cross/display/TypeComparator.java
...ianping/cat/report/page/cross/display/TypeComparator.java
+2
-2
cat-home/src/main/java/com/dianping/cat/report/task/alert/sender/decorator/FrontEndExceptionDecorator.java
...sk/alert/sender/decorator/FrontEndExceptionDecorator.java
+4
-0
cat-home/src/main/webapp/jsp/report/cross/cross.jsp
cat-home/src/main/webapp/jsp/report/cross/cross.jsp
+37
-32
cat-home/src/main/webapp/jsp/report/cross/crossHistoryHost.jsp
...ome/src/main/webapp/jsp/report/cross/crossHistoryHost.jsp
+32
-5
cat-home/src/main/webapp/jsp/report/cross/crossHistoryMethod.jsp
...e/src/main/webapp/jsp/report/cross/crossHistoryMethod.jsp
+33
-4
cat-home/src/main/webapp/jsp/report/cross/crossHistoryProject.jsp
.../src/main/webapp/jsp/report/cross/crossHistoryProject.jsp
+35
-31
cat-home/src/main/webapp/jsp/report/cross/crossHost.jsp
cat-home/src/main/webapp/jsp/report/cross/crossHost.jsp
+34
-7
cat-home/src/main/webapp/jsp/report/cross/crossMethod.jsp
cat-home/src/main/webapp/jsp/report/cross/crossMethod.jsp
+33
-4
cat-home/src/test/java/com/dianping/cat/report/page/cross/CrossTest.java
...st/java/com/dianping/cat/report/page/cross/CrossTest.java
+78
-0
未找到文件。
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/build/ComponentsConfigurator.java
浏览文件 @
29fc6ed9
...
...
@@ -100,7 +100,7 @@ public class ComponentsConfigurator extends AbstractResourceConfigurator {
all
.
add
(
C
(
IpConvertManager
.
class
));
all
.
add
(
C
(
MessageAnalyzer
.
class
,
ID
,
CrossAnalyzer
.
class
).
is
(
PER_LOOKUP
)
//
.
req
(
ReportManager
.
class
,
ID
).
req
(
ServerConfigManager
.
class
,
IpConvertManager
.
class
));
.
req
(
ReportManager
.
class
,
ID
).
req
(
ServerConfigManager
.
class
,
IpConvertManager
.
class
,
HostinfoService
.
class
));
all
.
add
(
C
(
ReportManager
.
class
,
ID
,
DefaultReportManager
.
class
)
//
.
req
(
ReportDelegate
.
class
,
ID
)
//
.
req
(
BucketManager
.
class
,
HourlyReportDao
.
class
,
HourlyReportContentDao
.
class
)
//
...
...
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/cross/CrossAnalyzer.java
浏览文件 @
29fc6ed9
...
...
@@ -5,6 +5,7 @@ import java.util.List;
import
org.codehaus.plexus.logging.LogEnabled
;
import
org.codehaus.plexus.logging.Logger
;
import
org.unidal.lookup.annotation.Inject
;
import
org.unidal.tuple.Pair
;
import
com.dianping.cat.ServerConfigManager
;
import
com.dianping.cat.analysis.AbstractMessageAnalyzer
;
...
...
@@ -19,7 +20,9 @@ import com.dianping.cat.message.Transaction;
import
com.dianping.cat.message.internal.MessageId
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.service.DefaultReportManager.StoragePolicy
;
import
com.dianping.cat.service.HostinfoService
;
import
com.dianping.cat.service.ReportManager
;
import
com.site.lookup.util.StringUtils
;
public
class
CrossAnalyzer
extends
AbstractMessageAnalyzer
<
CrossReport
>
implements
LogEnabled
{
public
static
final
String
ID
=
"cross"
;
...
...
@@ -33,6 +36,9 @@ public class CrossAnalyzer extends AbstractMessageAnalyzer<CrossReport> implemen
@Inject
private
IpConvertManager
m_ipConvertManager
;
@Inject
private
HostinfoService
m_hostinfoService
;
private
static
final
String
UNKNOWN
=
"UnknownIp"
;
@Override
...
...
@@ -86,7 +92,9 @@ public class CrossAnalyzer extends AbstractMessageAnalyzer<CrossReport> implemen
if
(
message
instanceof
Event
)
{
if
(
message
.
getType
().
equals
(
"PigeonCall.server"
))
{
crossInfo
.
setRemoteAddress
(
message
.
getName
());
break
;
}
if
(
message
.
getType
().
equals
(
"PigeonCall.app"
))
{
crossInfo
.
setApp
(
message
.
getName
());
}
}
}
...
...
@@ -97,6 +105,39 @@ public class CrossAnalyzer extends AbstractMessageAnalyzer<CrossReport> implemen
return
crossInfo
;
}
public
Pair
<
String
,
CrossInfo
>
convertCrossInfo
(
String
client
,
CrossInfo
crossInfo
)
{
String
localIp
=
crossInfo
.
getLocalAddress
();
String
remoteAddress
=
crossInfo
.
getRemoteAddress
();
String
domain
=
crossInfo
.
getApp
();
if
(
StringUtils
.
isEmpty
(
domain
))
{
domain
=
m_hostinfoService
.
queryDomainByIp
(
remoteAddress
);
}
int
index
=
remoteAddress
.
indexOf
(
":"
);
if
(
index
>
0
)
{
remoteAddress
=
remoteAddress
.
substring
(
0
,
index
);
}
CrossInfo
info
=
new
CrossInfo
();
info
.
setLocalAddress
(
remoteAddress
);
info
.
setRemoteAddress
(
localIp
+
":Caller"
);
info
.
setRemoteRole
(
"Pigeon.Caller"
);
info
.
setDetailType
(
"PigeonCall"
);
info
.
setApp
(
client
);
return
new
Pair
<
String
,
CrossInfo
>(
domain
,
info
);
}
private
void
updateServerCrossReport
(
Transaction
t
,
String
domain
,
CrossInfo
info
)
{
if
(!
HostinfoService
.
UNKNOWN_PROJECT
.
equals
(
domain
))
{
CrossReport
report
=
m_reportManager
.
getHourlyReport
(
getStartTime
(),
domain
,
true
);
report
.
addIp
(
info
.
getLocalAddress
());
updateCrossReport
(
report
,
t
,
info
);
}
}
private
CrossInfo
parsePigeonServerTransaction
(
Transaction
t
,
MessageTree
tree
)
{
CrossInfo
crossInfo
=
new
CrossInfo
();
String
localIp
=
tree
.
getIpAddress
();
...
...
@@ -111,13 +152,14 @@ public class CrossAnalyzer extends AbstractMessageAnalyzer<CrossReport> implemen
if
(
index
>
0
)
{
name
=
name
.
substring
(
0
,
index
);
}
String
formatIp
=
m_ipConvertManager
.
convertHostNameToIP
(
name
);
if
(
formatIp
!=
null
&&
formatIp
.
length
()
>
0
)
{
crossInfo
.
setRemoteAddress
(
formatIp
);
}
break
;
}
if
(
message
.
getType
().
equals
(
"PigeonService.app"
))
{
crossInfo
.
setApp
(
message
.
getName
());
}
}
}
...
...
@@ -149,9 +191,15 @@ public class CrossAnalyzer extends AbstractMessageAnalyzer<CrossReport> implemen
}
private
void
processTransaction
(
CrossReport
report
,
MessageTree
tree
,
Transaction
t
)
{
CrossInfo
info
=
parseCorssTransaction
(
t
,
tree
);
if
(
info
!=
null
)
{
updateCrossReport
(
report
,
t
,
info
);
CrossInfo
crossInfo
=
parseCorssTransaction
(
t
,
tree
);
if
(
crossInfo
!=
null
)
{
updateCrossReport
(
report
,
t
,
crossInfo
);
if
(
m_serverConfigManager
.
isClientCall
(
t
.
getType
()))
{
Pair
<
String
,
CrossInfo
>
pair
=
convertCrossInfo
(
tree
.
getDomain
(),
crossInfo
);
updateServerCrossReport
(
t
,
pair
.
getKey
(),
pair
.
getValue
());
}
}
List
<
Message
>
children
=
t
.
getChildren
();
...
...
@@ -175,22 +223,27 @@ public class CrossAnalyzer extends AbstractMessageAnalyzer<CrossReport> implemen
m_serverConfigManager
=
serverConfigManager
;
}
public
void
setHostinfoService
(
HostinfoService
hostinfoService
)
{
m_hostinfoService
=
hostinfoService
;
}
private
void
updateCrossReport
(
CrossReport
report
,
Transaction
t
,
CrossInfo
info
)
{
String
localIp
=
info
.
getLocalAddress
();
String
remoteIp
=
info
.
getRemoteAddress
();
String
role
=
info
.
getRemoteRole
();
String
transactionName
=
t
.
getName
();
Local
client
=
report
.
findOrCreateLocal
(
localIp
);
Remote
server
=
client
.
findOrCreateRemote
(
remoteIp
);
Local
local
=
report
.
findOrCreateLocal
(
localIp
);
Remote
remote
=
local
.
findOrCreateRemote
(
remoteIp
);
server
.
setRole
(
role
);
remote
.
setRole
(
role
);
remote
.
setApp
(
info
.
getApp
());
Type
type
=
server
.
getType
();
Type
type
=
remote
.
getType
();
if
(
type
==
null
)
{
type
=
new
Type
();
type
.
setId
(
info
.
getDetailType
());
server
.
setType
(
type
);
remote
.
setType
(
type
);
}
Name
name
=
type
.
findOrCreateName
(
transactionName
);
...
...
@@ -217,6 +270,8 @@ public class CrossAnalyzer extends AbstractMessageAnalyzer<CrossReport> implemen
private
String
m_detailType
=
UNKNOWN
;
private
String
m_app
=
""
;
public
String
getDetailType
()
{
return
m_detailType
;
}
...
...
@@ -233,6 +288,10 @@ public class CrossAnalyzer extends AbstractMessageAnalyzer<CrossReport> implemen
return
m_remoteRole
;
}
public
String
getApp
()
{
return
m_app
;
}
public
void
setDetailType
(
String
detailType
)
{
m_detailType
=
detailType
;
}
...
...
@@ -248,6 +307,9 @@ public class CrossAnalyzer extends AbstractMessageAnalyzer<CrossReport> implemen
public
void
setRemoteRole
(
String
remoteRole
)
{
m_remoteRole
=
remoteRole
;
}
}
public
void
setApp
(
String
app
)
{
m_app
=
app
;
}
}
}
cat-consumer-advanced/src/main/resources/META-INF/dal/model/cross-report-model.xml
浏览文件 @
29fc6ed9
...
...
@@ -13,6 +13,8 @@
</entity>
<entity
name=
"remote"
>
<attribute
name=
"id"
value-type=
"String"
key=
"true"
/>
<attribute
name=
"role"
value-type=
"String"
/>
<attribute
name=
"app"
value-type=
"String"
/>
<entity-ref
name=
"type"
/>
</entity>
<entity
name=
"type"
>
...
...
cat-consumer-advanced/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
29fc6ed9
...
...
@@ -20,6 +20,9 @@
<requirement>
<role>
com.dianping.cat.consumer.cross.IpConvertManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.service.HostinfoService
</role>
</requirement>
</requirements>
</component>
<component>
...
...
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/cross/Configurator.java
浏览文件 @
29fc6ed9
package
com.dianping.cat.consumer.cross
;
import
static
com
.
dianping
.
cat
.
Constants
.
HOUR
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
org.unidal.lookup.annotation.Inject
;
import
org.unidal.lookup.configuration.AbstractResourceConfigurator
;
import
org.unidal.lookup.configuration.Component
;
import
com.dianping.cat.Constants
;
import
com.dianping.cat.consumer.MockReportManager
;
import
com.dianping.cat.consumer.cross.model.entity.CrossReport
;
import
com.dianping.cat.service.ReportDelegate
;
...
...
@@ -39,18 +42,27 @@ public class Configurator extends AbstractResourceConfigurator {
}
public
static
class
MockCrossReportManager
extends
MockReportManager
<
CrossReport
>
{
private
CrossReport
m_report
;
private
Map
<
Long
,
Map
<
String
,
CrossReport
>>
m_reports
=
new
ConcurrentHashMap
<
Long
,
Map
<
String
,
CrossReport
>>();
;
@Inject
private
ReportDelegate
<
CrossReport
>
m_delegate
;
@Override
public
CrossReport
getHourlyReport
(
long
startTime
,
String
domain
,
boolean
createIfNotExist
)
{
if
(
m_report
==
null
)
{
m_report
=
(
CrossReport
)
m_delegate
.
makeReport
(
domain
,
startTime
,
Constants
.
HOUR
);
Map
<
String
,
CrossReport
>
reports
=
m_reports
.
get
(
startTime
);
if
(
reports
==
null
&&
createIfNotExist
)
{
reports
=
new
ConcurrentHashMap
<
String
,
CrossReport
>();
m_reports
.
put
(
startTime
,
reports
);
}
return
m_report
;
CrossReport
report
=
reports
.
get
(
domain
);
if
(
report
==
null
&&
createIfNotExist
)
{
report
=
m_delegate
.
makeReport
(
domain
,
startTime
,
HOUR
);
reports
.
put
(
domain
,
report
);
}
return
report
;
}
}
}
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/cross/CrossAnalyzerTest.java
浏览文件 @
29fc6ed9
...
...
@@ -52,9 +52,13 @@ public class CrossAnalyzerTest extends ComponentTestCase {
}
CrossReport
report
=
m_analyzer
.
getReport
(
m_domain
);
String
expected
=
Files
.
forIO
().
readFrom
(
getClass
().
getResourceAsStream
(
"cross_analyzer.xml"
),
"utf-8"
);
Assert
.
assertEquals
(
expected
.
replaceAll
(
"\r"
,
""
),
report
.
toString
().
replaceAll
(
"\r"
,
""
));
CrossReport
reportCaller
=
m_analyzer
.
getReport
(
"server"
);
String
expectedCaller
=
Files
.
forIO
().
readFrom
(
getClass
().
getResourceAsStream
(
"cross_analyzer_caller.xml"
),
"utf-8"
);
Assert
.
assertEquals
(
expectedCaller
.
replaceAll
(
"\r"
,
""
),
reportCaller
.
toString
().
replaceAll
(
"\r"
,
""
));
}
protected
MessageTree
generateMessageTree
(
int
i
)
{
...
...
@@ -74,6 +78,12 @@ public class CrossAnalyzerTest extends ComponentTestCase {
event
.
setTimestamp
(
m_timestamp
+
5
*
60
*
1000
);
event
.
setStatus
(
Message
.
SUCCESS
);
t
.
addChild
(
event
);
DefaultEvent
eventApp
=
new
DefaultEvent
(
"PigeonCall.app"
,
"server"
);
eventApp
.
setTimestamp
(
m_timestamp
+
5
*
60
*
1000
+
100
);
eventApp
.
setStatus
(
Message
.
SUCCESS
);
t
.
addChild
(
eventApp
);
}
else
{
t
=
new
DefaultTransaction
(
"PigeonService"
,
"Cat-Test-Service"
,
null
);
DefaultEvent
event
=
new
DefaultEvent
(
"PigeonService.client"
,
"192.168.1.2:3000:class:method2"
);
...
...
@@ -81,6 +91,12 @@ public class CrossAnalyzerTest extends ComponentTestCase {
event
.
setTimestamp
(
m_timestamp
+
5
*
60
*
1000
);
event
.
setStatus
(
Message
.
SUCCESS
);
t
.
addChild
(
event
);
DefaultEvent
eventApp
=
new
DefaultEvent
(
"PigeonService.app"
,
"client"
);
eventApp
.
setTimestamp
(
m_timestamp
+
5
*
60
*
1000
+
100
);
eventApp
.
setStatus
(
Message
.
SUCCESS
);
t
.
addChild
(
eventApp
);
}
t
.
complete
();
...
...
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/cross/CrossInfoTest.java
浏览文件 @
29fc6ed9
...
...
@@ -14,7 +14,7 @@ import com.dianping.cat.message.internal.DefaultTransaction;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.internal.DefaultMessageTree
;
public
class
CrossInfoTest
extends
ComponentTestCase
{
public
class
CrossInfoTest
extends
ComponentTestCase
{
public
MessageTree
buildMockMessageTree
()
{
MessageTree
tree
=
new
DefaultMessageTree
();
tree
.
setMessageId
(
"Cat-c0a80746-373452-6"
);
// 192.168.7.70 machine logview
...
...
@@ -24,11 +24,11 @@ public class CrossInfoTest extends ComponentTestCase{
@Test
public
void
testParseOtherTransaction
()
throws
Exception
{
CrossAnalyzer
analyzer
=
new
CrossAnalyzer
();
CrossAnalyzer
analyzer
=
new
CrossAnalyzer
();
analyzer
.
setServerConfigManager
(
lookup
(
ServerConfigManager
.
class
));
analyzer
.
setIpConvertManager
(
new
IpConvertManager
());
DefaultTransaction
t
=
new
DefaultTransaction
(
"Other"
,
"method1"
,
null
);
MessageTree
tree
=
buildMockMessageTree
();
CrossInfo
info
=
analyzer
.
parseCorssTransaction
(
t
,
tree
);
...
...
@@ -38,11 +38,11 @@ public class CrossInfoTest extends ComponentTestCase{
@Test
public
void
testParsePigeonClientTransaction
()
throws
Exception
{
CrossAnalyzer
analyzer
=
new
CrossAnalyzer
();
CrossAnalyzer
analyzer
=
new
CrossAnalyzer
();
analyzer
.
setServerConfigManager
(
lookup
(
ServerConfigManager
.
class
));
analyzer
.
setIpConvertManager
(
new
IpConvertManager
());
DefaultTransaction
t
=
new
DefaultTransaction
(
"Call"
,
"method1"
,
null
);
MessageTree
tree
=
buildMockMessageTree
();
CrossInfo
info
=
analyzer
.
parseCorssTransaction
(
t
,
tree
);
...
...
@@ -51,7 +51,9 @@ public class CrossInfoTest extends ComponentTestCase{
Assert
.
assertEquals
(
info
.
getRemoteAddress
(),
"UnknownIp"
);
Message
message
=
new
DefaultEvent
(
"PigeonCall.server"
,
"10.1.1.1"
,
null
);
Message
messageApp
=
new
DefaultEvent
(
"PigeonCall.app"
,
"myDomain"
,
null
);
t
.
addChild
(
message
);
t
.
addChild
(
messageApp
);
info
=
analyzer
.
parseCorssTransaction
(
t
,
tree
);
...
...
@@ -59,15 +61,16 @@ public class CrossInfoTest extends ComponentTestCase{
Assert
.
assertEquals
(
info
.
getRemoteAddress
(),
"10.1.1.1"
);
Assert
.
assertEquals
(
info
.
getDetailType
(),
"PigeonCall"
);
Assert
.
assertEquals
(
info
.
getRemoteRole
(),
"Pigeon.Server"
);
Assert
.
assertEquals
(
info
.
getApp
(),
"myDomain"
);
}
@Test
public
void
testParsePigeonServerTransaction
()
throws
Exception
{
CrossAnalyzer
analyzer
=
new
CrossAnalyzer
();
CrossAnalyzer
analyzer
=
new
CrossAnalyzer
();
analyzer
.
setServerConfigManager
(
lookup
(
ServerConfigManager
.
class
));
analyzer
.
setIpConvertManager
(
new
IpConvertManager
());
DefaultTransaction
t
=
new
DefaultTransaction
(
"Service"
,
"method1"
,
null
);
MessageTree
tree
=
buildMockMessageTree
();
CrossInfo
info
=
analyzer
.
parseCorssTransaction
(
t
,
tree
);
...
...
@@ -76,7 +79,9 @@ public class CrossInfoTest extends ComponentTestCase{
Assert
.
assertEquals
(
info
.
getRemoteAddress
(),
"192.168.7.70"
);
Message
message
=
new
DefaultEvent
(
"PigeonService.client"
,
"192.168.7.71"
,
null
);
Message
messageApp
=
new
DefaultEvent
(
"PigeonService.app"
,
"myDomain"
,
null
);
t
.
addChild
(
message
);
t
.
addChild
(
messageApp
);
info
=
analyzer
.
parseCorssTransaction
(
t
,
tree
);
...
...
@@ -84,21 +89,24 @@ public class CrossInfoTest extends ComponentTestCase{
Assert
.
assertEquals
(
info
.
getRemoteAddress
(),
"192.168.7.71"
);
Assert
.
assertEquals
(
info
.
getDetailType
(),
"PigeonService"
);
Assert
.
assertEquals
(
info
.
getRemoteRole
(),
"Pigeon.Client"
);
Assert
.
assertEquals
(
info
.
getApp
(),
"myDomain"
);
}
@Test
public
void
testParsePigeonServerTransactionWithPort
()
throws
Exception
{
CrossAnalyzer
analyzer
=
new
CrossAnalyzer
();
CrossAnalyzer
analyzer
=
new
CrossAnalyzer
();
analyzer
.
setServerConfigManager
(
lookup
(
ServerConfigManager
.
class
));
analyzer
.
setIpConvertManager
(
new
IpConvertManager
());
DefaultTransaction
t
=
new
DefaultTransaction
(
"Service"
,
"method1"
,
null
);
MessageTree
tree
=
buildMockMessageTree
();
CrossInfo
info
=
analyzer
.
parseCorssTransaction
(
t
,
tree
);
Message
message
=
new
DefaultEvent
(
"PigeonService.client"
,
"192.168.7.71:29987"
,
null
);
Message
messageApp
=
new
DefaultEvent
(
"PigeonService.app"
,
"myDomain"
,
null
);
t
.
addChild
(
message
);
t
.
addChild
(
messageApp
);
info
=
analyzer
.
parseCorssTransaction
(
t
,
tree
);
...
...
@@ -106,5 +114,6 @@ public class CrossInfoTest extends ComponentTestCase{
Assert
.
assertEquals
(
info
.
getRemoteAddress
(),
"192.168.7.71"
);
Assert
.
assertEquals
(
info
.
getDetailType
(),
"PigeonService"
);
Assert
.
assertEquals
(
info
.
getRemoteRole
(),
"Pigeon.Client"
);
Assert
.
assertEquals
(
info
.
getApp
(),
"myDomain"
);
}
}
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/performance/CrossPerformanceTest.java
浏览文件 @
29fc6ed9
package
com.dianping.cat.consumer.performance
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
;
import
org.junit.Test
;
import
org.unidal.lookup.ComponentTestCase
;
import
com.dianping.cat.Constants
;
import
com.dianping.cat.ServerConfigManager
;
import
com.dianping.cat.consumer.MockReportManager
;
import
com.dianping.cat.consumer.cross.CrossAnalyzer
;
...
...
@@ -12,6 +18,7 @@ import com.dianping.cat.message.Message;
import
com.dianping.cat.message.internal.MockMessageBuilder
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.internal.DefaultMessageTree
;
import
com.dianping.cat.service.HostinfoService
;
public
class
CrossPerformanceTest
extends
ComponentTestCase
{
...
...
@@ -22,6 +29,7 @@ public class CrossPerformanceTest extends ComponentTestCase {
analyzer
.
setIpConvertManager
(
new
IpConvertManager
());
analyzer
.
setServerConfigManager
(
new
ServerConfigManager
());
analyzer
.
setReportManager
(
new
MockCrossReportManager
());
analyzer
.
setHostinfoService
(
new
MockHostinfoService
());
MessageTree
tree
=
buildMessage
();
...
...
@@ -32,20 +40,45 @@ public class CrossPerformanceTest extends ComponentTestCase {
analyzer
.
process
(
tree
);
}
System
.
out
.
println
(
analyzer
.
getReport
(
"cat"
));
System
.
out
.
println
(
analyzer
.
getReport
(
"server"
));
System
.
out
.
println
(
"Cost "
+
(
System
.
currentTimeMillis
()
-
current
)
/
1000
);
// cost 26
}
public
static
class
MockCrossReportManager
extends
MockReportManager
<
CrossReport
>
{
private
CrossReport
m_report
;
private
Map
<
Long
,
Map
<
String
,
CrossReport
>>
m_reports
=
new
ConcurrentHashMap
<
Long
,
Map
<
String
,
CrossReport
>>();
;
@Override
public
CrossReport
getHourlyReport
(
long
startTime
,
String
domain
,
boolean
createIfNotExist
)
{
if
(
m_report
==
null
)
{
m_report
=
new
CrossReport
(
domain
);
Map
<
String
,
CrossReport
>
reports
=
m_reports
.
get
(
startTime
);
if
(
reports
==
null
&&
createIfNotExist
)
{
reports
=
new
ConcurrentHashMap
<
String
,
CrossReport
>();
m_reports
.
put
(
startTime
,
reports
);
}
return
m_report
;
CrossReport
report
=
reports
.
get
(
domain
);
if
(
report
==
null
&&
createIfNotExist
)
{
report
=
new
CrossReport
(
domain
);
report
.
setStartTime
(
new
Date
(
startTime
));
report
.
setEndTime
(
new
Date
(
startTime
+
Constants
.
HOUR
-
1
));
reports
.
put
(
domain
,
report
);
}
return
report
;
}
}
public
static
class
MockHostinfoService
extends
HostinfoService
{
@Override
public
void
initialize
()
throws
InitializationException
{
}
@Override
public
String
queryDomainByIp
(
String
ip
)
{
return
"Cat-CatTest"
;
}
}
...
...
@@ -57,35 +90,44 @@ public class CrossPerformanceTest extends ComponentTestCase {
.
child
(
t
(
"PigeonCall"
,
"groupService:groupNoteService_1.0.0:updateNoteDraft(Integer,Integer,String,String)"
,
""
,
100
).
child
(
e
(
"PigeonCall.server"
,
"10.1.2.99:2011"
,
"Execute[34796272]"
)))
100
).
child
(
e
(
"PigeonCall.server"
,
"10.1.2.99:2011"
,
"Execute[34796272]"
)).
child
(
e
(
"PigeonCall.app"
,
"server"
,
""
)))
.
child
(
t
(
"PigeonCall"
,
"groupService:groupNoteService_1.0.1:updateNoteDraft1(Integer,Integer,String,String)"
,
""
,
100
).
child
(
e
(
"PigeonCall.server"
,
"10.1.2.199:2011"
,
"Execute[34796272]"
)))
""
,
100
).
child
(
e
(
"PigeonCall.server"
,
"10.1.2.199:2011"
,
"Execute[34796272]"
)).
child
(
e
(
"PigeonCall.app"
,
"server"
,
""
)))
.
child
(
t
(
"PigeonCall"
,
"groupService:groupNoteService_1.0.1:updateNoteDraft2(Integer,Integer,String,String)"
,
""
,
100
).
child
(
e
(
"PigeonCall.server"
,
"10.1.2.199:2011"
,
"Execute[34796272]"
)))
""
,
100
).
child
(
e
(
"PigeonCall.server"
,
"10.1.2.199:2011"
,
"Execute[34796272]"
)).
child
(
e
(
"PigeonCall.app"
,
"server"
,
""
)))
.
child
(
t
(
"PigeonCall"
,
"groupService:groupNoteService_1.0.1:updateNoteDraft3(Integer,Integer,String,String)"
,
""
,
100
).
child
(
e
(
"PigeonCall.server"
,
"lion.dianpingoa.com:2011"
,
"Execute[34796272]"
)))
""
,
100
).
child
(
e
(
"PigeonCall.server"
,
"lion.dianpingoa.com:2011"
,
"Execute[34796272]"
))
.
child
(
e
(
"PigeonCall.app"
,
"server"
,
""
)))
.
child
(
t
(
"PigeonCall"
,
"groupService:groupNoteService_1.0.1:updateNoteDraft4(Integer,Integer,String,String)"
,
""
,
100
).
child
(
e
(
"PigeonCall.server"
,
"10.1.2.199:2011"
,
"Execute[34796272]"
)))
""
,
100
).
child
(
e
(
"PigeonCall.server"
,
"10.1.2.199:2011"
,
"Execute[34796272]"
)).
child
(
e
(
"PigeonCall.app"
,
"server"
,
""
)))
.
child
(
t
(
"PigeonService"
,
"groupService:groupNoteService_1.0.1:updateNoteDraft5(Integer,Integer,String,String)"
,
""
,
100
).
child
(
e
(
"PigeonService.client"
,
"10.1.7.127:37897"
,
"Execute[34796272]"
)))
""
,
100
).
child
(
e
(
"PigeonService.client"
,
"10.1.7.127:37897"
,
"Execute[34796272]"
)).
child
(
e
(
"PigeonService.app"
,
"client"
,
""
)))
.
child
(
t
(
"PigeonService"
,
"groupService:groupNoteService_1.0.1:updateNoteDraft7(Integer,Integer,String,String)"
,
""
,
100
).
child
(
e
(
"PigeonService.client"
,
"tuangou-web01.nh:37897"
,
"Execute[34796272]"
)))
""
,
100
).
child
(
e
(
"PigeonService.client"
,
"tuangou-web01.nh:37897"
,
"Execute[34796272]"
))
.
child
(
e
(
"PigeonService.app"
,
"client"
,
""
)))
.
child
(
t
(
"PigeonService"
,
"groupService:groupNoteService_1.0.1:updateNoteD1aft6(Integer,Integer,String,String)"
,
""
,
100
).
child
(
e
(
"PigeonService1.client"
,
"cat.qa.dianpingoa.com:37897"
,
"Execute[34796272]"
)));
""
,
100
).
child
(
e
(
"PigeonService.client"
,
"cat.qa.dianpingoa.com:37897"
,
"Execute[34796272]"
)).
child
(
e
(
"PigeonService.app"
,
"client"
,
""
)));
return
t
;
}
...
...
@@ -94,7 +136,7 @@ public class CrossPerformanceTest extends ComponentTestCase {
MessageTree
tree
=
new
DefaultMessageTree
();
tree
.
setDomain
(
"cat"
);
tree
.
setHostName
(
"test"
);
tree
.
setIpAddress
(
"
test
"
);
tree
.
setIpAddress
(
"
10.10.10.1
"
);
tree
.
setThreadGroupName
(
"test"
);
tree
.
setThreadId
(
"test"
);
tree
.
setThreadName
(
"test"
);
...
...
@@ -102,5 +144,4 @@ public class CrossPerformanceTest extends ComponentTestCase {
tree
.
setMessageId
(
"MobileApi-0a01077f-379304-1362256"
);
return
tree
;
}
}
cat-consumer-advanced/src/test/resources/com/dianping/cat/consumer/cross/cross_analyzer.xml
浏览文件 @
29fc6ed9
...
...
@@ -3,12 +3,12 @@
<domain>
group
</domain>
<ip>
192.168.1.1
</ip>
<local
id=
"192.168.1.1"
>
<remote
id=
"192.168.1.2"
role=
"Pigeon.Client"
>
<remote
id=
"192.168.1.2"
role=
"Pigeon.Client"
app=
"client"
>
<type
id=
"PigeonService"
totalCount=
"50"
failCount=
"50"
failPercent=
"0.00"
avg=
"0.00"
sum=
"5000.00"
tps=
"0.00"
>
<name
id=
"Cat-Test-Service"
totalCount=
"50"
failCount=
"50"
failPercent=
"0.00"
avg=
"0.00"
sum=
"5000.00"
tps=
"0.00"
/>
</type>
</remote>
<remote
id=
"192.168.1.0:3000:class:method1"
role=
"Pigeon.Server"
>
<remote
id=
"192.168.1.0:3000:class:method1"
role=
"Pigeon.Server"
app=
"server"
>
<type
id=
"PigeonCall"
totalCount=
"50"
failCount=
"50"
failPercent=
"0.00"
avg=
"0.00"
sum=
"5100.00"
tps=
"0.00"
>
<name
id=
"Cat-Test-Call"
totalCount=
"50"
failCount=
"50"
failPercent=
"0.00"
avg=
"0.00"
sum=
"5100.00"
tps=
"0.00"
/>
</type>
...
...
cat-consumer-advanced/src/test/resources/com/dianping/cat/consumer/cross/cross_analyzer_caller.xml
0 → 100644
浏览文件 @
29fc6ed9
<?xml version="1.0" encoding="utf-8"?>
<cross-report
domain=
"server"
startTime=
"2012-01-01 00:00:00"
endTime=
"2012-01-01 00:59:59"
>
<domain>
group
</domain>
<ip>
192.168.1.0
</ip>
<local
id=
"192.168.1.0"
>
<remote
id=
"192.168.1.1:Caller"
role=
"Pigeon.Caller"
app=
"group"
>
<type
id=
"PigeonCall"
totalCount=
"50"
failCount=
"50"
failPercent=
"0.00"
avg=
"0.00"
sum=
"5100.00"
tps=
"0.00"
>
<name
id=
"Cat-Test-Call"
totalCount=
"50"
failCount=
"50"
failPercent=
"0.00"
avg=
"0.00"
sum=
"5100.00"
tps=
"0.00"
/>
</type>
</remote>
</local>
</cross-report>
cat-consumer-advanced/src/test/resources/com/dianping/cat/consumer/cross/cross_analyzer_merger.xml
浏览文件 @
29fc6ed9
...
...
@@ -3,12 +3,12 @@
<domain>
group
</domain>
<ip>
192.168.1.1
</ip>
<local
id=
"192.168.1.1"
>
<remote
id=
"192.168.1.2"
role=
"Pigeon.Client"
>
<remote
id=
"192.168.1.2"
role=
"Pigeon.Client"
app=
"client"
>
<type
id=
"PigeonService"
totalCount=
"100"
failCount=
"100"
failPercent=
"100.00"
avg=
"100.00"
sum=
"10000.00"
tps=
"0.00"
>
<name
id=
"Cat-Test-Service"
totalCount=
"100"
failCount=
"100"
failPercent=
"100.00"
avg=
"100.00"
sum=
"10000.00"
tps=
"0.00"
/>
</type>
</remote>
<remote
id=
"192.168.1.0:3000:class:method1"
role=
"Pigeon.Server"
>
<remote
id=
"192.168.1.0:3000:class:method1"
role=
"Pigeon.Server"
app=
"server"
>
<type
id=
"PigeonCall"
totalCount=
"100"
failCount=
"100"
failPercent=
"100.00"
avg=
"102.00"
sum=
"10200.00"
tps=
"0.00"
>
<name
id=
"Cat-Test-Call"
totalCount=
"100"
failCount=
"100"
failPercent=
"100.00"
avg=
"102.00"
sum=
"10200.00"
tps=
"0.00"
/>
</type>
...
...
cat-core/src/main/java/com/dianping/cat/service/DefaultReportManager.java
浏览文件 @
29fc6ed9
...
...
@@ -6,6 +6,7 @@ import java.util.ArrayList;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
...
...
@@ -28,8 +29,8 @@ import com.dianping.cat.storage.Bucket;
import
com.dianping.cat.storage.BucketManager
;
/**
* Hourly report manager by domain of one report type(such as Transaction, Event, Problem, Heartbeat etc.) produced in
*
one machine
for a couple of hours.
* Hourly report manager by domain of one report type(such as Transaction, Event, Problem, Heartbeat etc.) produced in
one machine
* for a couple of hours.
*/
public
class
DefaultReportManager
<
T
>
implements
ReportManager
<
T
>,
LogEnabled
{
@Inject
...
...
@@ -94,6 +95,10 @@ public class DefaultReportManager<T> implements ReportManager<T>, LogEnabled {
}
}
if
(
reports
==
null
)
{
reports
=
new
LinkedHashMap
<
String
,
T
>();
}
T
report
=
reports
.
get
(
domain
);
if
(
report
==
null
&&
createIfNotExist
)
{
...
...
cat-core/src/main/java/com/dianping/cat/service/HostinfoService.java
浏览文件 @
29fc6ed9
...
...
@@ -48,9 +48,9 @@ public class HostinfoService implements Initializable, LogEnabled {
private
Map
<
String
,
Hostinfo
>
m_hostinfos
=
new
ConcurrentHashMap
<
String
,
Hostinfo
>();
p
rivate
static
final
String
UNKNOWN_IP
=
"UnknownIp"
;
p
ublic
static
final
String
UNKNOWN_IP
=
"UnknownIp"
;
p
rivate
static
final
String
UNKNOWN_PROJECT
=
"UnknownProject"
;
p
ublic
static
final
String
UNKNOWN_PROJECT
=
"UnknownProject"
;
private
static
final
String
CMDB_URL
=
"http://cmdb.dp/cmdb/device/s?q=%s&fl=app&tidy=true"
;
...
...
cat-home/src/main/java/com/dianping/cat/report/page/cross/CrossMethodVisitor.java
浏览文件 @
29fc6ed9
...
...
@@ -3,8 +3,10 @@ package com.dianping.cat.report.page.cross;
import
com.dianping.cat.consumer.cross.model.entity.Name
;
import
com.dianping.cat.consumer.cross.model.entity.Remote
;
import
com.dianping.cat.consumer.cross.model.transform.BaseVisitor
;
import
com.dianping.cat.report.page.cross.display.CrossAppSwitch
;
import
com.dianping.cat.report.page.cross.display.MethodQueryInfo
;
import
com.dianping.cat.service.HostinfoService
;
import
com.site.lookup.util.StringUtils
;
public
class
CrossMethodVisitor
extends
BaseVisitor
{
...
...
@@ -14,6 +16,8 @@ public class CrossMethodVisitor extends BaseVisitor {
private
String
m_method
;
private
String
m_app
;
private
MethodQueryInfo
m_info
=
new
MethodQueryInfo
();
private
HostinfoService
m_hostinfoService
;
...
...
@@ -34,12 +38,15 @@ public class CrossMethodVisitor extends BaseVisitor {
@Override
public
void
visitName
(
Name
name
)
{
String
methodName
=
name
.
getId
();
String
domain
=
m_hostinfoService
.
queryDomainByIp
(
m_remoteIp
);
String
ip
=
m_remoteIp
;
String
domain
=
m_app
;
if
(
ip
.
indexOf
(
":"
)
>
-
1
)
{
ip
=
ip
.
substring
(
0
,
ip
.
indexOf
(
":"
));
}
if
(!
CrossAppSwitch
.
switchOn
()
||
StringUtils
.
isEmpty
(
domain
))
{
domain
=
m_hostinfoService
.
queryDomainByIp
(
ip
);
}
if
(
methodName
.
indexOf
(
m_method
)
>
-
1
)
{
m_info
.
add
(
ip
,
m_currentRole
,
domain
,
methodName
,
name
);
...
...
@@ -50,6 +57,7 @@ public class CrossMethodVisitor extends BaseVisitor {
public
void
visitRemote
(
Remote
remote
)
{
m_remoteIp
=
remote
.
getId
();
m_currentRole
=
remote
.
getRole
();
m_app
=
remote
.
getApp
();
super
.
visitRemote
(
remote
);
}
...
...
cat-home/src/main/java/com/dianping/cat/report/page/cross/Handler.java
浏览文件 @
29fc6ed9
...
...
@@ -149,20 +149,23 @@ public class Handler implements PageHandler<Context> {
if
(
payload
.
getIpAddress
().
equals
(
Constants
.
ALL
))
{
List
<
TypeDetailInfo
>
details
=
projectInfo
.
getServiceProjectsInfo
();
for
(
TypeDetailInfo
info
:
details
)
{
String
projectName
=
info
.
getProjectName
();
if
(
projectName
.
equalsIgnoreCase
(
payload
.
getDomain
())
||
projectName
.
equalsIgnoreCase
(
"UnknownProject"
)
||
projectName
.
equalsIgnoreCase
(
ProjectInfo
.
ALL_CLIENT
))
{
continue
;
}
ProjectInfo
temp
=
buildCallProjectInfo
(
projectName
,
payload
.
getPeriod
(),
String
.
valueOf
(
payload
.
getDate
()),
payload
.
getHourDuration
());
TypeDetailInfo
detail
=
temp
.
getAllCallProjectInfo
().
get
(
domain
);
if
(
detail
!=
null
)
{
detail
.
setProjectName
(
projectName
);
projectInfo
.
addAllCallProjectInfo
(
projectName
,
detail
);
if
(
projectInfo
.
getCallerProjectsInfo
().
isEmpty
())
{
for
(
TypeDetailInfo
info
:
details
)
{
String
projectName
=
info
.
getProjectName
();
if
(
projectName
.
equalsIgnoreCase
(
payload
.
getDomain
())
||
projectName
.
equalsIgnoreCase
(
"UnknownProject"
)
||
projectName
.
equalsIgnoreCase
(
ProjectInfo
.
ALL_CLIENT
))
{
continue
;
}
ProjectInfo
temp
=
buildCallProjectInfo
(
projectName
,
payload
.
getPeriod
(),
String
.
valueOf
(
payload
.
getDate
()),
payload
.
getHourDuration
());
TypeDetailInfo
detail
=
temp
.
getAllCallProjectInfo
().
get
(
domain
);
if
(
detail
!=
null
)
{
detail
.
setProjectName
(
projectName
);
projectInfo
.
addCallerProjectInfo
(
projectName
,
detail
);
}
}
}
}
...
...
@@ -204,22 +207,25 @@ public class Handler implements PageHandler<Context> {
if
(
payload
.
getIpAddress
().
equals
(
Constants
.
ALL
))
{
List
<
TypeDetailInfo
>
details
=
historyProjectInfo
.
getServiceProjectsInfo
();
for
(
TypeDetailInfo
info
:
details
)
{
String
projectName
=
info
.
getProjectName
();
if
(
projectName
.
equalsIgnoreCase
(
payload
.
getDomain
())
||
projectName
.
equalsIgnoreCase
(
"UnknownProject"
)
||
projectName
.
equalsIgnoreCase
(
ProjectInfo
.
ALL_CLIENT
))
{
continue
;
}
Date
start
=
payload
.
getHistoryStartDate
();
Date
end
=
payload
.
getHistoryEndDate
();
ProjectInfo
temp
=
buildHistoryCallProjectInfo
(
projectName
,
start
,
end
);
TypeDetailInfo
detail
=
temp
.
getAllCallProjectInfo
().
get
(
domain
);
if
(
detail
!=
null
)
{
detail
.
setProjectName
(
projectName
);
historyProjectInfo
.
addAllCallProjectInfo
(
projectName
,
detail
);
if
(
historyProjectInfo
.
getCallerProjectsInfo
().
isEmpty
())
{
for
(
TypeDetailInfo
info
:
details
)
{
String
projectName
=
info
.
getProjectName
();
if
(
projectName
.
equalsIgnoreCase
(
payload
.
getDomain
())
||
projectName
.
equalsIgnoreCase
(
"UnknownProject"
)
||
projectName
.
equalsIgnoreCase
(
ProjectInfo
.
ALL_CLIENT
))
{
continue
;
}
Date
start
=
payload
.
getHistoryStartDate
();
Date
end
=
payload
.
getHistoryEndDate
();
ProjectInfo
temp
=
buildHistoryCallProjectInfo
(
projectName
,
start
,
end
);
TypeDetailInfo
detail
=
temp
.
getAllCallProjectInfo
().
get
(
domain
);
if
(
detail
!=
null
)
{
detail
.
setProjectName
(
projectName
);
historyProjectInfo
.
addCallerProjectInfo
(
projectName
,
detail
);
}
}
}
}
...
...
cat-home/src/main/java/com/dianping/cat/report/page/cross/display/CrossAppSwitch.java
0 → 100644
浏览文件 @
29fc6ed9
package
com.dianping.cat.report.page.cross.display
;
public
class
CrossAppSwitch
{
public
final
static
boolean
TURN_ON
=
false
;
public
static
boolean
switchOn
()
{
return
TURN_ON
;
}
}
cat-home/src/main/java/com/dianping/cat/report/page/cross/display/HostInfo.java
浏览文件 @
29fc6ed9
...
...
@@ -13,6 +13,7 @@ import com.dianping.cat.consumer.cross.model.entity.Remote;
import
com.dianping.cat.consumer.cross.model.entity.Type
;
import
com.dianping.cat.consumer.cross.model.transform.BaseVisitor
;
import
com.dianping.cat.service.HostinfoService
;
import
com.site.lookup.util.StringUtils
;
public
class
HostInfo
extends
BaseVisitor
{
...
...
@@ -24,6 +25,8 @@ public class HostInfo extends BaseVisitor {
private
Map
<
String
,
TypeDetailInfo
>
m_serviceProjectsInfo
=
new
LinkedHashMap
<
String
,
TypeDetailInfo
>();
private
Map
<
String
,
TypeDetailInfo
>
m_callerProjectsInfo
=
new
LinkedHashMap
<
String
,
TypeDetailInfo
>();
private
String
m_callSortBy
=
"Avg"
;
private
String
m_clientIp
;
...
...
@@ -59,6 +62,26 @@ public class HostInfo extends BaseVisitor {
all
.
mergeType
(
type
);
}
private
void
addCallerProject
(
String
ip
,
Type
type
)
{
TypeDetailInfo
all
=
m_callerProjectsInfo
.
get
(
ALL_CLIENT_IP
);
if
(
all
==
null
)
{
all
=
new
TypeDetailInfo
(
m_reportDuration
);
all
.
setIp
(
ALL_CLIENT_IP
);
m_callerProjectsInfo
.
put
(
ALL_CLIENT_IP
,
all
);
}
String
realIp
=
ip
.
substring
(
0
,
ip
.
indexOf
(
":Caller"
));
TypeDetailInfo
info
=
m_callerProjectsInfo
.
get
(
realIp
);
if
(
info
==
null
)
{
info
=
new
TypeDetailInfo
(
m_reportDuration
);
info
.
setIp
(
realIp
);
m_callerProjectsInfo
.
put
(
realIp
,
info
);
}
info
.
mergeType
(
type
);
all
.
mergeType
(
type
);
}
private
void
addServiceProject
(
String
ip
,
Type
type
)
{
TypeDetailInfo
all
=
m_serviceProjectsInfo
.
get
(
ALL_CLIENT_IP
);
...
...
@@ -81,10 +104,14 @@ public class HostInfo extends BaseVisitor {
public
Collection
<
TypeDetailInfo
>
getCallProjectsInfo
()
{
List
<
TypeDetailInfo
>
values
=
new
ArrayList
<
TypeDetailInfo
>(
m_callProjectsInfo
.
values
());
Collections
.
sort
(
values
,
new
TypeCompartor
(
m_callSortBy
));
Collections
.
sort
(
values
,
new
TypeCompar
a
tor
(
m_callSortBy
));
return
values
;
}
public
Map
<
String
,
TypeDetailInfo
>
getCallerProjectsInfo
()
{
return
m_callerProjectsInfo
;
}
public
long
getReportDuration
()
{
return
m_reportDuration
;
}
...
...
@@ -92,30 +119,35 @@ public class HostInfo extends BaseVisitor {
public
List
<
TypeDetailInfo
>
getServiceProjectsInfo
()
{
List
<
TypeDetailInfo
>
values
=
new
ArrayList
<
TypeDetailInfo
>(
m_serviceProjectsInfo
.
values
());
Collections
.
sort
(
values
,
new
TypeCompartor
(
m_serviceSortBy
));
Collections
.
sort
(
values
,
new
TypeCompar
a
tor
(
m_serviceSortBy
));
return
values
;
}
public
boolean
projectContains
(
String
ip
,
String
projectName
,
String
role
)
{
public
boolean
projectContains
(
String
ip
,
String
app
,
String
projectName
,
String
role
)
{
if
(
role
.
endsWith
(
"Server"
))
{
if
(
ProjectInfo
.
ALL_SERVER
.
equals
(
projectName
))
{
return
true
;
}
}
else
if
(
role
.
endsWith
(
"Client"
))
{
}
else
if
(
role
.
endsWith
(
"Client"
)
||
role
.
endsWith
(
"Caller"
)
)
{
if
(
ProjectInfo
.
ALL_CLIENT
.
equals
(
projectName
))
{
return
true
;
}
}
if
(
ip
.
indexOf
(
':'
)
>
0
)
{
ip
=
ip
.
substring
(
0
,
ip
.
indexOf
(
':'
));
}
String
domain
=
m_hostinfoService
.
queryDomainByIp
(
ip
);
if
(
projectName
.
equalsIgnoreCase
(
domain
))
{
return
true
;
if
(
CrossAppSwitch
.
switchOn
()
&&
StringUtils
.
isNotEmpty
(
app
))
{
if
(
app
.
equalsIgnoreCase
(
projectName
))
{
return
true
;
}
}
else
{
return
false
;
if
(
ip
.
indexOf
(
':'
)
>
0
)
{
ip
=
ip
.
substring
(
0
,
ip
.
indexOf
(
':'
));
}
String
domain
=
m_hostinfoService
.
queryDomainByIp
(
ip
);
if
(
projectName
.
equalsIgnoreCase
(
domain
))
{
return
true
;
}
}
return
false
;
}
public
HostInfo
setCallSortBy
(
String
callSoryBy
)
{
...
...
@@ -158,14 +190,16 @@ public class HostInfo extends BaseVisitor {
public
void
visitRemote
(
Remote
remote
)
{
String
remoteIp
=
remote
.
getId
();
String
role
=
remote
.
getRole
();
boolean
flag
=
projectContains
(
remoteIp
,
m_projectName
,
role
);
String
app
=
remote
.
getApp
();
boolean
flag
=
projectContains
(
remoteIp
,
app
,
m_projectName
,
role
);
if
(
flag
)
{
if
(
role
!=
null
&&
role
.
endsWith
(
"Client"
))
{
addServiceProject
(
remoteIp
,
remote
.
getType
());
}
else
if
(
role
!=
null
&&
role
.
endsWith
(
"Server"
))
{
addCallProject
(
remoteIp
,
remote
.
getType
());
}
else
if
(
role
!=
null
&&
role
.
endsWith
(
"Caller"
)
&&
remoteIp
.
endsWith
(
":Caller"
))
{
addCallerProject
(
remoteIp
,
remote
.
getType
());
}
}
}
...
...
cat-home/src/main/java/com/dianping/cat/report/page/cross/display/MethodInfo.java
浏览文件 @
29fc6ed9
...
...
@@ -24,6 +24,8 @@ public class MethodInfo extends BaseVisitor {
private
Map
<
String
,
NameDetailInfo
>
m_serviceProjectsInfo
=
new
LinkedHashMap
<
String
,
NameDetailInfo
>();
private
Map
<
String
,
NameDetailInfo
>
m_callerProjectsInfo
=
new
LinkedHashMap
<
String
,
NameDetailInfo
>();
private
String
m_remoteProject
;
private
String
m_clientIp
;
...
...
@@ -66,6 +68,24 @@ public class MethodInfo extends BaseVisitor {
all
.
mergeName
(
name
);
}
private
void
addCallerProject
(
String
type
,
Name
name
)
{
String
id
=
name
.
getId
();
NameDetailInfo
all
=
m_callerProjectsInfo
.
get
(
ALL_METHOD
);
if
(
all
==
null
)
{
all
=
new
NameDetailInfo
(
m_reportDuration
,
ALL_METHOD
,
m_remoteIp
,
type
);
m_callerProjectsInfo
.
put
(
ALL_METHOD
,
all
);
}
NameDetailInfo
info
=
m_callerProjectsInfo
.
get
(
id
);
if
(
info
==
null
)
{
info
=
new
NameDetailInfo
(
m_reportDuration
,
name
.
getId
(),
m_remoteIp
,
type
);
m_callerProjectsInfo
.
put
(
id
,
info
);
}
info
.
mergeName
(
name
);
all
.
mergeName
(
name
);
}
private
void
addServiceProject
(
String
type
,
Name
name
)
{
String
id
=
name
.
getId
();
NameDetailInfo
all
=
m_serviceProjectsInfo
.
get
(
ALL_METHOD
);
...
...
@@ -87,10 +107,14 @@ public class MethodInfo extends BaseVisitor {
public
Collection
<
NameDetailInfo
>
getCallProjectsInfo
()
{
List
<
NameDetailInfo
>
values
=
new
ArrayList
<
NameDetailInfo
>(
m_callProjectsInfo
.
values
());
Collections
.
sort
(
values
,
new
NameCompartor
(
m_callSortBy
));
Collections
.
sort
(
values
,
new
NameCompar
a
tor
(
m_callSortBy
));
return
values
;
}
public
Map
<
String
,
NameDetailInfo
>
getCallerProjectsInfo
()
{
return
m_callerProjectsInfo
;
}
public
String
getQuery
()
{
return
m_query
;
}
...
...
@@ -102,7 +126,7 @@ public class MethodInfo extends BaseVisitor {
public
List
<
NameDetailInfo
>
getServiceProjectsInfo
()
{
List
<
NameDetailInfo
>
values
=
new
ArrayList
<
NameDetailInfo
>(
m_serviceProjectsInfo
.
values
());
Collections
.
sort
(
values
,
new
NameCompartor
(
m_serviceSortBy
));
Collections
.
sort
(
values
,
new
NameCompar
a
tor
(
m_serviceSortBy
));
return
values
;
}
...
...
@@ -119,23 +143,27 @@ public class MethodInfo extends BaseVisitor {
return
false
;
}
private
boolean
projectContains
(
String
projectName
,
String
ip
,
String
role
)
{
private
boolean
projectContains
(
String
projectName
,
String
app
,
String
ip
,
String
role
)
{
if
(
m_remoteIp
.
startsWith
(
"All"
))
{
if
(
m_remoteProject
.
startsWith
(
"AllClient"
)
&&
role
.
endsWith
(
"Client"
))
{
if
(
m_remoteProject
.
startsWith
(
"AllClient"
)
&&
(
role
.
endsWith
(
"Client"
)
||
role
.
endsWith
(
"Caller"
)
))
{
return
true
;
}
else
if
(
m_remoteProject
.
startsWith
(
"AllServer"
)
&&
role
.
endsWith
(
"Server"
))
{
return
true
;
}
if
(
ip
.
indexOf
(
':'
)
>
0
)
{
ip
=
ip
.
substring
(
0
,
ip
.
indexOf
(
':'
));
}
String
domain
=
m_hostinfoService
.
queryDomainByIp
(
ip
);
if
(
projectName
.
equalsIgnoreCase
(
domain
))
{
return
true
;
if
(
CrossAppSwitch
.
switchOn
()
&&
StringUtils
.
isNotEmpty
(
app
))
{
if
(
app
.
equalsIgnoreCase
(
projectName
))
{
return
true
;
}
}
else
{
return
false
;
if
(
ip
.
indexOf
(
':'
)
>
0
)
{
ip
=
ip
.
substring
(
0
,
ip
.
indexOf
(
':'
));
}
String
domain
=
m_hostinfoService
.
queryDomainByIp
(
ip
);
if
(
projectName
.
equalsIgnoreCase
(
domain
))
{
return
true
;
}
}
return
false
;
}
return
false
;
}
...
...
@@ -189,6 +217,8 @@ public class MethodInfo extends BaseVisitor {
addServiceProject
(
m_currentType
,
name
);
}
else
if
(
role
!=
null
&&
role
.
endsWith
(
"Server"
))
{
addCallProject
(
m_currentType
,
name
);
}
else
if
(
role
!=
null
&&
role
.
endsWith
(
"Caller"
))
{
addCallerProject
(
m_currentType
,
name
);
}
}
}
...
...
@@ -197,8 +227,13 @@ public class MethodInfo extends BaseVisitor {
public
void
visitRemote
(
Remote
remote
)
{
String
role
=
remote
.
getRole
();
String
ip
=
remote
.
getId
();
if
(
projectContains
(
m_remoteProject
,
ip
,
role
)
||
m_remoteIp
.
equals
(
remote
.
getId
()))
{
m_currentRole
=
remote
.
getRole
();
String
app
=
remote
.
getApp
();
if
(
ip
.
endsWith
(
":Caller"
)
&&
role
.
endsWith
(
"Caller"
))
{
ip
=
ip
.
substring
(
0
,
ip
.
indexOf
(
":Caller"
));
}
if
(
projectContains
(
m_remoteProject
,
app
,
ip
,
role
)
||
m_remoteIp
.
equals
(
ip
))
{
m_currentRole
=
role
;
super
.
visitRemote
(
remote
);
}
}
...
...
cat-home/src/main/java/com/dianping/cat/report/page/cross/display/NameCompartor.java
→
cat-home/src/main/java/com/dianping/cat/report/page/cross/display/NameCompar
a
tor.java
浏览文件 @
29fc6ed9
...
...
@@ -2,11 +2,11 @@ package com.dianping.cat.report.page.cross.display;
import
java.util.Comparator
;
public
class
NameCompartor
implements
Comparator
<
NameDetailInfo
>
{
public
class
NameCompar
a
tor
implements
Comparator
<
NameDetailInfo
>
{
private
String
m_sorted
;
public
NameCompartor
(
String
sort
)
{
public
NameCompar
a
tor
(
String
sort
)
{
m_sorted
=
sort
;
}
...
...
cat-home/src/main/java/com/dianping/cat/report/page/cross/display/ProjectInfo.java
浏览文件 @
29fc6ed9
...
...
@@ -28,7 +28,7 @@ public class ProjectInfo extends BaseVisitor {
private
Map
<
String
,
TypeDetailInfo
>
m_serviceProjectsInfo
=
new
LinkedHashMap
<
String
,
TypeDetailInfo
>();
private
Map
<
String
,
TypeDetailInfo
>
m_call
Service
ProjectsInfo
=
new
LinkedHashMap
<
String
,
TypeDetailInfo
>();
private
Map
<
String
,
TypeDetailInfo
>
m_call
er
ProjectsInfo
=
new
LinkedHashMap
<
String
,
TypeDetailInfo
>();
private
String
m_clientIp
;
...
...
@@ -44,21 +44,46 @@ public class ProjectInfo extends BaseVisitor {
m_reportDuration
=
reportDuration
;
}
public
void
add
AllCall
ProjectInfo
(
String
domain
,
TypeDetailInfo
info
)
{
TypeDetailInfo
all
=
m_call
Service
ProjectsInfo
.
get
(
ALL_CLIENT
);
public
void
add
Caller
ProjectInfo
(
String
domain
,
TypeDetailInfo
info
)
{
TypeDetailInfo
all
=
m_call
er
ProjectsInfo
.
get
(
ALL_CLIENT
);
if
(
all
==
null
)
{
all
=
new
TypeDetailInfo
(
m_reportDuration
,
ALL_CLIENT
);
all
.
setType
(
info
.
getType
());
m_call
Service
ProjectsInfo
.
put
(
ALL_CLIENT
,
all
);
m_call
er
ProjectsInfo
.
put
(
ALL_CLIENT
,
all
);
}
all
.
mergeTypeDetailInfo
(
info
);
m_call
Service
ProjectsInfo
.
put
(
domain
,
info
);
m_call
er
ProjectsInfo
.
put
(
domain
,
info
);
}
private
void
addCall
Project
(
String
i
p
,
Type
type
)
{
String
projectName
=
getProjectName
(
ip
)
;
private
void
addCall
erProject
(
String
ip
,
String
ap
p
,
Type
type
)
{
String
projectName
=
app
;
if
(!
CrossAppSwitch
.
switchOn
()
||
StringUtils
.
isEmpty
(
projectName
))
{
projectName
=
getProjectName
(
ip
);
System
.
out
.
println
(
projectName
);
}
TypeDetailInfo
all
=
m_callerProjectsInfo
.
get
(
ALL_CLIENT
);
if
(
all
==
null
)
{
all
=
new
TypeDetailInfo
(
m_reportDuration
,
ALL_CLIENT
);
m_callerProjectsInfo
.
put
(
ALL_CLIENT
,
all
);
}
TypeDetailInfo
info
=
m_callerProjectsInfo
.
get
(
projectName
);
if
(
info
==
null
)
{
info
=
new
TypeDetailInfo
(
m_reportDuration
,
projectName
);
m_callerProjectsInfo
.
put
(
projectName
,
info
);
}
info
.
mergeType
(
type
);
all
.
mergeType
(
type
);
}
private
void
addCallProject
(
String
ip
,
String
app
,
Type
type
)
{
String
projectName
=
app
;
if
(!
CrossAppSwitch
.
switchOn
()
||
StringUtils
.
isEmpty
(
projectName
))
{
projectName
=
getProjectName
(
ip
);
}
TypeDetailInfo
all
=
m_callProjectsInfo
.
get
(
ALL_SERVER
);
if
(
all
==
null
)
{
all
=
new
TypeDetailInfo
(
m_reportDuration
,
ALL_SERVER
);
...
...
@@ -73,8 +98,12 @@ public class ProjectInfo extends BaseVisitor {
all
.
mergeType
(
type
);
}
private
void
addServiceProject
(
String
ip
,
Type
type
)
{
String
projectName
=
getProjectName
(
ip
);
private
void
addServiceProject
(
String
ip
,
String
app
,
Type
type
)
{
String
projectName
=
app
;
if
(!
CrossAppSwitch
.
switchOn
()
||
StringUtils
.
isEmpty
(
projectName
))
{
projectName
=
getProjectName
(
ip
);
}
TypeDetailInfo
all
=
m_serviceProjectsInfo
.
get
(
ALL_CLIENT
);
if
(
all
==
null
)
{
...
...
@@ -96,13 +125,17 @@ public class ProjectInfo extends BaseVisitor {
public
Collection
<
TypeDetailInfo
>
getCallProjectsInfo
()
{
List
<
TypeDetailInfo
>
values
=
new
ArrayList
<
TypeDetailInfo
>(
m_callProjectsInfo
.
values
());
Collections
.
sort
(
values
,
new
TypeCompartor
(
m_callSortBy
));
Collections
.
sort
(
values
,
new
TypeCompar
a
tor
(
m_callSortBy
));
return
values
;
}
public
List
<
TypeDetailInfo
>
getCallServiceProjectsInfo
()
{
List
<
TypeDetailInfo
>
values
=
new
ArrayList
<
TypeDetailInfo
>(
m_callServiceProjectsInfo
.
values
());
Collections
.
sort
(
values
,
new
TypeCompartor
(
m_serviceSortBy
));
public
Map
<
String
,
TypeDetailInfo
>
getCallerProjectsInfo
()
{
return
m_callerProjectsInfo
;
}
public
List
<
TypeDetailInfo
>
getServiceProjectsInfo
()
{
List
<
TypeDetailInfo
>
values
=
new
ArrayList
<
TypeDetailInfo
>(
m_serviceProjectsInfo
.
values
());
Collections
.
sort
(
values
,
new
TypeComparator
(
m_serviceSortBy
));
return
values
;
}
...
...
@@ -120,12 +153,6 @@ public class ProjectInfo extends BaseVisitor {
return
m_reportDuration
;
}
public
List
<
TypeDetailInfo
>
getServiceProjectsInfo
()
{
List
<
TypeDetailInfo
>
values
=
new
ArrayList
<
TypeDetailInfo
>(
m_serviceProjectsInfo
.
values
());
Collections
.
sort
(
values
,
new
TypeCompartor
(
m_serviceSortBy
));
return
values
;
}
public
ProjectInfo
setCallSortBy
(
String
callSoryBy
)
{
m_callSortBy
=
callSoryBy
;
return
this
;
...
...
@@ -161,11 +188,14 @@ public class ProjectInfo extends BaseVisitor {
public
void
visitRemote
(
Remote
remote
)
{
String
remoteIp
=
remote
.
getId
();
String
role
=
remote
.
getRole
();
String
app
=
remote
.
getApp
();
if
(
role
!=
null
&&
role
.
endsWith
(
"Client"
))
{
addServiceProject
(
remoteIp
,
remote
.
getType
());
addServiceProject
(
remoteIp
,
app
,
remote
.
getType
());
}
else
if
(
role
!=
null
&&
role
.
endsWith
(
"Server"
))
{
addCallProject
(
remoteIp
,
remote
.
getType
());
addCallProject
(
remoteIp
,
app
,
remote
.
getType
());
}
else
if
(
role
!=
null
&&
role
.
endsWith
(
"Caller"
)
&&
remoteIp
.
endsWith
(
":Caller"
))
{
addCallerProject
(
remoteIp
,
app
,
remote
.
getType
());
}
}
...
...
cat-home/src/main/java/com/dianping/cat/report/page/cross/display/TypeCompartor.java
→
cat-home/src/main/java/com/dianping/cat/report/page/cross/display/TypeCompar
a
tor.java
浏览文件 @
29fc6ed9
...
...
@@ -2,11 +2,11 @@ package com.dianping.cat.report.page.cross.display;
import
java.util.Comparator
;
public
class
TypeCompartor
implements
Comparator
<
TypeDetailInfo
>
{
public
class
TypeCompar
a
tor
implements
Comparator
<
TypeDetailInfo
>
{
private
String
m_sorted
;
public
TypeCompartor
(
String
sort
)
{
public
TypeCompar
a
tor
(
String
sort
)
{
m_sorted
=
sort
;
}
...
...
cat-home/src/main/java/com/dianping/cat/report/task/alert/sender/decorator/FrontEndExceptionDecorator.java
浏览文件 @
29fc6ed9
package
com.dianping.cat.report.task.alert.sender.decorator
;
import
java.io.StringWriter
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -21,6 +23,8 @@ public class FrontEndExceptionDecorator extends ProjectDecorator implements Init
public
Configuration
m_configuration
;
protected
DateFormat
m_format
=
new
SimpleDateFormat
(
"yyyyMMddHH"
);
@Override
public
String
getId
()
{
return
ID
;
...
...
cat-home/src/main/webapp/jsp/report/cross/cross.jsp
浏览文件 @
29fc6ed9
...
...
@@ -42,10 +42,11 @@
appendHostname
(
$
{
model
.
ipToHostnameStr
});
});
</script>
<table
class=
'data'
>
<table
class=
"table table-striped table-condensed "
>
<c:if
test=
"
${
!
empty
model
.
projectInfo
.
callProjectsInfo
}
"
>
<tr><td
colspan=
"7"
style=
"text-align:center"
><h4>
调用其他Pigeon服务
</h4></td></tr>
<tr>
<th
class=
"left"
>
Type
(本项目调用其他Pigeon服务)
</th>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&serviceSort=${model.serviceSort}&callSort=name"
>
RemoteProject
</a></th>
<th><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&serviceSort=${model.serviceSort}&callSort=total"
>
Total
</a></th>
<th><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&serviceSort=${model.serviceSort}&callSort=failure"
>
Failure
</a></th>
...
...
@@ -64,54 +65,58 @@
<td>
${w:format(callInfo.tps,'0.00')}
</td>
</tr>
</c:forEach>
<tr><td>
&
nbsp
</td></tr>
</c:if>
<c:if
test=
"
${
!
empty
model
.
projectInfo
.
serviceProjectsInfo
}
"
>
<tr><td
colspan=
"7"
style=
"text-align:center"
><h4>
提供Pigeon服务 [ 服务器端数据 ]
</h4></td>
<c:if
test=
"
${
!
empty
model
.
projectInfo
.
callerProjectsInfo
}
"
>
<td></td>
<td
colspan=
"7"
style=
"text-align:center"
><h4>
提供Pigeon服务 [ 客户端数据 ]
</h4></td>
</c:if>
</tr>
<tr>
<th
class=
"left"
>
Type
(从服务端看,Pigeon服务数据)
</th>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=name"
>
RemoteProject
</a></th>
<th><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=total"
>
Total
</a></th>
<th><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=failure"
>
Failure
</a></th>
<th><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=failurePercent"
>
Failure%
</a></th>
<th><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=avg"
>
Avg(ms)
</a></th>
<th>
QPS
</th>
<c:if
test=
"
${
!
empty
model
.
projectInfo
.
callerProjectsInfo
}
"
>
<th></th>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=name"
>
RemoteProject
</a></th>
<th><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=total"
>
Total
</a></th>
<th><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=failure"
>
Failure
</a></th>
<th><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=failurePercent"
>
Failure%
</a></th>
<th><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=avg"
>
Avg(ms)
</a></th>
<th>
QPS
</th>
</c:if>
</tr>
<c:forEach
var=
"serviceInfo"
items=
"
${
model
.
projectInfo
.
serviceProjectsInfo
}
"
varStatus=
"status"
>
<tr
class=
"${status.index mod 2 != 0 ? 'odd' : 'even'} right"
>
<td
class=
"left"
>
${serviceInfo.type}
</td>
<td
class=
"left"
><a
href=
"?op=host&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&project=${serviceInfo.projectName
}"
>
${serviceInfo.projectName}
</a></td>
<td
class=
"left"
><a
href=
"?op=host&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&project=${serviceInfo.projectName}"
>
${serviceInfo.projectName}
</a></td>
<td>
${w:format(serviceInfo.totalCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(serviceInfo.failureCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(serviceInfo.failurePercent,'0.0000%')}
</td>
<td>
${w:format(serviceInfo.avg,'0.00')}
</td>
<td>
${w:format(serviceInfo.tps,'0.00')}
</td>
<td>
${w:format(serviceInfo.avg,'0.00')}
</td>
<td>
${w:format(serviceInfo.tps,'0.00')}
</td>
<c:set
var=
"projectName"
value=
"
${
serviceInfo
.
projectName
}
"
/>
<c:set
var=
"callerInfo"
value=
"
${
model
.
projectInfo
.
callerProjectsInfo
}
"
/>
<c:if
test=
"
${
!
empty
callerInfo
}
"
>
<td></td>
<td
class=
"left"
>
${callerInfo[projectName].type}
</td>
<td
class=
"left"
><a
href=
"?op=host&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&project=${callerInfo[projectName].projectName }"
>
${callerInfo[projectName].projectName}
</a></td>
<td>
${w:format(callerInfo[projectName].totalCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(callerInfo[projectName].failureCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(callerInfo[projectName].failurePercent,'0.0000%')}
</td>
<td>
${w:format(callerInfo[projectName].avg,'0.00')}
</td>
<td>
${w:format(callerInfo[projectName].tps,'0.00')}
</td>
</c:if>
</tr>
</c:forEach>
</c:if>
<tr><td>
&
nbsp
</td></tr>
<c:if
test=
"
${
!
empty
model
.
projectInfo
.
callServiceProjectsInfo
}
"
>
<tr>
<th
class=
"left"
>
Type(从客户端看,Pigeon服务数据)
</th>
<th
class=
"left"
>
RemoteProject
</th>
<th>
Total
</th>
<th>
Failure
</th>
<th>
Failure%
</th>
<th>
Avg(ms)
</th>
<th>
QPS
</th>
</tr>
<c:forEach
var=
"serviceInfo"
items=
"
${
model
.
projectInfo
.
callServiceProjectsInfo
}
"
varStatus=
"status"
>
<tr
class=
"${status.index mod 2 != 0 ? 'odd' : 'even'} right"
>
<td
class=
"left"
>
${serviceInfo.type}
</td>
<td
class=
"left"
>
${serviceInfo.projectName}
</td>
<td>
${w:format(serviceInfo.totalCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(serviceInfo.failureCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(serviceInfo.failurePercent,'0.0000%')}
</td>
<td>
${w:format(serviceInfo.avg,'0.00')}
</td>
<td>
${w:format(serviceInfo.tps,'0.00')}
</td>
</tr>
</c:forEach>
</c:if>
</c:if>
</table>
</jsp:body>
</a:report>
</a:report>
\ No newline at end of file
cat-home/src/main/webapp/jsp/report/cross/crossHistoryHost.jsp
浏览文件 @
29fc6ed9
...
...
@@ -44,8 +44,9 @@
appendHostname
(
$
{
model
.
ipToHostnameStr
});
});
</script>
<table
class=
'
data
'
>
<table
class=
'
table table-striped table-condensed
'
>
<c:if
test=
"
${
!
empty
model
.
hostInfo
.
callProjectsInfo
}
"
>
<tr><td
colspan=
"7"
style=
"text-align:center"
><h4>
调用其他Pigeon服务
</h4></td></tr>
<tr>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
><a
href=
"?op=historyHost&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&serviceSort=${model.serviceSort}&callSort=name${model.customDate}"
>
RemoteIp
</a></th>
...
...
@@ -67,9 +68,13 @@
</tr>
</c:forEach>
</c:if>
<tr><td>
&
nbsp
</td></tr>
<tr><td>
&
nbsp
</td></tr>
<c:if
test=
"
${
!
empty
model
.
hostInfo
.
serviceProjectsInfo
}
"
>
<tr><td
colspan=
"7"
style=
"text-align:center"
><h4>
提供Pigeon服务 [ 服务器端数据 ]
</h4></td>
<c:if
test=
"
${
!
empty
model
.
hostInfo
.
callerProjectsInfo
}
"
>
<td></td>
<td
colspan=
"7"
style=
"text-align:center"
><h4>
提供Pigeon服务 [ 客户端数据 ]
</h4></td>
</c:if>
</tr>
<tr>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
><a
href=
"?op=historyHost&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&callSort=${model.callSort}&serviceSort=name${model.customDate}"
>
RemoteIp
</a></th>
...
...
@@ -78,6 +83,16 @@
<th><a
href=
"?op=historyHost&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&callSort=${model.callSort}&serviceSort=failurePercent${model.customDate}"
>
Failure%
</a></th>
<th><a
href=
"?op=historyHost&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&callSort=${model.callSort}&serviceSort=avg${model.customDate}"
>
Avg(ms)
</a></th>
<th>
QPS
</th>
<c:if
test=
"
${
!
empty
model
.
hostInfo
.
callerProjectsInfo
}
"
>
<th></th>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
><a
href=
"?op=historyHost&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&callSort=${model.callSort}&serviceSort=name${model.customDate}"
>
RemoteIp
</a></th>
<th><a
href=
"?op=historyHost&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&callSort=${model.callSort}&serviceSort=total${model.customDate}"
>
Total
</a></th>
<th><a
href=
"?op=historyHost&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&callSort=${model.callSort}&serviceSort=failure${model.customDate}"
>
Failure
</a></th>
<th><a
href=
"?op=historyHost&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&callSort=${model.callSort}&serviceSort=failurePercent${model.customDate}"
>
Failure%
</a></th>
<th><a
href=
"?op=historyHost&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&callSort=${model.callSort}&serviceSort=avg${model.customDate}"
>
Avg(ms)
</a></th>
<th>
QPS
</th>
</c:if>
</tr>
<c:forEach
var=
"serviceInfo"
items=
"
${
model
.
hostInfo
.
serviceProjectsInfo
}
"
varStatus=
"status"
>
<tr
class=
"${status.index mod 2 != 0 ? 'odd' : 'even'} right"
>
...
...
@@ -86,8 +101,20 @@
<td>
${w:format(serviceInfo.totalCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(serviceInfo.failureCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(serviceInfo.failurePercent,'0.0000%')}
</td>
<td>
${w:format(serviceInfo.avg,'0.00')}
</td>
<td>
${w:format(serviceInfo.tps,'0.00')}
</td>
<td>
${w:format(serviceInfo.avg,'0.00')}
</td>
<td>
${w:format(serviceInfo.tps,'0.00')}
</td>
<c:set
var=
"ip"
value=
"
${
serviceInfo
.
ip
}
"
/>
<c:set
var=
"callerInfo"
value=
"
${
model
.
hostInfo
.
callerProjectsInfo
}
"
/>
<c:if
test=
"
${
!
empty
callerInfo
}
"
>
<td></td>
<td
class=
"left"
>
${callerInfo[ip].type}
</td>
<td
class=
"left"
><a
href=
"?op=historyMethod&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&remote=${callerInfo[ip].ip}&project=${payload.projectName}${model.customDate}"
>
${callerInfo[ip].ip}
</a></td>
<td>
${w:format(callerInfo[ip].totalCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(callerInfo[ip].failureCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(callerInfo[ip].failurePercent,'0.0000%')}
</td>
<td>
${w:format(callerInfo[ip].avg,'0.00')}
</td>
<td>
${w:format(callerInfo[ip].tps,'0.00')}
</td>
</c:if>
</tr>
</c:forEach>
</c:if>
...
...
cat-home/src/main/webapp/jsp/report/cross/crossHistoryMethod.jsp
浏览文件 @
29fc6ed9
...
...
@@ -38,7 +38,7 @@
</th>
</tr>
</table>
<table
class=
'
data
'
>
<table
class=
'
table table-striped table-condensed
'
>
<tr><th
style=
"text-align: left"
colspan=
'8'
><input
type=
"text"
name=
"queryname"
id=
"queryname"
size=
"40"
value=
"${model.queryName}"
>
<input
style=
"WIDTH: 60px"
value=
"Filter"
onclick=
"filterByName('${model.date}','${model.domain}','${model.ipAddress}')"
type=
"submit"
>
支持多个字符串查询,例如sql|url|task,查询结果为包含任一sql、url、task的列
...
...
@@ -63,6 +63,7 @@
}
</script>
<c:if
test=
"
${
!
empty
model
.
methodInfo
.
callProjectsInfo
}
"
>
<tr><td
colspan=
"8"
style=
"text-align:center"
><h4>
调用其他Pigeon服务
</h4></td></tr>
<tr>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
>
RemoteIp
</th>
...
...
@@ -85,11 +86,15 @@
<td>
${w:format(callInfo.tps,'0.00')}
</td>
</tr>
</c:forEach>
<tr><td>
&
nbsp
</td></tr>
<tr><td>
&
nbsp
</td></tr>
</c:if>
<c:if
test=
"
${
!
empty
model
.
methodInfo
.
serviceProjectsInfo
}
"
>
<tr><td
colspan=
"8"
style=
"text-align:center"
><h4>
提供Pigeon服务 [ 服务器端数据 ]
</h4></td>
<c:if
test=
"
${
!
empty
model
.
methodInfo
.
callerProjectsInfo
}
"
>
<td></td>
<td
colspan=
"8"
style=
"text-align:center"
><h4>
提供Pigeon服务 [ 客户端数据 ]
</h4></td>
</c:if>
</tr>
<tr>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
>
RemoteIp
</th>
...
...
@@ -99,6 +104,17 @@
<th><a
href=
"?op=historyMethod&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&remote=${payload.remoteIp}&callSort=${model.callSort}&serviceSort=failurePercent&queryName=${model.queryName}${model.customDate}"
>
Failure%
</a></th>
<th><a
href=
"?op=historyMethod&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&remote=${payload.remoteIp}&callSort=${model.callSort}&serviceSort=avg&queryName=${model.queryName}${model.customDate}"
>
Avg(ms)
</a></th>
<th>
QPS
</th>
<c:if
test=
"
${
!
empty
model
.
methodInfo
.
callerProjectsInfo
}
"
>
<th></th>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
>
RemoteIp
</th>
<th
class=
"left"
>
Method
</th>
<th><a
href=
"?op=historyMethod&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&remote=${payload.remoteIp}&callSort=${model.callSort}&serviceSort=total&queryName=${model.queryName}${model.customDate}"
>
Total
</a></th>
<th><a
href=
"?op=historyMethod&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&remote=${payload.remoteIp}&callSort=${model.callSort}&serviceSort=failure&queryName=${model.queryName}${model.customDate}"
>
Failure
</a></th>
<th><a
href=
"?op=historyMethod&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&remote=${payload.remoteIp}&callSort=${model.callSort}&serviceSort=failurePercent&queryName=${model.queryName}${model.customDate}"
>
Failure%
</a></th>
<th><a
href=
"?op=historyMethod&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&remote=${payload.remoteIp}&callSort=${model.callSort}&serviceSort=avg&queryName=${model.queryName}${model.customDate}"
>
Avg(ms)
</a></th>
<th>
QPS
</th>
</c:if>
</tr>
<c:forEach
var=
"serviceInfo"
items=
"
${
model
.
methodInfo
.
serviceProjectsInfo
}
"
varStatus=
"status"
>
<tr
class=
"${status.index mod 2 != 0 ? 'odd' : 'even'} right"
>
...
...
@@ -110,9 +126,22 @@
<td>
${w:format(serviceInfo.failurePercent,'0.0000%')}
</td>
<td>
${w:format(serviceInfo.avg,'0.00')}
</td>
<td>
${w:format(serviceInfo.tps,'0.00')}
</td>
<c:set
var=
"id"
value=
"
${
serviceInfo
.
id
}
"
/>
<c:set
var=
"callerInfo"
value=
"
${
model
.
methodInfo
.
callerProjectsInfo
}
"
/>
<c:if
test=
"
${
!
empty
callerInfo
}
"
>
<td></td>
<td
class=
"left"
>
${callerInfo[id].type}
</td>
<td
class=
"left"
>
${callerInfo[id].ip}
</td>
<td
class=
"left"
>
${callerInfo[id].id}
</td>
<td>
${w:format(callerInfo[id].totalCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(callerInfo[id].failureCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(callerInfo[id].failurePercent,'0.0000%')}
</td>
<td>
${w:format(callerInfo[id].avg,'0.00')}
</td>
<td>
${w:format(callerInfo[id].tps,'0.00')}
</td>
</c:if>
</tr>
</c:forEach>
</c:if>
</c:if>
</table>
</jsp:body>
</a:historyReport>
cat-home/src/main/webapp/jsp/report/cross/crossHistoryProject.jsp
浏览文件 @
29fc6ed9
...
...
@@ -44,10 +44,11 @@
appendHostname
(
$
{
model
.
ipToHostnameStr
});
});
</script>
<table
class=
'
data
'
>
<table
class=
'
table table-striped table-condensed
'
>
<c:if
test=
"
${
!
empty
model
.
projectInfo
.
callProjectsInfo
}
"
>
<tr><td
colspan=
"7"
style=
"text-align:center"
><h4>
调用其他Pigeon服务
</h4></td></tr>
<tr>
<th
class=
"left"
>
Type
(本项目调用其他Pigeon服务)
</th>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&serviceSort=${model.serviceSort}&callSort=name${model.customDate}"
>
RemoteProject
</a></th>
<th><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&serviceSort=${model.serviceSort}&callSort=total${model.customDate}"
>
Total
</a></th>
<th><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&serviceSort=${model.serviceSort}&callSort=failure${model.customDate}"
>
Failure
</a></th>
...
...
@@ -67,16 +68,31 @@
</tr>
</c:forEach>
</c:if>
<tr><td>
&
nbsp
</td></tr>
<c:if
test=
"
${
!
empty
model
.
projectInfo
.
serviceProjectsInfo
}
"
>
<tr><td
colspan=
"7"
style=
"text-align:center"
><h4>
提供Pigeon服务 [ 服务器端数据 ]
</h4></td>
<c:if
test=
"
${
!
empty
model
.
projectInfo
.
callerProjectsInfo
}
"
>
<td></td>
<td
colspan=
"7"
style=
"text-align:center"
><h4>
提供Pigeon服务 [ 客户端数据 ]
</h4></td>
</c:if>
</tr>
<tr>
<th
class=
"left"
>
Type
(从服务端看,Pigeon服务数据)
</th>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=name${model.customDate}"
>
RemoteProject
</a></th>
<th><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=total${model.customDate}"
>
Total
</a></th>
<th><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=failure${model.customDate}"
>
Failure
</a></th>
<th><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=failurePercent${model.customDate}"
>
Failure%
</a></th>
<th><a
href=
"?op=history&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=avg${model.customDate}"
>
Avg(ms)
</a></th>
<th>
QPS
</th>
<c:if
test=
"
${
!
empty
model
.
projectInfo
.
callerProjectsInfo
}
"
>
<th></th>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=name"
>
RemoteProject
</a></th>
<th><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=total"
>
Total
</a></th>
<th><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=failure"
>
Failure
</a></th>
<th><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=failurePercent"
>
Failure%
</a></th>
<th><a
href=
"?domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&callSort=${model.callSort}&serviceSort=avg"
>
Avg(ms)
</a></th>
<th>
QPS
</th>
</c:if>
</tr>
<c:forEach
var=
"serviceInfo"
items=
"
${
model
.
projectInfo
.
serviceProjectsInfo
}
"
varStatus=
"status"
>
<tr
class=
"${status.index mod 2 != 0 ? 'odd' : 'even'} right"
>
...
...
@@ -85,35 +101,23 @@
<td>
${w:format(serviceInfo.totalCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(serviceInfo.failureCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(serviceInfo.failurePercent,'0.0000%')}
</td>
<td>
${w:format(serviceInfo.avg,'0.00')}
</td>
<td>
${w:format(serviceInfo.tps,'0.00')}
</td>
<td>
${w:format(serviceInfo.avg,'0.00')}
</td>
<td>
${w:format(serviceInfo.tps,'0.00')}
</td>
<c:set
var=
"projectName"
value=
"
${
serviceInfo
.
projectName
}
"
/>
<c:set
var=
"callerInfo"
value=
"
${
model
.
projectInfo
.
callerProjectsInfo
}
"
/>
<c:if
test=
"
${
!
empty
callerInfo
}
"
>
<td></td>
<td
class=
"left"
>
${callerInfo[projectName].type}
</td>
<td
class=
"left"
><a
href=
"?op=historyHost&domain=${model.domain}&reportType=${model.reportType}&date=${model.date}&ip=${model.ipAddress}&project=${callerInfo[projectName].projectName}${model.customDate}"
>
${callerInfo[projectName].projectName}
</a></td>
<td>
${w:format(callerInfo[projectName].totalCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(callerInfo[projectName].failureCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(callerInfo[projectName].failurePercent,'0.0000%')}
</td>
<td>
${w:format(callerInfo[projectName].avg,'0.00')}
</td>
<td>
${w:format(callerInfo[projectName].tps,'0.00')}
</td>
</c:if>
</tr>
</c:forEach>
</c:if>
<tr><td>
&
nbsp
</td></tr>
<c:if
test=
"
${
!
empty
model
.
projectInfo
.
callServiceProjectsInfo
}
"
>
<tr>
<th
class=
"left"
>
Type(从客户端看,Pigeon服务数据)
</th>
<th
class=
"left"
>
RemoteProject
</th>
<th>
Total
</th>
<th>
Failure
</th>
<th>
Failure%
</th>
<th>
Avg(ms)
</th>
<th>
QPS
</th>
</tr>
<c:forEach
var=
"serviceInfo"
items=
"
${
model
.
projectInfo
.
callServiceProjectsInfo
}
"
varStatus=
"status"
>
<tr
class=
"${status.index mod 2 != 0 ? 'odd' : 'even'} right"
>
<td
class=
"left"
>
${serviceInfo.type}
</td>
<td
class=
"left"
>
${serviceInfo.projectName}
</td>
<td>
${w:format(serviceInfo.totalCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(serviceInfo.failureCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(serviceInfo.failurePercent,'0.0000%')}
</td>
<td>
${w:format(serviceInfo.avg,'0.00')}
</td>
<td>
${w:format(serviceInfo.tps,'0.00')}
</td>
</tr>
</c:forEach>
</c:if>
</c:if>
</table>
</jsp:body>
</a:historyReport>
cat-home/src/main/webapp/jsp/report/cross/crossHost.jsp
浏览文件 @
29fc6ed9
...
...
@@ -44,8 +44,9 @@
appendHostname
(
$
{
model
.
ipToHostnameStr
});
});
</script>
<table
class=
'
data
'
>
<table
class=
'
table table-striped table-condensed
'
>
<c:if
test=
"
${
!
empty
model
.
hostInfo
.
callProjectsInfo
}
"
>
<tr><td
colspan=
"7"
style=
"text-align:center"
><h4>
调用其他Pigeon服务
</h4></td></tr>
<tr>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
><a
href=
"?op=host&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&serviceSort=${model.serviceSort}&callSort=name"
>
RemoteIp
</a></th>
...
...
@@ -66,11 +67,15 @@
<td>
${w:format(callInfo.tps,'0.00')}
</td>
</tr>
</c:forEach>
<tr><td>
&
nbsp
</td></tr>
<tr><td>
&
nbsp
</td></tr>
</c:if>
<c:if
test=
"
${
!
empty
model
.
hostInfo
.
serviceProjectsInfo
}
"
>
<tr><td
colspan=
"7"
style=
"text-align:center"
><h4>
提供Pigeon服务 [ 服务器端数据 ]
</h4></td>
<c:if
test=
"
${
!
empty
model
.
hostInfo
.
callerProjectsInfo
}
"
>
<td></td>
<td
colspan=
"7"
style=
"text-align:center"
><h4>
提供Pigeon服务 [ 客户端数据 ]
</h4></td>
</c:if>
</tr>
<tr>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
><a
href=
"?op=host&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&callSort=${model.callSort}&serviceSort=name"
>
RemoteIp
</a></th>
...
...
@@ -79,6 +84,16 @@
<th><a
href=
"?op=host&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&callSort=${model.callSort}&serviceSort=failurePercent"
>
Failure%
</a></th>
<th><a
href=
"?op=host&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&callSort=${model.callSort}&serviceSort=avg"
>
Avg(ms)
</a></th>
<th>
QPS
</th>
<c:if
test=
"
${
!
empty
model
.
hostInfo
.
callerProjectsInfo
}
"
>
<th></th>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
><a
href=
"?op=host&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&callSort=${model.callSort}&serviceSort=name"
>
RemoteIp
</a></th>
<th><a
href=
"?op=host&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&callSort=${model.callSort}&serviceSort=total"
>
Total
</a></th>
<th><a
href=
"?op=host&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&callSort=${model.callSort}&serviceSort=failure"
>
Failure
</a></th>
<th><a
href=
"?op=host&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&callSort=${model.callSort}&serviceSort=failurePercent"
>
Failure%
</a></th>
<th><a
href=
"?op=host&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&project=${payload.projectName}&callSort=${model.callSort}&serviceSort=avg"
>
Avg(ms)
</a></th>
<th>
QPS
</th>
</c:if>
</tr>
<c:forEach
var=
"serviceInfo"
items=
"
${
model
.
hostInfo
.
serviceProjectsInfo
}
"
varStatus=
"status"
>
<tr
class=
"${status.index mod 2 != 0 ? 'odd' : 'even'} right"
>
...
...
@@ -87,11 +102,23 @@
<td>
${w:format(serviceInfo.totalCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(serviceInfo.failureCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(serviceInfo.failurePercent,'0.0000%')}
</td>
<td>
${w:format(serviceInfo.avg,'0.00')}
</td>
<td>
${w:format(serviceInfo.tps,'0.00')}
</td>
<td>
${w:format(serviceInfo.avg,'0.00')}
</td>
<td>
${w:format(serviceInfo.tps,'0.00')}
</td>
<c:set
var=
"ip"
value=
"
${
serviceInfo
.
ip
}
"
/>
<c:set
var=
"callerInfo"
value=
"
${
model
.
hostInfo
.
callerProjectsInfo
}
"
/>
<c:if
test=
"
${
!
empty
callerInfo
}
"
>
<td></td>
<td
class=
"left"
>
${callerInfo[ip].type}
</td>
<td
class=
"left"
><a
href=
"?op=method&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&remote=${callerInfo[ip].ip}&project=${payload.projectName}"
>
${callerInfo[ip].ip}
</a></td>
<td>
${w:format(callerInfo[ip].totalCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(callerInfo[ip].failureCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(callerInfo[ip].failurePercent,'0.0000%')}
</td>
<td>
${w:format(callerInfo[ip].avg,'0.00')}
</td>
<td>
${w:format(callerInfo[ip].tps,'0.00')}
</td>
</c:if>
</tr>
</c:forEach>
</c:if>
</c:if>
</table>
</jsp:body>
</a:report>
cat-home/src/main/webapp/jsp/report/cross/crossMethod.jsp
浏览文件 @
29fc6ed9
...
...
@@ -44,7 +44,7 @@
appendHostname
(
$
{
model
.
ipToHostnameStr
});
});
</script>
<table
class=
'
data
'
>
<table
class=
'
table table-striped table-condensed
'
>
<tr><th
colspan=
'8'
><input
type=
"text"
name=
"queryname"
id=
"queryname"
size=
"40"
value=
"${model.queryName}"
>
<input
style=
"WIDTH: 60px"
value=
"Filter"
onclick=
"filterByName('${model.date}','${model.domain}','${model.ipAddress}')"
type=
"submit"
>
支持多个字符串查询,例如sql|url|task,查询结果为包含任一sql、url、task的列
...
...
@@ -60,6 +60,7 @@
}
</script>
<c:if
test=
"
${
!
empty
model
.
methodInfo
.
callProjectsInfo
}
"
>
<tr><td
colspan=
"8"
style=
"text-align:center"
><h4>
调用其他Pigeon服务
</h4></td></tr>
<tr>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
>
RemoteIp
</th>
...
...
@@ -82,11 +83,15 @@
<td>
${w:format(callInfo.tps,'0.00')}
</td>
</tr>
</c:forEach>
<tr><td>
&
nbsp
</td></tr>
<tr><td>
&
nbsp
</td></tr>
</c:if>
<c:if
test=
"
${
!
empty
model
.
methodInfo
.
serviceProjectsInfo
}
"
>
<tr><td
colspan=
"8"
style=
"text-align:center"
><h4>
提供Pigeon服务 [ 服务器端数据 ]
</h4></td>
<c:if
test=
"
${
!
empty
model
.
methodInfo
.
callerProjectsInfo
}
"
>
<td></td>
<td
colspan=
"8"
style=
"text-align:center"
><h4>
提供Pigeon服务 [ 客户端数据 ]
</h4></td>
</c:if>
</tr>
<tr>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
>
RemoteIp
</th>
...
...
@@ -96,6 +101,17 @@
<th><a
href=
"?op=method&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&remote=${payload.remoteIp}&callSort=${model.callSort}&project=${payload.projectName}&serviceSort=failurePercent&queryName=${model.queryName}"
>
Failure%
</a></th>
<th><a
href=
"?op=method&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&remote=${payload.remoteIp}&callSort=${model.callSort}&project=${payload.projectName}&serviceSort=avg&queryName=${model.queryName}"
>
Avg(ms)
</a></th>
<th>
QPS
</th>
<c:if
test=
"
${
!
empty
model
.
methodInfo
.
callerProjectsInfo
}
"
>
<th></th>
<th
class=
"left"
>
Type
</th>
<th
class=
"left"
>
RemoteIp
</th>
<th
class=
"left"
>
Method
</th>
<th><a
href=
"?op=method&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&remote=${payload.remoteIp}&callSort=${model.callSort}&project=${payload.projectName}&serviceSort=total&queryName=${model.queryName}"
>
Total
</a></th>
<th><a
href=
"?op=method&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&remote=${payload.remoteIp}&callSort=${model.callSort}&project=${payload.projectName}&serviceSort=failure&queryName=${model.queryName}"
>
Failure
</a></th>
<th><a
href=
"?op=method&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&remote=${payload.remoteIp}&callSort=${model.callSort}&project=${payload.projectName}&serviceSort=failurePercent&queryName=${model.queryName}"
>
Failure%
</a></th>
<th><a
href=
"?op=method&domain=${model.domain}&date=${model.date}&ip=${model.ipAddress}&remote=${payload.remoteIp}&callSort=${model.callSort}&project=${payload.projectName}&serviceSort=avg&queryName=${model.queryName}"
>
Avg(ms)
</a></th>
<th>
QPS
</th>
</c:if>
</tr>
<c:forEach
var=
"serviceInfo"
items=
"
${
model
.
methodInfo
.
serviceProjectsInfo
}
"
varStatus=
"status"
>
<tr
class=
"${status.index mod 2 != 0 ? 'odd' : 'even'} right"
>
...
...
@@ -107,9 +123,22 @@
<td>
${w:format(serviceInfo.failurePercent,'0.0000%')}
</td>
<td>
${w:format(serviceInfo.avg,'0.00')}
</td>
<td>
${w:format(serviceInfo.tps,'0.00')}
</td>
<c:set
var=
"id"
value=
"
${
serviceInfo
.
id
}
"
/>
<c:set
var=
"callerInfo"
value=
"
${
model
.
methodInfo
.
callerProjectsInfo
}
"
/>
<c:if
test=
"
${
!
empty
callerInfo
}
"
>
<td></td>
<td
class=
"left"
>
${callerInfo[id].type}
</td>
<td
class=
"left"
>
${callerInfo[id].ip}
</td>
<td
class=
"left"
>
${callerInfo[id].id}
</td>
<td>
${w:format(callerInfo[id].totalCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(callerInfo[id].failureCount,'#,###,###,###,##0')}
</td>
<td>
${w:format(callerInfo[id].failurePercent,'0.0000%')}
</td>
<td>
${w:format(callerInfo[id].avg,'0.00')}
</td>
<td>
${w:format(callerInfo[id].tps,'0.00')}
</td>
</c:if>
</tr>
</c:forEach>
</c:if>
</c:if>
</table>
</jsp:body>
</a:report>
cat-home/src/test/java/com/dianping/cat/report/page/cross/CrossTest.java
0 → 100644
浏览文件 @
29fc6ed9
package
com.dianping.cat.report.page.cross
;
import
org.junit.Test
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.message.Transaction
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.internal.DefaultMessageTree
;
public
class
CrossTest
{
@Test
public
void
test
()
throws
InterruptedException
{
while
(
true
)
{
Transaction
tClient
=
Cat
.
newTransaction
(
"PigeonCall"
,
"Cat-Test-Call"
);
MessageTree
tree1
=
Cat
.
getManager
().
getThreadLocalMessageTree
();
((
DefaultMessageTree
)
tree1
).
setDomain
(
"cat"
);
((
DefaultMessageTree
)
tree1
).
setIpAddress
(
"10.1.2.15"
);
Cat
.
logEvent
(
"PigeonCall.server"
,
"10.1.2.17:3000"
);
Cat
.
logEvent
(
"PigeonCall.app"
,
"catServer"
);
tClient
.
setStatus
(
Transaction
.
SUCCESS
);
Thread
.
sleep
(
100
);
tClient
.
complete
();
Transaction
tClient3
=
Cat
.
newTransaction
(
"PigeonCall"
,
"new-call"
);
MessageTree
tree5
=
Cat
.
getManager
().
getThreadLocalMessageTree
();
((
DefaultMessageTree
)
tree5
).
setDomain
(
"cat"
);
((
DefaultMessageTree
)
tree5
).
setIpAddress
(
"10.1.2.15"
);
Cat
.
logEvent
(
"PigeonCall.server"
,
"10.1.2.17:3000"
);
Cat
.
logEvent
(
"PigeonCall.app"
,
"catServer"
);
tClient3
.
setStatus
(
Transaction
.
SUCCESS
);
Thread
.
sleep
(
100
);
tClient3
.
complete
();
Transaction
tServer
=
Cat
.
newTransaction
(
"PigeonService"
,
"Cat-Test-Call"
);
MessageTree
tree2
=
Cat
.
getManager
().
getThreadLocalMessageTree
();
((
DefaultMessageTree
)
tree2
).
setDomain
(
"cat"
);
((
DefaultMessageTree
)
tree2
).
setIpAddress
(
"10.1.2.15"
);
Cat
.
logEvent
(
"PigeonService.client"
,
"10.1.2.16:3000"
);
Cat
.
logEvent
(
"PigeonService.app"
,
"catClient1"
);
tServer
.
setStatus
(
Transaction
.
SUCCESS
);
tServer
.
complete
();
Transaction
tClient2
=
Cat
.
newTransaction
(
"PigeonCall"
,
"Cat-Test-Call"
);
MessageTree
tree3
=
Cat
.
getManager
().
getThreadLocalMessageTree
();
((
DefaultMessageTree
)
tree3
).
setDomain
(
"catServer"
);
((
DefaultMessageTree
)
tree3
).
setIpAddress
(
"10.1.2.17"
);
Cat
.
logEvent
(
"PigeonCall.server"
,
"10.1.2.18:3000"
);
Cat
.
logEvent
(
"PigeonCall.app"
,
"Server"
);
tClient2
.
setStatus
(
Transaction
.
SUCCESS
);
tClient2
.
complete
();
Transaction
tServer2
=
Cat
.
newTransaction
(
"PigeonService"
,
"Cat-Test-Call"
);
MessageTree
tree4
=
Cat
.
getManager
().
getThreadLocalMessageTree
();
((
DefaultMessageTree
)
tree4
).
setDomain
(
"catServer"
);
((
DefaultMessageTree
)
tree4
).
setIpAddress
(
"10.1.2.17"
);
Cat
.
logEvent
(
"PigeonService.client"
,
"10.1.2.15"
);
Cat
.
logEvent
(
"PigeonService.app"
,
"cat"
);
tServer2
.
setStatus
(
Transaction
.
SUCCESS
);
tServer2
.
complete
();
Transaction
tServer3
=
Cat
.
newTransaction
(
"PigeonService"
,
"new-call"
);
MessageTree
tree6
=
Cat
.
getManager
().
getThreadLocalMessageTree
();
((
DefaultMessageTree
)
tree6
).
setDomain
(
"catServer"
);
((
DefaultMessageTree
)
tree6
).
setIpAddress
(
"10.1.2.17"
);
Cat
.
logEvent
(
"PigeonService.client"
,
"10.1.2.15"
);
Cat
.
logEvent
(
"PigeonService.app"
,
"cat"
);
tServer3
.
setStatus
(
Transaction
.
SUCCESS
);
tServer3
.
complete
();
try
{
Thread
.
sleep
(
500
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录