Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
71665195
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,发现更多精彩内容 >>
提交
71665195
编写于
1月 05, 2013
作者:
Y
youyong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify the cat log issue and DalException
上级
c15245d6
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
57 addition
and
44 deletion
+57
-44
cat-consumer/src/main/java/com/dianping/cat/consumer/dump/DumpAnalyzer.java
...ain/java/com/dianping/cat/consumer/dump/DumpAnalyzer.java
+3
-3
cat-core/pom.xml
cat-core/pom.xml
+1
-1
cat-core/src/main/java/com/dianping/cat/CatCoreModule.java
cat-core/src/main/java/com/dianping/cat/CatCoreModule.java
+7
-7
cat-core/src/main/java/com/dianping/cat/configuration/ClientConfigReloader.java
.../com/dianping/cat/configuration/ClientConfigReloader.java
+7
-10
cat-core/src/main/java/com/dianping/cat/storage/dump/LocalMessageBucketManager.java
.../dianping/cat/storage/dump/LocalMessageBucketManager.java
+12
-2
cat-home/src/main/java/com/dianping/cat/report/page/event/HistoryGraphs.java
...ava/com/dianping/cat/report/page/event/HistoryGraphs.java
+3
-6
cat-home/src/main/java/com/dianping/cat/report/page/health/HistoryGraphs.java
...va/com/dianping/cat/report/page/health/HistoryGraphs.java
+2
-1
cat-home/src/main/java/com/dianping/cat/report/page/logview/Handler.java
...in/java/com/dianping/cat/report/page/logview/Handler.java
+10
-3
cat-home/src/main/java/com/dianping/cat/report/page/problem/HistoryGraphs.java
...a/com/dianping/cat/report/page/problem/HistoryGraphs.java
+3
-6
cat-home/src/main/java/com/dianping/cat/report/page/transaction/HistoryGraphs.java
...m/dianping/cat/report/page/transaction/HistoryGraphs.java
+3
-0
cat-home/src/main/java/com/dianping/cat/report/task/spi/ReportFacade.java
...n/java/com/dianping/cat/report/task/spi/ReportFacade.java
+5
-3
cat-home/src/main/java/com/dianping/cat/report/task/transaction/TransactionGraphCreator.java
.../cat/report/task/transaction/TransactionGraphCreator.java
+1
-1
cat-home/src/main/java/com/dianping/cat/system/alarm/AlarmRuleCreator.java
.../java/com/dianping/cat/system/alarm/AlarmRuleCreator.java
+0
-1
未找到文件。
cat-consumer/src/main/java/com/dianping/cat/consumer/dump/DumpAnalyzer.java
浏览文件 @
71665195
...
...
@@ -115,9 +115,9 @@ public class DumpAnalyzer extends AbstractMessageAnalyzer<Object> implements Ini
if
(
duration
==
0
||
duration
==
HOUR
||
duration
==
-
HOUR
)
{
m_bucketManager
.
storeMessage
(
tree
,
id
);
}
else
{
m_logger
.
error
(
"
error timestamp,meesageId:"
+
tree
.
getMessageId
()
+
",id parse time "
+
m_sdf
.
format
(
new
Date
(
idTime
))
+
" "
+
id
.
getIpAddress
()
+
" ,message tree timestamp:
"
+
m_sdf
.
format
(
new
Date
(
time
))
+
" "
+
tree
.
getIpAddress
()
+
" duration hours
:"
+
duration
);
m_logger
.
error
(
"
timestamp:"
+
tree
.
getMessageId
()
+
",id timestamp "
+
m_sdf
.
format
(
new
Date
(
idTime
))
+
" "
+
id
.
getIpAddress
()
+
" ,tree timestamp:"
+
m_sdf
.
format
(
new
Date
(
time
))
+
"
"
+
tree
.
getIpAddress
()
+
" duration
:"
+
duration
);
}
}
catch
(
IOException
e
)
{
m_logger
.
error
(
"Error when dumping to local file system, version 2!"
,
e
);
...
...
cat-core/pom.xml
浏览文件 @
71665195
...
...
@@ -13,7 +13,7 @@
<dependency>
<groupId>
org.unidal.framework
</groupId>
<artifactId>
foundation-service
</artifactId>
<version>
2.0.
0
</version>
<version>
2.0.
1
</version>
</dependency>
<dependency>
<groupId>
org.jboss.netty
</groupId>
...
...
cat-core/src/main/java/com/dianping/cat/CatCoreModule.java
浏览文件 @
71665195
...
...
@@ -6,6 +6,12 @@ import java.util.concurrent.locks.LockSupport;
import
org.jboss.netty.util.ThreadNameDeterminer
;
import
org.jboss.netty.util.ThreadRenamingRunnable
;
import
org.unidal.helper.Threads
;
import
org.unidal.helper.Threads.AbstractThreadListener
;
import
org.unidal.initialization.AbstractModule
;
import
org.unidal.initialization.DefaultModuleContext
;
import
org.unidal.initialization.Module
;
import
org.unidal.initialization.ModuleContext
;
import
com.dianping.cat.configuration.ClientConfigManager
;
import
com.dianping.cat.configuration.ClientConfigReloader
;
...
...
@@ -13,12 +19,6 @@ import com.dianping.cat.configuration.client.entity.ClientConfig;
import
com.dianping.cat.message.internal.MilliSecondTimer
;
import
com.dianping.cat.message.io.TransportManager
;
import
com.dianping.cat.status.StatusUpdateTask
;
import
org.unidal.helper.Threads
;
import
org.unidal.helper.Threads.DefaultThreadListener
;
import
org.unidal.initialization.AbstractModule
;
import
org.unidal.initialization.DefaultModuleContext
;
import
org.unidal.initialization.Module
;
import
org.unidal.initialization.ModuleContext
;
public
class
CatCoreModule
extends
AbstractModule
{
public
static
final
String
ID
=
"cat-core"
;
...
...
@@ -67,7 +67,7 @@ public class CatCoreModule extends AbstractModule {
return
null
;
// no dependencies
}
public
final
class
CatThreadListener
extends
Defaul
tThreadListener
{
public
final
class
CatThreadListener
extends
Abstrac
tThreadListener
{
private
final
ModuleContext
m_ctx
;
private
CatThreadListener
(
ModuleContext
ctx
)
{
...
...
cat-core/src/main/java/com/dianping/cat/configuration/ClientConfigReloader.java
浏览文件 @
71665195
...
...
@@ -5,16 +5,17 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.util.Map
;
import
org.codehaus.plexus.logging.Logger
;
import
org.unidal.helper.Files
;
import
org.unidal.helper.Threads.Task
;
import
org.unidal.lookup.logger.LoggerFactory
;
import
org.xml.sax.SAXException
;
import
org.xml.sax.SAXParseException
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.configuration.client.entity.ClientConfig
;
import
com.dianping.cat.configuration.client.entity.Domain
;
import
com.dianping.cat.configuration.client.transform.DefaultDomParser
;
import
com.dianping.cat.message.Message
;
import
org.unidal.helper.Files
;
import
org.unidal.helper.Threads.Task
;
public
class
ClientConfigReloader
implements
Task
{
private
static
final
String
CAT_CLIENT_XML
=
"/META-INF/cat/client.xml"
;
...
...
@@ -29,6 +30,8 @@ public class ClientConfigReloader implements Task {
private
volatile
boolean
m_active
=
true
;
private
Logger
m_logger
=
LoggerFactory
.
getLogger
(
ClientConfigReloader
.
class
);
public
ClientConfigReloader
(
String
fileName
,
ClientConfig
config
)
{
m_config
=
config
;
m_parser
=
new
DefaultDomParser
();
...
...
@@ -101,14 +104,8 @@ public class ClientConfigReloader implements Task {
}
}
}
}
catch
(
IOException
e
)
{
Cat
.
getProducer
().
logEvent
(
"System"
,
"ReloadIOException"
,
"IOException"
,
null
);
}
catch
(
SAXParseException
e
)
{
Cat
.
getProducer
().
logEvent
(
"System"
,
"ReloadSAXException"
,
"SAXException"
,
null
);
}
catch
(
RuntimeException
e
)
{
Cat
.
getProducer
().
logEvent
(
"System"
,
"ReloadException"
,
"RuntimeException"
,
null
);
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
m_logger
.
error
(
"Error when reloading client xml!"
,
e
);
}
Thread
.
sleep
(
2000L
);
}
catch
(
InterruptedException
e
)
{
...
...
cat-core/src/main/java/com/dianping/cat/storage/dump/LocalMessageBucketManager.java
浏览文件 @
71665195
...
...
@@ -262,7 +262,7 @@ public class LocalMessageBucketManager extends ContainerHolder implements Messag
for
(
String
path
:
paths
)
{
File
file
=
new
File
(
m_baseDir
,
path
);
String
loginfo
=
"path:"
+
m_baseDir
+
path
+
",file size: "
+
file
.
length
();
String
loginfo
=
"path:"
+
m_baseDir
+
"/"
+
path
+
",file size: "
+
file
.
length
();
LocalMessageBucket
bucket
=
m_buckets
.
get
(
path
);
if
(
bucket
!=
null
)
{
...
...
@@ -291,6 +291,12 @@ public class LocalMessageBucketManager extends ContainerHolder implements Messag
m_logger
.
error
(
e
.
getMessage
(),
e
);
}
}
try
{
Thread
.
sleep
(
100
);
}
catch
(
InterruptedException
e
)
{
break
;
}
}
t
.
complete
();
}
...
...
@@ -385,7 +391,11 @@ public class LocalMessageBucketManager extends ContainerHolder implements Messag
if
(
message
instanceof
Transaction
)
{
long
delay
=
System
.
currentTimeMillis
()
-
tree
.
getMessage
().
getTimestamp
()
-
((
Transaction
)
message
).
getDurationInMillis
();
m_serverStateManager
.
addProcessDelay
(
delay
);
int
fiveMinute
=
1000
*
60
*
5
;
if
(
delay
<
fiveMinute
&&
delay
>
-
fiveMinute
)
{
m_serverStateManager
.
addProcessDelay
(
delay
);
}
}
if
(
m_total
%
(
CatConstants
.
SUCCESS_COUNT
*
1000
)
==
0
)
{
m_logger
.
info
(
"dump message number: "
+
m_total
+
" size:"
+
m_totalSize
*
1.0
/
1024
/
1024
/
1024
+
"GB"
);
...
...
cat-home/src/main/java/com/dianping/cat/report/page/event/HistoryGraphs.java
浏览文件 @
71665195
...
...
@@ -14,6 +14,8 @@ import com.dianping.cat.home.dal.report.GraphEntity;
import
com.dianping.cat.report.page.HistoryGraphItem
;
import
com.dianping.cat.report.page.event.Handler.DetailOrder
;
import
com.dianping.cat.report.page.event.Handler.SummaryOrder
;
import
org.unidal.dal.jdbc.DalNotFoundException
;
import
org.unidal.lookup.annotation.Inject
;
import
org.unidal.lookup.util.StringUtils
;
...
...
@@ -116,16 +118,11 @@ public class HistoryGraphs {
Graph
graph
=
m_graphDao
.
findSingalByDomainNameIpDuration
(
new
Date
(
startLong
),
queryIP
,
domain
,
"event"
,
GraphEntity
.
READSET_FULL
);
events
.
add
(
graph
);
}
catch
(
DalNotFoundException
e
)
{
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
}
// try {
// events = this.m_graphDao.findByDomainNameIpDuration(start, end, queryIP, domain, "event",
// GraphEntity.READSET_FULL);
// } catch (Exception e) {
// Cat.logError(e);
// }
Map
<
String
,
double
[]>
result
=
buildGraphDatas
(
start
,
end
,
type
,
name
,
events
);
return
result
;
}
...
...
cat-home/src/main/java/com/dianping/cat/report/page/health/HistoryGraphs.java
浏览文件 @
71665195
...
...
@@ -18,8 +18,9 @@ public class HistoryGraphs {
public
HistoryGraphItem
buildHistoryGraph
(
String
domain
,
Date
start
,
Date
end
,
String
reportType
,
String
key
)
{
if
(
reportType
.
equalsIgnoreCase
(
"day"
))
{
return
getDateFromHourlyReport
(
domain
,
start
,
end
,
key
);
}
else
{
return
getDateFromDailyReport
(
domain
,
start
,
end
,
key
);
}
return
getDateFromDailyReport
(
domain
,
start
,
end
,
key
);
}
private
HistoryGraphItem
getDateFromDailyReport
(
String
domain
,
Date
start
,
Date
end
,
String
key
)
{
...
...
cat-home/src/main/java/com/dianping/cat/report/page/logview/Handler.java
浏览文件 @
71665195
...
...
@@ -6,6 +6,7 @@ import java.util.Date;
import
javax.servlet.ServletException
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.message.Event
;
import
com.dianping.cat.message.internal.MessageId
;
import
com.dianping.cat.message.spi.MessagePathBuilder
;
import
com.dianping.cat.report.ReportPage
;
...
...
@@ -86,6 +87,12 @@ public class Handler implements PageHandler<Context> {
String
messageId
=
getMessageId
(
payload
);
String
logView
=
getLogView
(
messageId
,
payload
.
isWaterfall
());
if
(
logView
==
null
||
logView
.
length
()
==
0
)
{
Cat
.
getProducer
().
logEvent
(
"Logview"
,
"Success"
,
Event
.
SUCCESS
,
null
);
}
else
{
Cat
.
getProducer
().
logEvent
(
"Logview"
,
"Fail"
,
Event
.
SUCCESS
,
null
);
}
switch
(
payload
.
getAction
())
{
case
VIEW:
model
.
setTable
(
logView
);
...
...
@@ -109,7 +116,7 @@ public class Handler implements PageHandler<Context> {
sb
.
append
(
'/'
).
append
(
path
);
final
String
key
=
id
.
getDomain
()
+
'-'
+
id
.
getIpAddress
();
return
path
+
key
;
}
return
path
+
key
;
}
}
cat-home/src/main/java/com/dianping/cat/report/page/problem/HistoryGraphs.java
浏览文件 @
71665195
...
...
@@ -14,6 +14,8 @@ import com.dianping.cat.home.dal.report.GraphEntity;
import
com.dianping.cat.report.page.HistoryGraphItem
;
import
com.dianping.cat.report.page.problem.Handler.DetailOrder
;
import
com.dianping.cat.report.page.problem.Handler.SummaryOrder
;
import
org.unidal.dal.jdbc.DalNotFoundException
;
import
org.unidal.lookup.annotation.Inject
;
import
org.unidal.lookup.util.StringUtils
;
...
...
@@ -111,16 +113,11 @@ public class HistoryGraphs {
Graph
graph
=
m_graphDao
.
findSingalByDomainNameIpDuration
(
new
Date
(
startLong
),
queryIP
,
domain
,
"problem"
,
GraphEntity
.
READSET_FULL
);
graphs
.
add
(
graph
);
}
catch
(
DalNotFoundException
e
)
{
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
}
// try {
// graphs = m_graphDao.findByDomainNameIpDuration(start, end, queryIP, domain, "problem",
// GraphEntity.READSET_FULL);
// } catch (DalException e) {
// Cat.logError(e);
// }
Map
<
String
,
double
[]>
result
=
buildGraphDatas
(
start
,
end
,
type
,
status
,
graphs
);
return
result
;
}
...
...
cat-home/src/main/java/com/dianping/cat/report/page/transaction/HistoryGraphs.java
浏览文件 @
71665195
...
...
@@ -14,6 +14,8 @@ import com.dianping.cat.home.dal.report.GraphEntity;
import
com.dianping.cat.report.page.HistoryGraphItem
;
import
com.dianping.cat.report.page.transaction.Handler.DetailOrder
;
import
com.dianping.cat.report.page.transaction.Handler.SummaryOrder
;
import
org.unidal.dal.jdbc.DalNotFoundException
;
import
org.unidal.lookup.annotation.Inject
;
import
org.unidal.lookup.util.StringUtils
;
...
...
@@ -138,6 +140,7 @@ public class HistoryGraphs {
Graph
graph
=
m_graphDao
.
findSingalByDomainNameIpDuration
(
new
Date
(
startLong
),
queryIp
,
domain
,
"transaction"
,
GraphEntity
.
READSET_FULL
);
graphs
.
add
(
graph
);
}
catch
(
DalNotFoundException
e
)
{
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
...
...
cat-home/src/main/java/com/dianping/cat/report/task/spi/ReportFacade.java
浏览文件 @
71665195
...
...
@@ -104,9 +104,9 @@ public class ReportFacade implements LogEnabled, Initializable {
}
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"hack for log
"
);
System
.
err
.
println
(
"Flowing is error stack trace:
"
);
e
.
printStackTrace
();
m_logger
.
error
(
e
.
getMessage
(),
e
);
m_logger
.
error
(
"Error when building report,"
+
e
.
getMessage
(),
e
);
Cat
.
logError
(
e
);
return
false
;
}
...
...
@@ -160,7 +160,9 @@ public class ReportFacade implements LogEnabled, Initializable {
}
return
update
;
}
catch
(
Exception
e
)
{
m_logger
.
error
(
e
.
getMessage
(),
e
);
System
.
err
.
println
(
"Flowing is error stack trace in redo:"
);
e
.
printStackTrace
();
m_logger
.
error
(
"Error when redo task "
+
taskID
+
" "
+
e
.
getMessage
(),
e
);
Cat
.
logError
(
e
);
return
false
;
}
...
...
cat-home/src/main/java/com/dianping/cat/report/task/transaction/TransactionGraphCreator.java
浏览文件 @
71665195
...
...
@@ -113,7 +113,7 @@ public class TransactionGraphCreator implements GraphCreator<TransactionReport>
graph
.
setPeriod
(
reportPeriod
);
graph
.
setType
(
3
);
graph
.
setCreationDate
(
creationDate
);
Machine
machine
=
report
.
getMachines
().
get
(
ip
);
Machine
machine
=
report
.
findOrCreateMachine
(
ip
);
Map
<
String
,
TransactionType
>
types
=
machine
.
getTypes
();
StringBuilder
detailBuilder
=
new
StringBuilder
();
StringBuilder
summaryBuilder
=
new
StringBuilder
();
...
...
cat-home/src/main/java/com/dianping/cat/system/alarm/AlarmRuleCreator.java
浏览文件 @
71665195
...
...
@@ -162,7 +162,6 @@ public class AlarmRuleCreator implements Task {
}
t
.
complete
();
}
}
catch
(
Exception
e
)
{
Cat
.
logError
(
e
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录