Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
3e3e41e0
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,发现更多精彩内容 >>
提交
3e3e41e0
编写于
7月 23, 2014
作者:
Y
youyong205
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #409 from youyong205/master
fix many bug
上级
27a94317
4a91e8a2
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
362 addition
and
282 deletion
+362
-282
cat-broker/pom.xml
cat-broker/pom.xml
+170
-164
cat-broker/src/main/java/com/dianping/cat/broker/api/page/batch/Handler.java
.../java/com/dianping/cat/broker/api/page/batch/Handler.java
+19
-2
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/metric/MetricAnalyzer.java
...java/com/dianping/cat/consumer/metric/MetricAnalyzer.java
+17
-11
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/metric/MetricConfigManager.java
...com/dianping/cat/consumer/metric/MetricConfigManager.java
+3
-8
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/metric/ProductLineConfigManager.java
...ianping/cat/consumer/metric/ProductLineConfigManager.java
+12
-7
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/metric/MetricConfigManagerTest.java
...dianping/cat/consumer/metric/MetricConfigManagerTest.java
+17
-0
cat-core/src/main/java/com/dianping/cat/config/app/AppDataCommandTableProvider.java
.../dianping/cat/config/app/AppDataCommandTableProvider.java
+1
-1
cat-core/src/main/java/com/dianping/cat/config/app/QueryEntity.java
...rc/main/java/com/dianping/cat/config/app/QueryEntity.java
+22
-18
cat-core/src/main/resources/META-INF/dal/jdbc/app-dal.xml
cat-core/src/main/resources/META-INF/dal/jdbc/app-dal.xml
+14
-14
cat-home/pom.xml
cat-home/pom.xml
+21
-16
cat-home/src/main/java/com/dianping/cat/report/page/app/Payload.java
...c/main/java/com/dianping/cat/report/page/app/Payload.java
+1
-1
cat-home/src/main/java/com/dianping/cat/report/page/app/graph/AppGraphCreator.java
...m/dianping/cat/report/page/app/graph/AppGraphCreator.java
+10
-8
cat-home/src/main/java/com/dianping/cat/report/page/heartbeat/DisplayHeartbeat.java
.../dianping/cat/report/page/heartbeat/DisplayHeartbeat.java
+54
-31
cat-home/src/main/webapp/WEB-INF/tags/body.tag
cat-home/src/main/webapp/WEB-INF/tags/body.tag
+1
-1
未找到文件。
cat-broker/pom.xml
浏览文件 @
3e3e41e0
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
<parent>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
parent
</artifactId>
<version>
1.0.5
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
broker-service
</artifactId>
<name>
broker-service
</name>
<packaging>
war
</packaging>
<dependencies>
<dependency>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
cat-core
</artifactId>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
1.6
</version>
</dependency>
<dependency>
<groupId>
org.unidal.webres
</groupId>
<artifactId>
WebResServer
</artifactId>
<version>
1.2.1
</version>
</dependency>
<dependency>
<groupId>
org.unidal.framework
</groupId>
<artifactId>
web-framework
</artifactId>
<version>
2.0.5
</version>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
servlet-api
</artifactId>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
jstl
</artifactId>
<version>
1.2
</version>
</dependency>
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
jsp-api-2.1
</artifactId>
<version>
6.1.14
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
jsp-2.1
</artifactId>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<scope>
runtime
</scope>
</dependency>
<dependency>
<groupId>
org.freemarker
</groupId>
<artifactId>
freemarker
</artifactId>
<version>
2.3.9
</version>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
jetty
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.unidal.framework
</groupId>
<artifactId>
test-framework
</artifactId>
<version>
2.0.4
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-email
</artifactId>
<version>
1.1
</version>
</dependency>
<dependency>
<groupId>
javax.mail
</groupId>
<artifactId>
mail
</artifactId>
<version>
1.4.4
</version>
</dependency>
<dependency>
<groupId>
com.google.code.javaparser
</groupId>
<artifactId>
javaparser
</artifactId>
<version>
1.0.8
</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>
${basedir}/src/main/resources
</directory>
<filtering>
true
</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>
org.unidal.maven.plugins
</groupId>
<artifactId>
codegen-maven-plugin
</artifactId>
<version>
2.0.9
</version>
<executions>
<execution>
<id>
generate plexus component descriptor
</id>
<phase>
process-classes
</phase>
<goals>
<goal>
plexus
</goal>
</goals>
<configuration>
<className>
com.dianping.cat.broker.build.ComponentsConfigurator
</className>
<env>
dev
</env>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-war-plugin
</artifactId>
<version>
2.1.1
</version>
<configuration>
<warName>
broker-service-${env}-${version}
</warName>
<webResources>
<resource>
<directory>
src/main/resources
</directory>
<filtering>
false
</filtering>
<targetPath>
WEB-INF/classes
</targetPath>
</resource>
<resource>
<directory>
src/main/webapp
</directory>
<filtering>
false
</filtering>
<includes>
<include>
WEB-INF/web.xml
</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
maven-jetty-plugin
</artifactId>
<version>
6.1.26
</version>
<configuration>
<scanIntervalSeconds>
10
</scanIntervalSeconds>
<contextPath>
/cat
</contextPath>
<defaultsDescriptor>
src/main/webapp/WEB-INF/web.xml
</defaultsDescriptor>
<connectors>
<connector
implementation=
"org.mortbay.jetty.nio.SelectChannelConnector"
>
<port>
2281
</port>
<maxIdleTime>
500000
</maxIdleTime>
</connector>
</connectors>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<packaging>
war
</packaging>
<env>
alpha
</env>
<project.build.sourceEncoding>
utf-8
</project.build.sourceEncoding>
</properties>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
<parent>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
parent
</artifactId>
<version>
1.0.5
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
broker-service
</artifactId>
<name>
broker-service
</name>
<packaging>
war
</packaging>
<dependencies>
<dependency>
<groupId>
com.dianping.cat
</groupId>
<artifactId>
cat-core
</artifactId>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
1.6
</version>
</dependency>
<dependency>
<groupId>
org.unidal.framework
</groupId>
<artifactId>
dal-jdbc
</artifactId>
<version>
2.1.1
</version>
</dependency>
<dependency>
<groupId>
org.unidal.webres
</groupId>
<artifactId>
WebResServer
</artifactId>
<version>
1.2.1
</version>
</dependency>
<dependency>
<groupId>
org.unidal.framework
</groupId>
<artifactId>
web-framework
</artifactId>
<version>
2.0.5
</version>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
servlet-api
</artifactId>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
jstl
</artifactId>
<version>
1.2
</version>
</dependency>
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
jsp-api-2.1
</artifactId>
<version>
6.1.14
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
jsp-2.1
</artifactId>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<scope>
runtime
</scope>
</dependency>
<dependency>
<groupId>
org.freemarker
</groupId>
<artifactId>
freemarker
</artifactId>
<version>
2.3.9
</version>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
jetty
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.unidal.framework
</groupId>
<artifactId>
test-framework
</artifactId>
<version>
2.0.4
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-email
</artifactId>
<version>
1.1
</version>
</dependency>
<dependency>
<groupId>
javax.mail
</groupId>
<artifactId>
mail
</artifactId>
<version>
1.4.4
</version>
</dependency>
<dependency>
<groupId>
com.google.code.javaparser
</groupId>
<artifactId>
javaparser
</artifactId>
<version>
1.0.8
</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>
${basedir}/src/main/resources
</directory>
<filtering>
true
</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>
org.unidal.maven.plugins
</groupId>
<artifactId>
codegen-maven-plugin
</artifactId>
<version>
2.0.9
</version>
<executions>
<execution>
<id>
generate plexus component descriptor
</id>
<phase>
process-classes
</phase>
<goals>
<goal>
plexus
</goal>
</goals>
<configuration>
<className>
com.dianping.cat.broker.build.ComponentsConfigurator
</className>
<env>
dev
</env>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-war-plugin
</artifactId>
<version>
2.1.1
</version>
<configuration>
<warName>
broker-service-${env}-${version}
</warName>
<webResources>
<resource>
<directory>
src/main/resources
</directory>
<filtering>
false
</filtering>
<targetPath>
WEB-INF/classes
</targetPath>
</resource>
<resource>
<directory>
src/main/webapp
</directory>
<filtering>
false
</filtering>
<includes>
<include>
WEB-INF/web.xml
</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
maven-jetty-plugin
</artifactId>
<version>
6.1.26
</version>
<configuration>
<scanIntervalSeconds>
10
</scanIntervalSeconds>
<contextPath>
/cat
</contextPath>
<defaultsDescriptor>
src/main/webapp/WEB-INF/web.xml
</defaultsDescriptor>
<connectors>
<connector
implementation=
"org.mortbay.jetty.nio.SelectChannelConnector"
>
<port>
2281
</port>
<maxIdleTime>
500000
</maxIdleTime>
</connector>
</connectors>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<packaging>
war
</packaging>
<env>
alpha
</env>
<project.build.sourceEncoding>
utf-8
</project.build.sourceEncoding>
</properties>
</project>
cat-broker/src/main/java/com/dianping/cat/broker/api/page/batch/Handler.java
浏览文件 @
3e3e41e0
package
com.dianping.cat.broker.api.page.batch
;
import
java.io.IOException
;
import
java.net.URLDecoder
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -15,6 +16,7 @@ import org.unidal.web.mvc.annotation.InboundActionMeta;
import
org.unidal.web.mvc.annotation.OutboundActionMeta
;
import
org.unidal.web.mvc.annotation.PayloadMeta
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.broker.api.app.AppData
;
import
com.dianping.cat.broker.api.app.AppDataConsumer
;
import
com.dianping.cat.broker.api.page.Constrants
;
...
...
@@ -24,6 +26,7 @@ import com.dianping.cat.broker.api.page.MonitorEntity;
import
com.dianping.cat.broker.api.page.MonitorManager
;
import
com.dianping.cat.broker.api.page.RequestUtils
;
import
com.dianping.cat.config.app.AppConfigManager
;
import
com.dianping.cat.message.Event
;
public
class
Handler
implements
PageHandler
<
Context
>,
LogEnabled
{
...
...
@@ -64,18 +67,27 @@ public class Handler implements PageHandler<Context>, LogEnabled {
HttpServletResponse
response
=
ctx
.
getHttpServletResponse
();
String
userIp
=
m_util
.
getRemoteIp
(
request
);
String
version
=
payload
.
getVersion
();
boolean
success
=
true
;
if
(
userIp
!=
null
)
{
if
(
"1"
.
equals
(
version
))
{
processVersion1
(
payload
,
request
,
userIp
);
}
else
if
(
"2"
.
equals
(
version
))
{
processVersion2
(
payload
,
request
,
userIp
);
}
else
{
success
=
false
;
Cat
.
logEvent
(
"InvalidVersion"
,
version
,
Event
.
SUCCESS
,
version
);
}
}
else
{
success
=
false
;
m_logger
.
info
(
"unknown http request, x-forwarded-for:"
+
request
.
getHeader
(
"x-forwarded-for"
));
}
response
.
getWriter
().
write
(
"OK"
);
if
(
success
)
{
response
.
getWriter
().
write
(
"OK"
);
}
else
{
response
.
getWriter
().
write
(
"validate request!"
);
}
}
private
void
processVersion1
(
Payload
payload
,
HttpServletRequest
request
,
String
userIp
)
{
...
...
@@ -144,7 +156,7 @@ public class Handler implements PageHandler<Context>, LogEnabled {
try
{
appData
.
setTimestamp
(
Long
.
parseLong
(
items
[
0
]));
Integer
command
=
m_appConfigManager
.
getCommands
().
get
(
items
[
1
]
);
Integer
command
=
m_appConfigManager
.
getCommands
().
get
(
URLDecoder
.
decode
(
items
[
1
],
"utf-8"
)
);
if
(
command
!=
null
)
{
appData
.
setCommand
(
command
);
...
...
@@ -161,10 +173,15 @@ public class Handler implements PageHandler<Context>, LogEnabled {
appData
.
setCount
(
1
);
m_appDataConsumer
.
enqueue
(
appData
);
Cat
.
logEvent
(
"Command"
,
String
.
valueOf
(
command
),
Event
.
SUCCESS
,
null
);
}
else
{
Cat
.
logEvent
(
"CommandNotFound"
,
items
[
1
],
Event
.
SUCCESS
,
items
[
1
]);
}
}
catch
(
Exception
e
)
{
m_logger
.
error
(
e
.
getMessage
(),
e
);
}
}
else
{
Cat
.
logEvent
(
"InvalidPar"
,
items
[
1
],
Event
.
SUCCESS
,
items
[
1
]);
}
}
...
...
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/metric/MetricAnalyzer.java
浏览文件 @
3e3e41e0
...
...
@@ -16,6 +16,7 @@ import com.dianping.cat.analysis.AbstractMessageAnalyzer;
import
com.dianping.cat.configuration.NetworkInterfaceManager
;
import
com.dianping.cat.consumer.advanced.dal.BusinessReport
;
import
com.dianping.cat.consumer.advanced.dal.BusinessReportDao
;
import
com.dianping.cat.consumer.company.model.entity.ProductLine
;
import
com.dianping.cat.consumer.metric.model.entity.MetricItem
;
import
com.dianping.cat.consumer.metric.model.entity.MetricReport
;
import
com.dianping.cat.consumer.metric.model.entity.Segment
;
...
...
@@ -170,7 +171,12 @@ public class MetricAnalyzer extends AbstractMessageAnalyzer<MetricReport> implem
ConfigItem
config
=
parseValue
(
status
,
data
);
if
(!
StringUtils
.
isEmpty
(
group
))
{
m_productLineConfigManager
.
insertIfNotExsit
(
group
,
domain
);
boolean
result
=
m_productLineConfigManager
.
insertIfNotExsit
(
group
,
domain
);
if
(!
result
)
{
m_logger
.
error
(
String
.
format
(
"error when insert product line info, productline %s, domain %s"
,
group
,
domain
));
}
report
=
findOrCreateReport
(
group
);
}
...
...
@@ -184,21 +190,21 @@ public class MetricAnalyzer extends AbstractMessageAnalyzer<MetricReport> implem
updateMetric
(
metricItem
,
min
,
config
.
getCount
(),
config
.
getValue
());
config
.
setTitle
(
metricName
);
if
(!
isNetwork
(
group
)
&&
!
isSystem
(
group
))
{
m_configManager
.
insertIfNotExist
(
domain
,
METRIC
,
metricName
,
config
);
ProductLine
productline
=
m_productLineConfigManager
.
queryProductLine
(
group
);
if
(
productline
!=
null
&&
productline
.
getMetricDashboard
())
{
boolean
result
=
m_configManager
.
insertIfNotExist
(
domain
,
METRIC
,
metricName
,
config
);
if
(!
result
)
{
m_logger
.
error
(
String
.
format
(
"error when insert metric config info, domain %s, metricName %s"
,
domain
,
metricName
));
}
}
}
return
0
;
}
private
boolean
isNetwork
(
String
group
)
{
return
group
.
startsWith
(
"f5"
)
||
group
.
startsWith
(
"switch"
);
}
private
boolean
isSystem
(
String
group
)
{
return
group
.
startsWith
(
"system"
);
}
private
int
processTransaction
(
MetricReport
report
,
MessageTree
tree
,
Transaction
t
)
{
int
count
=
0
;
List
<
Message
>
children
=
t
.
getChildren
();
...
...
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/metric/MetricConfigManager.java
浏览文件 @
3e3e41e0
...
...
@@ -19,10 +19,10 @@ import org.unidal.lookup.annotation.Inject;
import
org.xml.sax.SAXException
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.Constants
;
import
com.dianping.cat.advanced.metric.config.entity.MetricConfig
;
import
com.dianping.cat.advanced.metric.config.entity.MetricItemConfig
;
import
com.dianping.cat.advanced.metric.config.transform.DefaultSaxParser
;
import
com.dianping.cat.consumer.company.model.entity.ProductLine
;
import
com.dianping.cat.consumer.metric.MetricAnalyzer.ConfigItem
;
import
com.dianping.cat.core.config.Config
;
import
com.dianping.cat.core.config.ConfigDao
;
...
...
@@ -102,14 +102,9 @@ public class MetricConfigManager implements Initializable {
for
(
MetricItemConfig
config
:
configs
.
values
())
{
String
domain
=
config
.
getDomain
();
String
productLine
=
m_productLineConfigManager
.
queryProductLineByDomain
(
domain
);
ProductLine
product
=
m_productLineConfigManager
.
queryProductLine
(
productLine
);
if
(
Constants
.
BROKER_SERVICE
.
equals
(
domain
))
{
unused
.
add
(
config
.
getId
());
}
if
(
"Default"
.
equals
(
productLine
))
{
unused
.
add
(
config
.
getId
());
}
if
(!
config
.
getId
().
contains
(
":Metric:"
))
{
if
(
product
==
null
||
!
product
.
isMetricDashboard
())
{
unused
.
add
(
config
.
getId
());
}
}
...
...
cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/metric/ProductLineConfigManager.java
浏览文件 @
3e3e41e0
...
...
@@ -152,16 +152,16 @@ public class ProductLineConfigManager implements Initializable, LogEnabled {
productLine
.
setDashboard
(
metricDashboard
);
}
public
boolean
insertIfNotExsit
(
String
line
,
String
domain
)
{
public
boolean
insertIfNotExsit
(
String
product
,
String
domain
)
{
Company
company
=
getCompany
();
if
(
company
!=
null
)
{
ProductLine
productLine
=
company
.
getProductLines
().
get
(
line
);
ProductLine
productLine
=
company
.
getProductLines
().
get
(
product
);
if
(
productLine
==
null
)
{
productLine
=
new
ProductLine
();
productLine
.
setId
(
line
);
productLine
.
setTitle
(
line
);
productLine
.
setId
(
product
);
productLine
.
setTitle
(
product
);
buildDefaultDashboard
(
productLine
,
domain
);
productLine
.
addDomain
(
new
Domain
(
domain
));
company
.
addProductLine
(
productLine
);
...
...
@@ -215,11 +215,16 @@ public class ProductLineConfigManager implements Initializable, LogEnabled {
return
domains
;
}
public
ProductLine
queryProductLine
(
String
id
)
{
return
getCompany
().
findProductLine
(
id
);
}
public
Map
<
String
,
ProductLine
>
queryMetricProductLines
()
{
Map
<
String
,
ProductLine
>
productLines
=
new
TreeMap
<
String
,
ProductLine
>();
for
(
ProductLine
line
:
getCompany
().
getProductLines
().
values
())
{
String
id
=
line
.
getId
();
if
(
id
!=
null
&&
id
.
length
()
>
0
&&
line
.
getMetricDashboard
())
{
productLines
.
put
(
id
,
line
);
}
...
...
@@ -248,7 +253,7 @@ public class ProductLineConfigManager implements Initializable, LogEnabled {
return
productLine
==
null
?
"Default"
:
productLine
;
}
public
Map
<
String
,
List
<
ProductLine
>>
queryTypeProductLines
()
{
Map
<
String
,
List
<
ProductLine
>>
productLines
=
new
LinkedHashMap
<
String
,
List
<
ProductLine
>>();
...
...
@@ -343,13 +348,13 @@ public class ProductLineConfigManager implements Initializable, LogEnabled {
config
.
setName
(
CONFIG_NAME
);
config
.
setContent
(
getCompany
().
toString
());
m_configDao
.
updateByPK
(
config
,
ConfigEntity
.
UPDATESET_FULL
);
m_domainToProductLines
=
buildDomainToProductLines
();
return
true
;
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
return
false
;
}
m_domainToProductLines
=
buildDomainToProductLines
();
}
return
true
;
}
}
\ No newline at end of file
cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/metric/MetricConfigManagerTest.java
浏览文件 @
3e3e41e0
...
...
@@ -75,6 +75,23 @@ public class MetricConfigManagerTest {
Assert
.
assertEquals
(
3L
,
configs
.
get
(
item
).
longValue
());
Assert
.
assertEquals
(
1
,
configs
.
size
());
}
@Test
public
void
testInit
(){
MetricConfigManager
manager
=
new
MockMetricConfigManager
();
((
MockMetricConfigManager
)
manager
).
setConfigDao
(
new
MockConfigDao2
());
try
{
manager
.
initialize
();
}
catch
(
Exception
e
)
{
}
s_storeCount
=
0
;
manager
.
insertIfNotExist
(
"test"
,
"test"
,
"test"
,
new
ConfigItem
());
manager
.
insertIfNotExist
(
"test"
,
"test"
,
"test"
,
new
ConfigItem
());
manager
.
insertIfNotExist
(
"test1"
,
"test"
,
"test"
,
new
ConfigItem
());
manager
.
insertIfNotExist
(
"test1"
,
"test"
,
"test"
,
new
ConfigItem
());
Assert
.
assertEquals
(
s_storeCount
,
2
);
}
@Test
public
void
testInitThrowException
()
throws
Exception
{
...
...
cat-core/src/main/java/com/dianping/cat/config/app/AppDataCommandTableProvider.java
浏览文件 @
3e3e41e0
...
...
@@ -23,7 +23,7 @@ public class AppDataCommandTableProvider implements TableProvider {
public
String
getLogicalTableName
()
{
return
m_logicalTableName
;
}
@Override
public
String
getPhysicalTableName
(
Map
<
String
,
Object
>
hints
)
{
AppDataCommand
command
=
(
AppDataCommand
)
hints
.
get
(
QueryEngine
.
HINT_DATA_OBJECT
);
...
...
cat-core/src/main/java/com/dianping/cat/config/app/QueryEntity.java
浏览文件 @
3e3e41e0
...
...
@@ -2,7 +2,9 @@ package com.dianping.cat.config.app;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.List
;
import
org.unidal.helper.Splitters
;
import
org.unidal.lookup.util.StringUtils
;
import
com.dianping.cat.Cat
;
...
...
@@ -13,34 +15,36 @@ public class QueryEntity {
private
int
m_command
;
private
int
m_code
;
private
int
m_code
=
DEFAULT_VALUE
;
private
int
m_network
;
private
int
m_network
=
DEFAULT_VALUE
;
private
int
m_version
;
private
int
m_version
=
DEFAULT_VALUE
;
private
int
m_channel
;
private
int
m_channel
=
DEFAULT_VALUE
;
private
int
m_platfrom
;
private
int
m_platfrom
=
DEFAULT_VALUE
;
private
int
m_city
;
private
int
m_city
=
DEFAULT_VALUE
;
private
int
m_operator
;
private
int
m_operator
=
DEFAULT_VALUE
;
private
static
final
int
DEFAULT_VALUE
=
-
1
;
public
QueryEntity
(
String
query
)
{
String
[]
strs
=
query
.
split
(
";"
);
List
<
String
>
strs
=
Splitters
.
by
(
";"
).
split
(
query
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
try
{
m_date
=
sdf
.
parse
(
strs
[
0
]
);
m_command
=
parseValue
(
strs
[
1
]
);
m_code
=
parseValue
(
strs
[
2
]
);
m_network
=
parseValue
(
strs
[
3
]
);
m_version
=
parseValue
(
strs
[
4
]
);
m_channel
=
parseValue
(
strs
[
5
]
);
m_platfrom
=
parseValue
(
strs
[
6
]
);
m_city
=
parseValue
(
strs
[
7
]
);
m_operator
=
parseValue
(
strs
[
8
]
);
m_date
=
sdf
.
parse
(
strs
.
get
(
0
)
);
m_command
=
parseValue
(
strs
.
get
(
1
)
);
m_code
=
parseValue
(
strs
.
get
(
2
)
);
m_network
=
parseValue
(
strs
.
get
(
3
)
);
m_version
=
parseValue
(
strs
.
get
(
4
)
);
m_channel
=
parseValue
(
strs
.
get
(
5
)
);
m_platfrom
=
parseValue
(
strs
.
get
(
6
)
);
m_city
=
parseValue
(
strs
.
get
(
7
)
);
m_operator
=
parseValue
(
strs
.
get
(
8
)
);
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
...
...
@@ -48,7 +52,7 @@ public class QueryEntity {
private
int
parseValue
(
String
str
)
{
if
(
StringUtils
.
isEmpty
(
str
))
{
return
-
1
;
return
DEFAULT_VALUE
;
}
else
{
return
Integer
.
parseInt
(
str
);
}
...
...
cat-core/src/main/resources/META-INF/dal/jdbc/app-dal.xml
浏览文件 @
3e3e41e0
...
...
@@ -44,25 +44,25 @@
<statement>
<![CDATA[SELECT <FIELDS/>
FROM
<TABLE/>
WHERE
<FIELD
name=
'period'
/>
= ${period}
<IF
type=
'N
OT_ZERO'
field=
'city
'
>
<IF
type=
'N
E'
field=
'city'
value=
'-1
'
>
AND
<FIELD
name=
'city'
/>
= ${city}
</IF>
<IF
type=
'N
OT_ZERO'
field=
'operator
'
>
<IF
type=
'N
E'
field=
'operator'
value=
'-1
'
>
AND
<FIELD
name=
'operator'
/>
= ${operator}
</IF>
<IF
type=
'N
OT_ZERO'
field=
'network
'
>
<IF
type=
'N
E'
field=
'network'
value=
'-1
'
>
AND
<FIELD
name=
'network'
/>
= ${network}
</IF>
<IF
type=
'N
OT_ZERO'
field=
'app-version
'
>
<IF
type=
'N
E'
field=
'app-version'
value=
'-1
'
>
AND
<FIELD
name=
'app-version'
/>
= ${app-version}
</IF>
<IF
type=
'N
OT_ZERO'
field=
'connnect-type
'
>
<IF
type=
'N
E'
field=
'connnect-type'
value=
'-1
'
>
AND
<FIELD
name=
'connnect-type'
/>
= ${connnect-type}
</IF>
<IF
type=
'N
OT_ZERO'
field=
'code
'
>
<IF
type=
'N
E'
field=
'code'
value=
'-1
'
>
AND
<FIELD
name=
'code'
/>
= ${code}
</IF>
<IF
type=
'N
OT_ZERO'
field=
'platform
'
>
<IF
type=
'N
E'
field=
'platform'
value=
'-1
'
>
AND
<FIELD
name=
'platform'
/>
= ${platform}
</IF>
group by
<FIELD
name=
'minute-order'
/>
]]>
</statement>
...
...
@@ -80,25 +80,25 @@
<statement>
<![CDATA[SELECT <FIELDS/>
FROM
<TABLE/>
WHERE
<FIELD
name=
'period'
/>
= ${period}
<IF
type=
'N
OT_ZERO'
field=
'city
'
>
<IF
type=
'N
E'
field=
'city'
value=
'-1
'
>
AND
<FIELD
name=
'city'
/>
= ${city}
</IF>
<IF
type=
'N
OT_ZERO'
field=
'operator
'
>
<IF
type=
'N
E'
field=
'operator'
value=
'-1
'
>
AND
<FIELD
name=
'operator'
/>
= ${operator}
</IF>
<IF
type=
'N
OT_ZERO'
field=
'network
'
>
<IF
type=
'N
E'
field=
'network'
value=
'-1
'
>
AND
<FIELD
name=
'network'
/>
= ${network}
</IF>
<IF
type=
'N
OT_ZERO'
field=
'app-version
'
>
<IF
type=
'N
E'
field=
'app-version'
value=
'-1
'
>
AND
<FIELD
name=
'app-version'
/>
= ${app-version}
</IF>
<IF
type=
'N
OT_ZERO'
field=
'connnect-type
'
>
<IF
type=
'N
E'
field=
'connnect-type'
value=
'-1
'
>
AND
<FIELD
name=
'connnect-type'
/>
= ${connnect-type}
</IF>
<IF
type=
'N
OT_ZERO'
field=
'code
'
>
<IF
type=
'N
E'
field=
'code'
value=
'-1
'
>
AND
<FIELD
name=
'code'
/>
= ${code}
</IF>
<IF
type=
'N
OT_ZERO'
field=
'platform
'
>
<IF
type=
'N
E'
field=
'platform'
value=
'-1
'
>
AND
<FIELD
name=
'platform'
/>
= ${platform}
</IF>
group by
<FIELD
name=
'minute-order'
/>
,
<FIELD
name=
'code'
/>
]]>
</statement>
...
...
cat-home/pom.xml
浏览文件 @
3e3e41e0
...
...
@@ -54,6 +54,11 @@
<artifactId>
jstl
</artifactId>
<version>
1.2
</version>
</dependency>
<dependency>
<groupId>
org.unidal.framework
</groupId>
<artifactId>
dal-jdbc
</artifactId>
<version>
2.1.1
</version>
</dependency>
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
jsp-api-2.1
</artifactId>
...
...
@@ -149,14 +154,14 @@
${basedir}/src/main/resources/META-INF/dal/model/heavy-report-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/utilization-report-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/domainGroup-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/metric-group-config-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/metric-group-config-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/metric-aggregation-config-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/netgraph-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/alert-report-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/monitor-rules-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/alertconfig-manifest.xml,
${basedir}/src/main/resources/META-INF/dal/model/alertsummary-manifest.xml,
</manifest>
</manifest>
</configuration>
</execution>
<execution>
...
...
@@ -197,20 +202,20 @@
</configuration>
</plugin>
<plugin>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
maven-jetty-plugin
</artifactId>
<version>
6.1.26
</version>
<configuration>
<scanIntervalSeconds>
10
</scanIntervalSeconds>
<contextPath>
/cat
</contextPath>
<defaultsDescriptor>
src/main/webapp/WEB-INF/web.xml
</defaultsDescriptor>
<connectors>
<connector
implementation=
"org.mortbay.jetty.nio.SelectChannelConnector"
>
<port>
2281
</port>
<maxIdleTime>
500000
</maxIdleTime>
</connector>
</connectors>
</configuration>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
maven-jetty-plugin
</artifactId>
<version>
6.1.26
</version>
<configuration>
<scanIntervalSeconds>
10
</scanIntervalSeconds>
<contextPath>
/cat
</contextPath>
<defaultsDescriptor>
src/main/webapp/WEB-INF/web.xml
</defaultsDescriptor>
<connectors>
<connector
implementation=
"org.mortbay.jetty.nio.SelectChannelConnector"
>
<port>
2281
</port>
<maxIdleTime>
500000
</maxIdleTime>
</connector>
</connectors>
</configuration>
</plugin>
</plugins>
</build>
...
...
cat-home/src/main/java/com/dianping/cat/report/page/app/Payload.java
浏览文件 @
3e3e41e0
...
...
@@ -41,7 +41,7 @@ public class Payload extends AbstractReportPayload<Action> {
return
null
;
}
}
@Override
public
Action
getAction
()
{
return
m_action
;
...
...
cat-home/src/main/java/com/dianping/cat/report/page/app/graph/AppGraphCreator.java
浏览文件 @
3e3e41e0
...
...
@@ -3,6 +3,7 @@ package com.dianping.cat.report.page.app.graph;
import
java.util.Date
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
import
org.unidal.lookup.annotation.Inject
;
...
...
@@ -19,18 +20,18 @@ public class AppGraphCreator extends AbstractGraphCreator {
private
AppDataService
m_appDataService
;
public
LineChart
buildLineChart
(
QueryEntity
queryEntity1
,
QueryEntity
queryEntity2
,
String
type
)
{
Li
nkedList
<
double
[]>
dataList
=
new
LinkedList
<
double
[]>();
Li
st
<
double
[]>
datas
=
new
LinkedList
<
double
[]>();
if
(
queryEntity1
!=
null
)
{
double
[]
data1
=
prepareQueryData
(
queryEntity1
,
type
);
data
List
.
add
(
data1
);
data
s
.
add
(
data1
);
}
if
(
queryEntity2
!=
null
)
{
double
[]
values2
=
prepareQueryData
(
queryEntity2
,
type
);
data
List
.
add
(
values2
);
data
s
.
add
(
values2
);
}
return
buildChartData
(
data
List
,
type
);
return
buildChartData
(
data
s
,
type
);
}
private
double
[]
prepareQueryData
(
QueryEntity
queryEntity
,
String
type
)
{
...
...
@@ -51,15 +52,16 @@ public class AppGraphCreator extends AbstractGraphCreator {
}
}
public
LineChart
buildChartData
(
final
Li
nkedList
<
double
[]>
dataList
,
String
type
)
{
public
LineChart
buildChartData
(
final
Li
st
<
double
[]>
datas
,
String
type
)
{
LineChart
lineChart
=
new
LineChart
();
lineChart
.
setId
(
"app"
);
lineChart
.
setHtmlTitle
(
queryType
(
type
));
int
length
=
data
List
.
size
();
int
length
=
data
s
.
size
();
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
double
[]
data
=
dataList
.
get
(
i
);
lineChart
.
add
(
"查询"
+
i
++,
data
);
double
[]
data
=
datas
.
get
(
i
);
lineChart
.
add
(
"查询"
+
(
i
+
1
),
data
);
}
return
lineChart
;
}
...
...
cat-home/src/main/java/com/dianping/cat/report/page/heartbeat/DisplayHeartbeat.java
浏览文件 @
3e3e41e0
...
...
@@ -17,7 +17,6 @@ import com.dianping.cat.consumer.heartbeat.model.entity.Machine;
import
com.dianping.cat.consumer.heartbeat.model.entity.Period
;
import
com.dianping.cat.report.graph.AbstractGraphPayload
;
import
com.dianping.cat.report.graph.GraphBuilder
;
import
com.site.helper.Splitters
;
public
class
DisplayHeartbeat
{
private
static
final
int
K
=
1024
;
...
...
@@ -124,7 +123,8 @@ public class DisplayHeartbeat {
m_systemLoadAverage
[
minute
]
=
period
.
getSystemLoadAverage
();
for
(
Entry
<
String
,
Extension
>
entry
:
period
.
getExtensions
().
entrySet
())
{
for
(
Entry
<
String
,
Extension
>
entry
:
period
.
getExtensions
()
.
entrySet
())
{
Map
<
String
,
double
[]>
groups
=
m_extensions
.
get
(
entry
.
getKey
());
if
(
groups
==
null
)
{
...
...
@@ -132,7 +132,8 @@ public class DisplayHeartbeat {
m_extensions
.
put
(
entry
.
getKey
(),
groups
);
}
for
(
Entry
<
String
,
Detail
>
detail
:
entry
.
getValue
().
getDetails
().
entrySet
())
{
for
(
Entry
<
String
,
Detail
>
detail
:
entry
.
getValue
()
.
getDetails
().
entrySet
())
{
double
[]
doubles
=
groups
.
get
(
detail
.
getKey
());
if
(
doubles
==
null
)
{
...
...
@@ -156,7 +157,8 @@ public class DisplayHeartbeat {
}
public
String
getActiceThreadGraph
()
{
return
m_builder
.
build
(
new
HeartbeatPayload
(
0
,
"Active Thread"
,
"Minute"
,
"Count"
,
m_activeThreads
));
return
m_builder
.
build
(
new
HeartbeatPayload
(
0
,
"Active Thread"
,
"Minute"
,
"Count"
,
m_activeThreads
));
}
public
double
[]
getActiveThreads
()
{
...
...
@@ -206,8 +208,9 @@ public class DisplayHeartbeat {
}
public
String
getCatMessageOverflowGraph
()
{
return
m_builder
.
build
(
new
HeartbeatPayload
(
1
,
"Cat Message Overflow / Minute"
,
"Minute"
,
"Count"
,
m_addCatMessageOverflow
));
return
m_builder
.
build
(
new
HeartbeatPayload
(
1
,
"Cat Message Overflow / Minute"
,
"Minute"
,
"Count"
,
m_addCatMessageOverflow
));
}
public
double
[]
getCatMessageProduced
()
{
...
...
@@ -215,8 +218,9 @@ public class DisplayHeartbeat {
}
public
String
getCatMessageProducedGraph
()
{
return
m_builder
.
build
(
new
HeartbeatPayload
(
0
,
"Cat Message Produced / Minute"
,
"Minute"
,
"Count"
,
m_addCatMessageProduced
));
return
m_builder
.
build
(
new
HeartbeatPayload
(
0
,
"Cat Message Produced / Minute"
,
"Minute"
,
"Count"
,
m_addCatMessageProduced
));
}
public
double
[]
getCatMessageSize
()
{
...
...
@@ -224,11 +228,14 @@ public class DisplayHeartbeat {
}
public
String
getCatMessageSizeGraph
()
{
return
m_builder
.
build
(
new
HeartbeatPayload
(
2
,
"Cat Message Size / Minute"
,
"Minute"
,
"MB"
,
m_addCatMessageSize
));
return
m_builder
.
build
(
new
HeartbeatPayload
(
2
,
"Cat Message Size / Minute"
,
"Minute"
,
"MB"
,
m_addCatMessageSize
));
}
public
String
getCatThreadGraph
()
{
return
m_builder
.
build
(
new
HeartbeatPayload
(
1
,
"Cat Thread"
,
"Minute"
,
"Count"
,
m_catThreads
));
return
m_builder
.
build
(
new
HeartbeatPayload
(
1
,
"Cat Thread"
,
"Minute"
,
"Count"
,
m_catThreads
));
}
public
double
[]
getCatThreads
()
{
...
...
@@ -240,7 +247,8 @@ public class DisplayHeartbeat {
}
public
String
getDeamonThreadGraph
()
{
return
m_builder
.
build
(
new
HeartbeatPayload
(
6
,
"Daemon Thread"
,
"Minute"
,
"Count"
,
m_daemonThreads
));
return
m_builder
.
build
(
new
HeartbeatPayload
(
6
,
"Daemon Thread"
,
"Minute"
,
"Count"
,
m_daemonThreads
));
}
public
List
<
String
>
getDiskNames
()
{
...
...
@@ -290,7 +298,8 @@ public class DisplayHeartbeat {
}
String
path
=
disks
.
get
(
i
).
getPath
();
String
graph
=
m_builder
.
build
(
new
HeartbeatPayload
(
i
,
"Disk Free ("
+
path
+
")"
,
"Minute"
,
"GB"
,
values
));
String
graph
=
m_builder
.
build
(
new
HeartbeatPayload
(
i
,
"Disk Free ("
+
path
+
")"
,
"Minute"
,
"GB"
,
values
));
sb
.
append
(
graph
);
}
...
...
@@ -325,11 +334,13 @@ public class DisplayHeartbeat {
}
public
String
getHeapUsageGraph
()
{
return
m_builder
.
build
(
new
HeartbeatPayload
(
1
,
"Heap Usage"
,
"Minute"
,
"MB"
,
m_heapUsage
));
return
m_builder
.
build
(
new
HeartbeatPayload
(
1
,
"Heap Usage"
,
"Minute"
,
"MB"
,
m_heapUsage
));
}
public
String
getHttpTheadGraph
()
{
return
m_builder
.
build
(
new
HeartbeatPayload
(
0
,
"HTTP Thread"
,
"Minute"
,
"Count"
,
m_httpThreads
));
return
m_builder
.
build
(
new
HeartbeatPayload
(
0
,
"HTTP Thread"
,
"Minute"
,
"Count"
,
m_httpThreads
));
}
public
double
[]
getHttpThreads
()
{
...
...
@@ -341,7 +352,8 @@ public class DisplayHeartbeat {
}
public
String
getMemoryFreeGraph
()
{
return
m_builder
.
build
(
new
HeartbeatPayload
(
0
,
"Memory Free"
,
"Minute"
,
"MB"
,
m_memoryFree
));
return
m_builder
.
build
(
new
HeartbeatPayload
(
0
,
"Memory Free"
,
"Minute"
,
"MB"
,
m_memoryFree
));
}
public
double
[]
getNewGcCount
()
{
...
...
@@ -349,7 +361,8 @@ public class DisplayHeartbeat {
}
public
String
getNewGcCountGraph
()
{
return
m_builder
.
build
(
new
HeartbeatPayload
(
0
,
"NewGc Count"
,
"Minute"
,
"Count"
,
m_addNewGcCount
));
return
m_builder
.
build
(
new
HeartbeatPayload
(
0
,
"NewGc Count"
,
"Minute"
,
"Count"
,
m_addNewGcCount
));
}
public
double
[]
getNewThreads
()
{
...
...
@@ -361,7 +374,8 @@ public class DisplayHeartbeat {
}
public
String
getNoneHeapUsageGraph
()
{
return
m_builder
.
build
(
new
HeartbeatPayload
(
2
,
"None Heap Usage"
,
"Minute"
,
"MB"
,
m_noneHeapUsage
));
return
m_builder
.
build
(
new
HeartbeatPayload
(
2
,
"None Heap Usage"
,
"Minute"
,
"MB"
,
m_noneHeapUsage
));
}
public
double
[]
getOldGcCount
()
{
...
...
@@ -369,7 +383,8 @@ public class DisplayHeartbeat {
}
public
String
getOldGcCountGraph
()
{
return
m_builder
.
build
(
new
HeartbeatPayload
(
1
,
"OldGc Count"
,
"Minute"
,
"Count"
,
m_addOldGcCount
));
return
m_builder
.
build
(
new
HeartbeatPayload
(
1
,
"OldGc Count"
,
"Minute"
,
"Count"
,
m_addOldGcCount
));
}
public
List
<
Period
>
getPeriods
()
{
...
...
@@ -377,7 +392,8 @@ public class DisplayHeartbeat {
}
public
String
getPigeonTheadGraph
()
{
return
m_builder
.
build
(
new
HeartbeatPayload
(
2
,
"Pigeon Thread"
,
"Minute"
,
"Count"
,
m_pigeonThreads
));
return
m_builder
.
build
(
new
HeartbeatPayload
(
2
,
"Pigeon Thread"
,
"Minute"
,
"Count"
,
m_pigeonThreads
));
}
public
double
[]
getPigeonThreads
()
{
...
...
@@ -385,7 +401,8 @@ public class DisplayHeartbeat {
}
public
String
getStartedThreadGraph
()
{
return
m_builder
.
build
(
new
HeartbeatPayload
(
1
,
"Started Thread"
,
"Minute"
,
"Count"
,
m_newThreads
));
return
m_builder
.
build
(
new
HeartbeatPayload
(
1
,
"Started Thread"
,
"Minute"
,
"Count"
,
m_newThreads
));
}
public
double
[]
getSystemLoadAverage
()
{
...
...
@@ -393,17 +410,19 @@ public class DisplayHeartbeat {
}
public
String
getSystemLoadAverageGraph
()
{
return
m_builder
.
build
(
new
HeartbeatPayload
(
2
,
"System Load Average"
,
"Minute"
,
""
,
m_systemLoadAverage
));
return
m_builder
.
build
(
new
HeartbeatPayload
(
2
,
"System Load Average"
,
"Minute"
,
""
,
m_systemLoadAverage
));
}
public
String
getTotalThreadGraph
()
{
return
m_builder
.
build
(
new
HeartbeatPayload
(
2
,
"Total Started Thread"
,
"Minute"
,
"Count"
,
m_totalThreads
));
return
m_builder
.
build
(
new
HeartbeatPayload
(
2
,
"Total Started Thread"
,
"Minute"
,
"Count"
,
m_totalThreads
));
}
public
double
[]
getTotalThreads
()
{
return
m_totalThreads
;
}
public
Map
<
String
,
Map
<
String
,
String
>>
getDalGraph
()
{
Map
<
String
,
Map
<
String
,
String
>>
graphs
=
new
HashMap
<
String
,
Map
<
String
,
String
>>();
Map
<
String
,
double
[]>
dalData
=
m_extensions
.
get
(
DAL
);
...
...
@@ -415,22 +434,25 @@ public class DisplayHeartbeat {
for
(
Entry
<
String
,
double
[]>
entry
:
dalData
.
entrySet
())
{
String
key
=
entry
.
getKey
();
List
<
String
>
split
=
Splitters
.
by
(
'-'
).
trim
().
split
(
key
);
if
(
split
!=
null
&&
split
.
size
()
==
2
)
{
String
db
=
split
.
get
(
0
);
String
title
=
split
.
get
(
1
);
int
pos
=
key
.
lastIndexOf
(
'-'
);
if
(
pos
>
0
)
{
String
db
=
key
.
substring
(
0
,
pos
);
String
title
=
key
.
substring
(
pos
+
1
);
Map
<
String
,
String
>
map
=
graphs
.
get
(
db
);
if
(
map
==
null
)
{
map
=
new
HashMap
<
String
,
String
>();
graphs
.
put
(
split
.
get
(
0
)
,
map
);
graphs
.
put
(
db
,
map
);
}
if
(!
DAL_INDEX
.
containsKey
(
title
))
{
DAL_INDEX
.
put
(
title
,
DAL_INDEX_COUNTER
.
getAndIncrement
());
}
map
.
put
(
title
,
m_builder
.
build
(
new
HeartbeatPayload
(
DAL_INDEX
.
get
(
title
),
title
,
"Minute"
,
"Count"
,
entry
.
getValue
())));
map
.
put
(
title
,
m_builder
.
build
(
new
HeartbeatPayload
(
DAL_INDEX
.
get
(
title
),
title
,
"Minute"
,
"Count"
,
entry
.
getValue
())));
}
}
...
...
@@ -446,7 +468,8 @@ public class DisplayHeartbeat {
private
double
[]
m_values
;
public
HeartbeatPayload
(
int
index
,
String
title
,
String
axisXLabel
,
String
axisYLabel
,
double
[]
values
)
{
public
HeartbeatPayload
(
int
index
,
String
title
,
String
axisXLabel
,
String
axisYLabel
,
double
[]
values
)
{
super
(
title
,
axisXLabel
,
axisYLabel
);
m_idPrefix
=
title
;
...
...
cat-home/src/main/webapp/WEB-INF/tags/body.tag
浏览文件 @
3e3e41e0
...
...
@@ -49,7 +49,7 @@
<li><a
style=
"padding:3px 30px"
href=
"/cat/r/network?domain=${model.domain}&ip=${model.ipAddress}&date=${model.date}&reportType=${payload.reportType}&op=${payload.action.name}"
>
network
</a></li>
<li><a
style=
"padding:3px 30px"
href=
"/cat/r/cdn?domain=${model.domain}&ip=${model.ipAddress}&date=${model.date}&reportType=${payload.reportType}&op=${payload.action.name}"
>
cdn
</a></li>
<li><a
style=
"padding:3px 30px"
href=
"/cat/r/system?domain=${model.domain}&ip=${model.ipAddress}&date=${model.date}&reportType=${payload.reportType}&op=${payload.action.name}"
>
system
</a></li>
<li><a
style=
"padding:3px 30px"
href=
"/cat/r/
change
?domain=${model.domain}&ip=${model.ipAddress}&date=${model.date}&reportType=${payload.reportType}&op=${payload.action.name}"
>
change
</a></li>
<li><a
style=
"padding:3px 30px"
href=
"/cat/r/
alteration
?domain=${model.domain}&ip=${model.ipAddress}&date=${model.date}&reportType=${payload.reportType}&op=${payload.action.name}"
>
change
</a></li>
<li><a
style=
"padding:3px 30px"
href=
"/cat/r/statistics?domain=${model.domain}&ip=${model.ipAddress}&date=${model.date}&reportType=${payload.reportType}&op=${payload.action.name}"
>
statistics
</a></li>
<li
class=
"nav-header"
>
System
</li>
<li><a
style=
"padding:3px 30px"
href=
"/cat/s/alarm?domain=${model.domain}&ip=${model.ipAddress}&date=${model.date}&reportType=${payload.reportType}&op=${payload.action.name}"
>
alarm
</a></li>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录