Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
969e8f69
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,发现更多精彩内容 >>
提交
969e8f69
编写于
3月 13, 2012
作者:
F
Frankie Wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix a blocking issue when reloading index from file
上级
3829e25a
变更
23
展开全部
隐藏空白更改
内联
并排
Showing
23 changed file
with
288 addition
and
1266 deletion
+288
-1266
cat-consumer/src/main/java/com/dianping/cat/consumer/transaction/TransactionAnalyzer.java
...ianping/cat/consumer/transaction/TransactionAnalyzer.java
+2
-2
cat-core/src/main/java/com/dianping/cat/message/spi/codec/HtmlMessageCodec.java
.../com/dianping/cat/message/spi/codec/HtmlMessageCodec.java
+51
-1
cat-core/src/main/java/com/dianping/cat/message/spi/internal/DefaultMessageTree.java
...dianping/cat/message/spi/internal/DefaultMessageTree.java
+1
-1
cat-core/src/main/java/com/dianping/cat/storage/internal/AbstractFileBucket.java
...com/dianping/cat/storage/internal/AbstractFileBucket.java
+19
-2
cat-core/src/test/java/com/dianping/cat/message/spi/codec/HtmlMessageCodecTest.java
.../dianping/cat/message/spi/codec/HtmlMessageCodecTest.java
+5
-6
cat-home/src/main/java/com/dianping/cat/report/ReportPage.java
...ome/src/main/java/com/dianping/cat/report/ReportPage.java
+0
-4
cat-home/src/main/java/com/dianping/cat/report/build/ServiceComponentConfigurator.java
...anping/cat/report/build/ServiceComponentConfigurator.java
+3
-1
cat-home/src/main/java/com/dianping/cat/report/page/logview/Handler.java
...in/java/com/dianping/cat/report/page/logview/Handler.java
+39
-28
cat-home/src/main/java/com/dianping/cat/report/page/logview/Payload.java
...in/java/com/dianping/cat/report/page/logview/Payload.java
+33
-9
cat-home/src/main/java/com/dianping/cat/report/page/model/logview/LocalLogViewService.java
...ng/cat/report/page/model/logview/LocalLogViewService.java
+47
-16
cat-home/src/main/java/com/dianping/cat/report/page/model/spi/ModelRequest.java
.../com/dianping/cat/report/page/model/spi/ModelRequest.java
+8
-0
cat-home/src/main/java/com/dianping/cat/report/page/model/spi/ModelResponse.java
...com/dianping/cat/report/page/model/spi/ModelResponse.java
+37
-0
cat-home/src/main/java/com/dianping/cat/report/view/NavigationBar.java
...main/java/com/dianping/cat/report/view/NavigationBar.java
+0
-4
cat-home/src/main/resources/META-INF/plexus/components.xml
cat-home/src/main/resources/META-INF/plexus/components.xml
+35
-98
cat-home/src/main/webapp/css/failure.css
cat-home/src/main/webapp/css/failure.css
+0
-49
cat-home/src/main/webapp/css/jquery.css
cat-home/src/main/webapp/css/jquery.css
+0
-568
cat-home/src/main/webapp/css/logview.css
cat-home/src/main/webapp/css/logview.css
+6
-1
cat-home/src/main/webapp/css/style.css
cat-home/src/main/webapp/css/style.css
+0
-264
cat-home/src/main/webapp/js/failure.js
cat-home/src/main/webapp/js/failure.js
+0
-65
cat-home/src/main/webapp/js/sql_scripts.js
cat-home/src/main/webapp/js/sql_scripts.js
+0
-102
cat-home/src/main/webapp/jsp/report/failure.jsp
cat-home/src/main/webapp/jsp/report/failure.jsp
+0
-25
cat-home/src/main/webapp/jsp/report/service.jsp
cat-home/src/main/webapp/jsp/report/service.jsp
+0
-7
cat-job/src/main/java/com/dianping/cat/job/hdfs/DefaultInputChannelManager.java
...com/dianping/cat/job/hdfs/DefaultInputChannelManager.java
+2
-13
未找到文件。
cat-consumer/src/main/java/com/dianping/cat/consumer/transaction/TransactionAnalyzer.java
浏览文件 @
969e8f69
...
...
@@ -177,9 +177,9 @@ public class TransactionAnalyzer extends AbstractMessageAnalyzer<TransactionRepo
// the message is required by some transactions
if
(
count
>
0
)
{
String
messageId
=
tree
.
getMessageId
();
String
threadTag
=
"t:"
+
tree
.
getThreadId
();
String
sessionTag
=
"s:"
+
tree
.
getSessionToken
();
String
requestTag
=
"r:"
+
messageId
;
String
sessionTag
=
"s:"
+
tree
.
getSessionToken
();
String
threadTag
=
"t:"
+
tree
.
getThreadId
();
try
{
m_messageBucket
.
storeById
(
messageId
,
tree
,
threadTag
,
sessionTag
,
requestTag
);
...
...
cat-core/src/main/java/com/dianping/cat/message/spi/codec/HtmlMessageCodec.java
浏览文件 @
969e8f69
...
...
@@ -36,6 +36,9 @@ public class HtmlMessageCodec implements MessageCodec {
@Inject
private
String
m_logViewPrefix
=
"/cat/r/m/"
;
@Inject
private
boolean
m_showNav
=
true
;
private
BufferHelper
m_bufferHelper
=
new
BufferHelper
(
m_writer
);
private
DateHelper
m_dateHelper
=
new
DateHelper
();
...
...
@@ -68,6 +71,10 @@ public class HtmlMessageCodec implements MessageCodec {
count
+=
encodeMessage
(
tree
.
getMessage
(),
buf
,
0
,
new
LineCounter
());
}
if
(
m_showNav
)
{
count
+=
encodeFooter
(
tree
,
buf
);
}
count
+=
helper
.
table2
(
buf
);
buf
.
setInt
(
index
,
count
);
}
...
...
@@ -93,6 +100,45 @@ public class HtmlMessageCodec implements MessageCodec {
return
count
;
}
protected
int
encodeFooter
(
MessageTree
tree
,
ChannelBuffer
buf
)
{
BufferHelper
helper
=
m_bufferHelper
;
int
count
=
0
;
count
+=
helper
.
tr1
(
buf
,
"nav"
);
count
+=
helper
.
td1
(
buf
,
"colspan=\"4\" align=\"left\""
);
count
+=
helper
.
nbsp
(
buf
,
3
);
count
+=
helper
.
write
(
buf
,
"<a href=\"?tag1=r:"
);
count
+=
helper
.
write
(
buf
,
tree
.
getMessageId
());
count
+=
helper
.
write
(
buf
,
"\"><<< Request</a>"
);
count
+=
helper
.
nbsp
(
buf
,
3
);
count
+=
helper
.
write
(
buf
,
"<a href=\"?tag1=s:"
);
count
+=
helper
.
write
(
buf
,
tree
.
getSessionToken
());
count
+=
helper
.
write
(
buf
,
"\"><<< Session</a>"
);
count
+=
helper
.
nbsp
(
buf
,
3
);
count
+=
helper
.
write
(
buf
,
"<a href=\"?tag1=t:"
);
count
+=
helper
.
write
(
buf
,
tree
.
getThreadId
());
count
+=
helper
.
write
(
buf
,
"\"><<< Thread</a>"
);
count
+=
helper
.
td2
(
buf
);
count
+=
helper
.
td1
(
buf
,
"align=\"right\""
);
count
+=
helper
.
write
(
buf
,
"<a href=\"?tag2=t:"
);
count
+=
helper
.
write
(
buf
,
tree
.
getThreadId
());
count
+=
helper
.
write
(
buf
,
"\">Thread >>></a>"
);
count
+=
helper
.
nbsp
(
buf
,
3
);
count
+=
helper
.
write
(
buf
,
"<a href=\"?tag2=s:"
);
count
+=
helper
.
write
(
buf
,
tree
.
getSessionToken
());
count
+=
helper
.
write
(
buf
,
"\">Session >>></a>"
);
count
+=
helper
.
nbsp
(
buf
,
3
);
count
+=
helper
.
write
(
buf
,
"<a href=\"?tag2=r:"
);
count
+=
helper
.
write
(
buf
,
tree
.
getMessageId
());
count
+=
helper
.
write
(
buf
,
"\">Request >>></a>"
);
count
+=
helper
.
nbsp
(
buf
,
3
);
count
+=
helper
.
td2
(
buf
);
count
+=
helper
.
tr2
(
buf
);
count
+=
helper
.
crlf
(
buf
);
return
count
;
}
protected
int
encodeLine
(
Message
message
,
ChannelBuffer
buf
,
char
type
,
Policy
policy
,
int
level
,
LineCounter
counter
)
{
BufferHelper
helper
=
m_bufferHelper
;
int
count
=
0
;
...
...
@@ -125,7 +171,7 @@ public class HtmlMessageCodec implements MessageCodec {
if
(
policy
!=
Policy
.
WITHOUT_STATUS
)
{
if
(
Message
.
SUCCESS
.
equals
(
message
.
getStatus
()))
{
count
+=
helper
.
td
(
buf
,
""
);
// do not output "0"
count
+=
helper
.
td
(
buf
,
"
"
);
// do not output "0"
}
else
{
count
+=
helper
.
td
(
buf
,
message
.
getStatus
(),
"class=\"error\""
);
}
...
...
@@ -235,6 +281,10 @@ public class HtmlMessageCodec implements MessageCodec {
m_bufferHelper
=
new
BufferHelper
(
m_writer
);
}
public
void
setShowNav
(
boolean
showNav
)
{
m_showNav
=
showNav
;
}
public
void
setLogViewPrefix
(
String
logViewPrefix
)
{
m_logViewPrefix
=
logViewPrefix
;
}
...
...
cat-core/src/main/java/com/dianping/cat/message/spi/internal/DefaultMessageTree.java
浏览文件 @
969e8f69
...
...
@@ -149,7 +149,7 @@ public class DefaultMessageTree implements MessageTree {
@Override
public
String
toString
()
{
PlainTextMessageCodec
codec
=
new
PlainTextMessageCodec
();
ChannelBuffer
buf
=
ChannelBuffers
.
dynamicBuffer
();
ChannelBuffer
buf
=
ChannelBuffers
.
dynamicBuffer
(
8096
);
codec
.
encode
(
this
,
buf
);
buf
.
readInt
();
// get rid of length
...
...
cat-core/src/main/java/com/dianping/cat/storage/internal/AbstractFileBucket.java
浏览文件 @
969e8f69
...
...
@@ -204,7 +204,22 @@ public abstract class AbstractFileBucket<T> implements Bucket<T>, TagThreadSuppo
break
;
}
int
num
=
Integer
.
parseInt
(
m_writeFile
.
readLine
());
int
num
=
-
1
;
// if the index was corrupted, then try to skip some lines
while
(
num
<
0
)
{
try
{
String
line
=
m_writeFile
.
readLine
();
if
(
line
==
null
)
{
return
;
}
num
=
Integer
.
parseInt
(
line
);
}
catch
(
NumberFormatException
e
)
{
m_logger
.
warn
(
"Error during loadIndexes: "
+
e
.
getMessage
());
}
}
if
(
num
>
data
.
length
)
{
int
newSize
=
data
.
length
;
...
...
@@ -305,7 +320,9 @@ public abstract class AbstractFileBucket<T> implements Bucket<T>, TagThreadSuppo
m_tagToIds
.
put
(
tag
,
ids
);
}
ids
.
add
(
id
);
if
(!
ids
.
contains
(
id
))
{
ids
.
add
(
id
);
}
}
}
}
cat-core/src/test/java/com/dianping/cat/message/spi/codec/HtmlMessageCodecTest.java
浏览文件 @
969e8f69
...
...
@@ -20,7 +20,6 @@ import com.dianping.cat.message.internal.DefaultHeartbeat;
import
com.dianping.cat.message.internal.DefaultTransaction
;
import
com.dianping.cat.message.spi.MessageCodec
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.message.spi.internal.DefaultMessagePathBuilder
;
import
com.dianping.cat.message.spi.internal.DefaultMessageTree
;
import
com.site.lookup.ComponentTestCase
;
...
...
@@ -30,18 +29,18 @@ public class HtmlMessageCodecTest extends ComponentTestCase {
HtmlMessageCodec
codec
=
(
HtmlMessageCodec
)
lookup
(
MessageCodec
.
class
,
"html"
);
ChannelBuffer
buf
=
ChannelBuffers
.
dynamicBuffer
();
codec
.
setShowNav
(
false
);
codec
.
encodeMessage
(
message
,
buf
,
0
,
null
);
String
actual
=
buf
.
toString
(
Charset
.
forName
(
"utf-8"
));
Assert
.
assertEquals
(
expected
,
actual
);
}
private
void
checkTree
(
MessageTree
tree
,
String
expected
)
{
HtmlMessageCodec
codec
=
new
HtmlMessageCodec
(
);
private
void
checkTree
(
MessageTree
tree
,
String
expected
)
throws
Exception
{
HtmlMessageCodec
codec
=
(
HtmlMessageCodec
)
lookup
(
MessageCodec
.
class
,
"html"
);
ChannelBuffer
buf
=
ChannelBuffers
.
dynamicBuffer
();
codec
.
setBufferWriter
(
new
HtmlEncodingBufferWriter
());
codec
.
setMessagePathBuilder
(
new
DefaultMessagePathBuilder
());
codec
.
setShowNav
(
false
);
codec
.
encode
(
tree
,
buf
);
buf
.
readInt
();
// get rid of length
String
actual
=
buf
.
toString
(
Charset
.
forName
(
"utf-8"
));
...
...
@@ -128,7 +127,7 @@ public class HtmlMessageCodecTest extends ComponentTestCase {
@Test
@Ignore
public
void
testMessageTree
()
{
public
void
testMessageTree
()
throws
Exception
{
DefaultMessageTree
tree
=
newMessageTree
();
long
timestamp
=
1325489621987L
;
String
expected1
=
"<table class=\"logview\">\r\n"
...
...
cat-home/src/main/java/com/dianping/cat/report/ReportPage.java
浏览文件 @
969e8f69
...
...
@@ -9,14 +9,10 @@ public enum ReportPage implements Page {
TRANSACTION
(
"transaction"
,
"t"
,
"Transaction"
,
"CAT summary report for Transactions in current hour."
,
true
),
FAILURE
(
"failure"
,
"f"
,
"Failure"
,
"CAT details report for failed messages in current hour."
,
true
),
LOGVIEW
(
"logview"
,
"m"
,
"Logview"
,
"CAT log details view for a given message."
,
false
),
IP
(
"ip"
,
"ip"
,
"Top IP List"
,
"Top visited IP list in current hour."
,
true
),
SERVICE
(
"service"
,
"service"
,
"Service"
,
"Service Home"
,
false
),
MODEL
(
"model"
,
"model"
,
"Model"
,
"Model Service"
,
false
),
PROBLEM
(
"problem"
,
"p"
,
"Problem"
,
"Problem"
,
true
);
...
...
cat-home/src/main/java/com/dianping/cat/report/build/ServiceComponentConfigurator.java
浏览文件 @
969e8f69
...
...
@@ -3,6 +3,7 @@ package com.dianping.cat.report.build;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.dianping.cat.message.spi.MessageCodec
;
import
com.dianping.cat.message.spi.MessageConsumer
;
import
com.dianping.cat.message.spi.MessagePathBuilder
;
import
com.dianping.cat.report.page.model.logview.CompositeLogViewService
;
...
...
@@ -35,7 +36,8 @@ class ServiceComponentConfigurator extends AbstractResourceConfigurator {
.
req
(
ModelService
.
class
,
new
String
[]
{
"problem-local"
},
"m_services"
));
all
.
add
(
C
(
ModelService
.
class
,
"logview-local"
,
LocalLogViewService
.
class
)
//
.
req
(
MessagePathBuilder
.
class
));
.
req
(
MessagePathBuilder
.
class
,
BucketManager
.
class
)
//
.
req
(
MessageCodec
.
class
,
"html"
));
all
.
add
(
C
(
ModelService
.
class
,
"logview"
,
CompositeLogViewService
.
class
)
//
.
req
(
ModelService
.
class
,
new
String
[]
{
"logview-local"
},
"m_services"
));
...
...
cat-home/src/main/java/com/dianping/cat/report/page/logview/Handler.java
浏览文件 @
969e8f69
...
...
@@ -4,14 +4,13 @@ import java.io.IOException;
import
javax.servlet.ServletException
;
import
org.unidal.webres.helper.Joiners
;
import
com.dianping.cat.message.internal.MessageId
;
import
com.dianping.cat.report.ReportPage
;
import
com.dianping.cat.report.page.model.spi.ModelPeriod
;
import
com.dianping.cat.report.page.model.spi.ModelRequest
;
import
com.dianping.cat.report.page.model.spi.ModelResponse
;
import
com.dianping.cat.report.page.model.spi.ModelService
;
import
com.dianping.cat.storage.TagThreadSupport.Direction
;
import
com.site.lookup.annotation.Inject
;
import
com.site.web.mvc.PageHandler
;
import
com.site.web.mvc.annotation.InboundActionMeta
;
...
...
@@ -25,6 +24,41 @@ public class Handler implements PageHandler<Context> {
@Inject
(
type
=
ModelService
.
class
,
value
=
"logview"
)
private
ModelService
<
String
>
m_service
;
private
String
getLogView
(
String
messageId
,
Direction
direction
,
String
tag
)
{
if
(
messageId
!=
null
)
{
MessageId
id
=
MessageId
.
parse
(
messageId
);
ModelPeriod
period
=
ModelPeriod
.
getByTime
(
id
.
getTimestamp
());
ModelRequest
request
=
new
ModelRequest
(
id
.
getDomain
(),
period
)
//
.
setProperty
(
"messageId"
,
messageId
);
if
(
direction
!=
null
&&
tag
!=
null
)
{
request
.
setProperty
(
"direction"
,
direction
.
name
());
request
.
setProperty
(
"tag"
,
tag
);
}
if
(
m_service
.
isEligable
(
request
))
{
ModelResponse
<
String
>
response
=
m_service
.
invoke
(
request
);
String
logview
=
response
.
getModel
();
return
logview
;
}
else
{
throw
new
RuntimeException
(
"Internal error: no eligible service registered for "
+
request
+
"!"
);
}
}
return
null
;
}
private
String
getMessageId
(
Payload
payload
)
{
String
[]
path
=
payload
.
getPath
();
if
(
path
!=
null
&&
path
.
length
>
0
)
{
return
path
[
0
];
}
else
{
return
null
;
}
}
@Override
@PayloadMeta
(
Payload
.
class
)
@InboundActionMeta
(
name
=
"m"
)
...
...
@@ -41,33 +75,10 @@ public class Handler implements PageHandler<Context> {
model
.
setPage
(
ReportPage
.
LOGVIEW
);
Payload
payload
=
ctx
.
getPayload
();
String
messageId
=
getMessageId
(
payload
);
String
logView
=
getLogView
(
messageId
,
payload
.
getDirection
(),
payload
.
getTag
());
model
.
setTable
(
getLogView
(
payload
)
);
model
.
setTable
(
logView
);
m_jspViewer
.
view
(
ctx
,
model
);
}
private
String
getLogView
(
Payload
payload
)
{
String
[]
path
=
payload
.
getPath
();
if
(
path
!=
null
&&
path
.
length
>
0
)
{
String
file
=
path
[
0
];
int
pos
=
file
.
lastIndexOf
(
'.'
);
MessageId
id
=
MessageId
.
parse
(
pos
<
0
?
file
:
file
.
substring
(
0
,
pos
));
String
relativePath
=
Joiners
.
by
(
'/'
).
join
(
path
);
ModelPeriod
period
=
ModelPeriod
.
getByTime
(
id
.
getTimestamp
());
ModelRequest
request
=
new
ModelRequest
(
id
.
getDomain
(),
period
)
//
.
setProperty
(
"path"
,
relativePath
);
if
(
m_service
.
isEligable
(
request
))
{
ModelResponse
<
String
>
response
=
m_service
.
invoke
(
request
);
String
logview
=
response
.
getModel
();
return
logview
;
}
else
{
throw
new
RuntimeException
(
"Internal error: no eligable service registered for "
+
request
+
"!"
);
}
}
return
null
;
}
}
cat-home/src/main/java/com/dianping/cat/report/page/logview/Payload.java
浏览文件 @
969e8f69
package
com.dianping.cat.report.page.logview
;
import
com.dianping.cat.report.ReportPage
;
import
com.dianping.cat.storage.TagThreadSupport.Direction
;
import
com.site.web.mvc.ActionContext
;
import
com.site.web.mvc.ActionPayload
;
import
com.site.web.mvc.payload.annotation.FieldMeta
;
...
...
@@ -15,19 +16,28 @@ public class Payload implements ActionPayload<ReportPage, Action> {
@FieldMeta
(
"header"
)
private
boolean
m_showHeader
=
true
;
@FieldMeta
(
"id"
)
private
int
m_identifier
;
@PathMeta
(
"path"
)
private
String
[]
m_path
;
@FieldMeta
(
"tag1"
)
private
String
m_tag1
;
@FieldMeta
(
"tag2"
)
private
String
m_tag2
;
@Override
public
Action
getAction
()
{
return
m_action
;
}
public
int
getIdentifier
()
{
return
m_identifier
;
public
Direction
getDirection
()
{
if
(
m_tag1
!=
null
)
{
return
Direction
.
BACKWARD
;
}
else
if
(
m_tag2
!=
null
)
{
return
Direction
.
FORWARD
;
}
else
{
return
null
;
}
}
@Override
...
...
@@ -39,6 +49,16 @@ public class Payload implements ActionPayload<ReportPage, Action> {
return
m_path
;
}
public
String
getTag
()
{
if
(
m_tag1
!=
null
)
{
return
m_tag1
;
}
else
if
(
m_tag2
!=
null
)
{
return
m_tag2
;
}
else
{
return
null
;
}
}
public
boolean
isShowHeader
()
{
return
m_showHeader
;
}
...
...
@@ -47,10 +67,6 @@ public class Payload implements ActionPayload<ReportPage, Action> {
m_action
=
action
;
}
public
void
setIdentifier
(
int
identifier
)
{
m_identifier
=
identifier
;
}
@Override
public
void
setPage
(
String
page
)
{
m_page
=
ReportPage
.
getByName
(
page
,
ReportPage
.
LOGVIEW
);
...
...
@@ -64,6 +80,14 @@ public class Payload implements ActionPayload<ReportPage, Action> {
m_showHeader
=
!
"no"
.
equals
(
showHeader
);
}
public
void
setTag1
(
String
tag1
)
{
m_tag1
=
tag1
;
}
public
void
setTag2
(
String
tag2
)
{
m_tag2
=
tag2
;
}
@Override
public
void
validate
(
ActionContext
<?>
ctx
)
{
}
...
...
cat-home/src/main/java/com/dianping/cat/report/page/model/logview/LocalLogViewService.java
浏览文件 @
969e8f69
package
com.dianping.cat.report.page.model.logview
;
import
java.io.File
;
import
java.nio.charset.Charset
;
import
java.util.Date
;
import
org.jboss.netty.buffer.ChannelBuffer
;
import
org.jboss.netty.buffer.ChannelBuffers
;
import
com.dianping.cat.message.internal.MessageId
;
import
com.dianping.cat.message.spi.MessageCodec
;
import
com.dianping.cat.message.spi.MessagePathBuilder
;
import
com.dianping.cat.message.spi.MessageTree
;
import
com.dianping.cat.report.page.model.spi.ModelRequest
;
import
com.dianping.cat.report.page.model.spi.ModelResponse
;
import
com.dianping.cat.report.page.model.spi.ModelService
;
import
com.site.helper.Files
;
import
com.dianping.cat.storage.Bucket
;
import
com.dianping.cat.storage.BucketManager
;
import
com.dianping.cat.storage.TagThreadSupport.Direction
;
import
com.site.lookup.annotation.Inject
;
public
class
LocalLogViewService
implements
ModelService
<
String
>
{
@Inject
private
MessagePathBuilder
m_
b
uilder
;
private
MessagePathBuilder
m_
pathB
uilder
;
@Override
public
boolean
isEligable
(
ModelRequest
request
)
{
return
!
request
.
getPeriod
().
isHistorical
();
}
@Inject
private
BucketManager
m_bucketManager
;
@Inject
(
value
=
"html"
)
private
MessageCodec
m_codec
;
@Override
public
ModelResponse
<
String
>
invoke
(
ModelRequest
request
)
{
File
baseDir
=
m_builder
.
getLogViewBaseDir
();
String
path
=
request
.
getProperty
(
"path"
);
File
file
=
new
File
(
baseDir
,
path
);
String
messageId
=
request
.
getProperty
(
"messageId"
);
String
direction
=
request
.
getProperty
(
"direction"
);
String
tag
=
request
.
getProperty
(
"tag"
);
MessageId
id
=
MessageId
.
parse
(
messageId
);
String
path
=
m_pathBuilder
.
getMessagePath
(
new
Date
(
id
.
getTimestamp
()));
ModelResponse
<
String
>
response
=
new
ModelResponse
<
String
>();
if
(
file
.
exists
())
{
try
{
String
html
=
Files
.
forIO
().
readFrom
(
file
,
"utf-8"
)
;
try
{
Bucket
<
MessageTree
>
bucket
=
m_bucketManager
.
getMessageBucket
(
path
);
MessageTree
tree
=
null
;
response
.
setModel
(
html
);
}
catch
(
Exception
e
)
{
response
.
setException
(
e
);
if
(
tag
!=
null
&&
direction
!=
null
)
{
Direction
d
=
Direction
.
valueOf
(
direction
);
tree
=
bucket
.
findNextById
(
messageId
,
d
,
tag
);
}
// if not found, use current instead
if
(
tree
==
null
)
{
tree
=
bucket
.
findById
(
messageId
);
}
ChannelBuffer
buf
=
ChannelBuffers
.
dynamicBuffer
(
8096
);
m_codec
.
encode
(
tree
,
buf
);
buf
.
readInt
();
// get rid of length
response
.
setModel
(
buf
.
toString
(
Charset
.
forName
(
"utf-8"
)));
}
catch
(
Exception
e
)
{
response
.
setException
(
e
);
}
return
response
;
}
@Override
public
boolean
isEligable
(
ModelRequest
request
)
{
return
!
request
.
getPeriod
().
isHistorical
();
}
}
cat-home/src/main/java/com/dianping/cat/report/page/model/spi/ModelRequest.java
浏览文件 @
969e8f69
...
...
@@ -46,6 +46,14 @@ public class ModelRequest {
}
}
public
boolean
hasProperty
(
String
name
)
{
if
(
m_properties
!=
null
)
{
return
m_properties
.
containsKey
(
name
);
}
else
{
return
false
;
}
}
public
ModelRequest
setProperty
(
String
name
,
String
value
)
{
if
(
m_properties
==
null
)
{
m_properties
=
new
HashMap
<
String
,
String
>();
...
...
cat-home/src/main/java/com/dianping/cat/report/page/model/spi/ModelResponse.java
浏览文件 @
969e8f69
package
com.dianping.cat.report.page.model.spi
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
ModelResponse
<
M
>
{
private
Exception
m_exception
;
private
M
m_model
;
private
Map
<
String
,
String
>
m_properties
;
public
Exception
getException
()
{
return
m_exception
;
}
...
...
@@ -13,6 +19,22 @@ public class ModelResponse<M> {
return
m_model
;
}
public
Map
<
String
,
String
>
getProperties
()
{
if
(
m_properties
==
null
)
{
return
Collections
.
emptyMap
();
}
else
{
return
m_properties
;
}
}
public
String
getProperty
(
String
name
)
{
if
(
m_properties
==
null
)
{
return
null
;
}
else
{
return
m_properties
.
get
(
name
);
}
}
public
void
setException
(
Exception
exception
)
{
m_exception
=
exception
;
}
...
...
@@ -20,4 +42,19 @@ public class ModelResponse<M> {
public
void
setModel
(
M
model
)
{
m_model
=
model
;
}
public
ModelResponse
<
M
>
setProperty
(
String
name
,
String
value
)
{
if
(
m_properties
==
null
)
{
m_properties
=
new
HashMap
<
String
,
String
>();
}
m_properties
.
put
(
name
,
value
);
return
this
;
}
@Override
public
String
toString
()
{
return
String
.
format
(
"ModelResponse[model=%s, exception=%s, properties=%s]"
,
m_model
,
m_exception
,
m_properties
);
}
}
cat-home/src/main/java/com/dianping/cat/report/view/NavigationBar.java
浏览文件 @
969e8f69
...
...
@@ -9,16 +9,12 @@ public class NavigationBar {
ReportPage
.
HOME
,
ReportPage
.
FAILURE
,
ReportPage
.
TRANSACTION
,
ReportPage
.
PROBLEM
,
ReportPage
.
IP
,
ReportPage
.
SERVICE
,
ReportPage
.
LOGVIEW
};
...
...
cat-home/src/main/resources/META-INF/plexus/components.xml
浏览文件 @
969e8f69
...
...
@@ -22,47 +22,6 @@
<fileServer>
127.0.0.1
</fileServer>
</configuration>
</component>
<component>
<role>
com.dianping.cat.report.page.service.provider.ModelProvider
</role>
<role-hint>
failure
</role-hint>
<implementation>
com.dianping.cat.report.page.service.provider.FailureModelProvider
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.message.spi.MessageConsumer
</role>
<role-hint>
realtime
</role-hint>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.report.page.service.provider.ModelProvider
</role>
<role-hint>
transaction
</role-hint>
<implementation>
com.dianping.cat.report.page.service.provider.TransactionModelProvider
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.message.spi.MessageConsumer
</role>
<role-hint>
realtime
</role-hint>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.report.page.service.provider.ModelProvider
</role>
<role-hint>
ip
</role-hint>
<implementation>
com.dianping.cat.report.page.service.provider.IpModelProvider
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.message.spi.MessageConsumer
</role>
<role-hint>
realtime
</role-hint>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.report.page.failure.FailureManager
</role>
<implementation>
com.dianping.cat.report.page.failure.FailureManager
</implementation>
</component>
<component>
<role>
com.dianping.cat.report.page.transaction.TransactionManager
</role>
<implementation>
com.dianping.cat.report.page.transaction.TransactionManager
</implementation>
</component>
<component>
<role>
com.dianping.cat.report.page.ip.IpManager
</role>
<implementation>
com.dianping.cat.report.page.ip.IpManager
</implementation>
...
...
@@ -152,6 +111,13 @@
<requirement>
<role>
com.dianping.cat.message.spi.MessagePathBuilder
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.storage.BucketManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.message.spi.MessageCodec
</role>
<role-hint>
html
</role-hint>
</requirement>
</requirements>
</component>
<component>
...
...
@@ -250,41 +216,6 @@
<role>
com.dianping.cat.report.page.transaction.JspViewer
</role>
<implementation>
com.dianping.cat.report.page.transaction.JspViewer
</implementation>
</component>
<component>
<role>
com.dianping.cat.report.page.failure.Handler
</role>
<implementation>
com.dianping.cat.report.page.failure.Handler
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.report.ServerConfig
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.report.page.failure.JspViewer
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.report.page.failure.FailureManager
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.report.ServerConfig
</role>
<implementation>
com.dianping.cat.report.ServerConfig
</implementation>
<requirements>
<requirement>
<role>
java.util.List
</role>
</requirement>
<requirement>
<role>
java.lang.String
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.report.page.failure.JspViewer
</role>
<implementation>
com.dianping.cat.report.page.failure.JspViewer
</implementation>
</component>
<component>
<role>
com.dianping.cat.report.page.failure.FailureManager
</role>
<implementation>
com.dianping.cat.report.page.failure.FailureManager
</implementation>
</component>
<component>
<role>
com.dianping.cat.report.page.logview.Handler
</role>
<implementation>
com.dianping.cat.report.page.logview.Handler
</implementation>
...
...
@@ -323,36 +254,20 @@
<implementation>
com.dianping.cat.report.page.ip.JspViewer
</implementation>
</component>
<component>
<role>
com.dianping.cat.report.page.ip.IpManager
</role>
<implementation>
com.dianping.cat.report.page.ip.IpManager
</implementation>
</component>
<component>
<role>
com.dianping.cat.report.page.service.Handler
</role>
<implementation>
com.dianping.cat.report.page.service.Handler
</implementation>
<role>
com.dianping.cat.report.ServerConfig
</role>
<implementation>
com.dianping.cat.report.ServerConfig
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.report.page.service.JspViewer
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.report.page.service.provider.ModelProvider
</role>
<role-hint>
failure
</role-hint>
<field-name>
m_failureModel
</field-name>
</requirement>
<requirement>
<role>
com.dianping.cat.report.page.service.provider.ModelProvider
</role>
<role-hint>
transaction
</role-hint>
<field-name>
m_transactionModel
</field-name>
<role>
java.util.List
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.report.page.service.provider.ModelProvider
</role>
<role-hint>
ip
</role-hint>
<field-name>
m_ipModel
</field-name>
<role>
java.lang.String
</role>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.report.page.
service.JspView
er
</role>
<implementation>
com.dianping.cat.report.page.
service.JspView
er
</implementation>
<role>
com.dianping.cat.report.page.
ip.IpManag
er
</role>
<implementation>
com.dianping.cat.report.page.
ip.IpManag
er
</implementation>
</component>
<component>
<role>
com.dianping.cat.report.page.model.Handler
</role>
...
...
@@ -366,6 +281,11 @@
<role-hint>
transaction-local
</role-hint>
<field-name>
m_transactionService
</field-name>
</requirement>
<requirement>
<role>
com.dianping.cat.report.page.model.spi.ModelService
</role>
<role-hint>
problem-local
</role-hint>
<field-name>
m_problemService
</field-name>
</requirement>
<requirement>
<role>
com.dianping.cat.report.page.model.spi.ModelService
</role>
<role-hint>
logview-local
</role-hint>
...
...
@@ -388,6 +308,17 @@
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.report.page.model.problem.LocalProblemService
</role>
<implementation>
com.dianping.cat.report.page.model.problem.LocalProblemService
</implementation>
<requirements>
<requirement>
<role>
com.dianping.cat.message.spi.MessageConsumer
</role>
<role-hint>
realtime
</role-hint>
<field-name>
m_consumer
</field-name>
</requirement>
</requirements>
</component>
<component>
<role>
com.dianping.cat.report.page.model.logview.LocalLogViewService
</role>
<implementation>
com.dianping.cat.report.page.model.logview.LocalLogViewService
</implementation>
...
...
@@ -395,6 +326,12 @@
<requirement>
<role>
com.dianping.cat.message.spi.MessagePathBuilder
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.storage.BucketManager
</role>
</requirement>
<requirement>
<role>
com.dianping.cat.message.spi.MessageCodec
</role>
</requirement>
</requirements>
</component>
<component>
...
...
cat-home/src/main/webapp/css/failure.css
已删除
100644 → 0
浏览文件 @
3829e25a
.report-table
{
border-spacing
:
0
;
}
.report-table
th
{
padding
:
3px
;
background-color
:
#f5f5f5
;
border-right
:
1px
solid
#ccc
;
border-bottom
:
1px
solid
#ccc
;
border-top
:
1px
solid
#ccc
;
}
.report-table
td
{
padding
:
3px
;
background-color
:
#f5f5f5
;
border-right
:
1px
solid
#ccc
;
border-bottom
:
1px
solid
#ccc
;
}
.report-table
caption
{
background-color
:
#f6a929
;
padding
:
3px
;
color
:
#fff
;
font-weight
:
bold
;
}
.report-table
th
{
color
:
#6c9dab
;
}
.report-table
.RuntimeException
{
background-color
:
#CCFFFF
;
}
.report-table
.Exception
{
background-color
:
#CCCCCC
;
}
.report-table
.Error
{
background-color
:
#FFCCCC
;
}
.report-table
.LongUrl
{
background-color
:
#FF6666
;
}
.report-table
.Other
{
background-color
:
#FF6666
;
}
\ No newline at end of file
cat-home/src/main/webapp/css/jquery.css
已删除
100644 → 0
浏览文件 @
3829e25a
此差异已折叠。
点击以展开。
cat-home/src/main/webapp/css/logview.css
浏览文件 @
969e8f69
...
...
@@ -2,6 +2,11 @@
width
:
auto
;
}
.logview
.nav
{
font-size
:
small
;
white-space
:
nowrap
;
}
tr
.odd
td
{
background-color
:
#eee
;
font-size
:
small
;
...
...
@@ -28,4 +33,4 @@ tr.link td {
.error
{
color
:
red
;
}
}
\ No newline at end of file
cat-home/src/main/webapp/css/style.css
已删除
100644 → 0
浏览文件 @
3829e25a
code
{
font-size
:
1em
;
}
/* extra rules for even and odd rows */
.even
{
background
:
#eee
;
}
.odd
{
}
body
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
12px
;
background
:
white
;
margin
:
0
;
font
:
Message-Box
;
}
table
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
12px
}
batch_table
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
12px
;
cellspacing=5;
border
:
true
}
td
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
12px
}
p
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
12px
}
.fancy-header
{
background
:
orange
;
color
:
white
;
font-weight
:
bold
;
border-bottom
:
solid
black
1px
}
.fancy-footer
{
background
:
orange
;
color
:
white
;
font-weight
:
bold
;
border-top
:
solid
black
1px
;
border-bottom
:
solid
black
1px
}
.navbar
{
background
:
lightblue
;
font-weight
:
bold
;
border-bottom
:
solid
black
1px
}
.navbar
A
{
text-decoration
:
none
;
color
:
blue
}
.navbar
A
:hover
{
color
:
yellow
}
.seealso
{
}
.seealso
A
{
text-decoration
:
none
;
color
:
blue
}
.seealso
A
:hover
{
color
:
yellow
}
.sql
{
font-family
:
Courier
;
font-size
:
12px
;
}
.heading-1
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
18px
;
font-weight
:
bold
}
.heading-2
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
12px
;
font-weight
:
bold
}
.table-header
{
font-size
:
12px
;
font-weight
:
bold
;
vertical-align
:
top
;
}
.table-header-em
{
font-size
:
12px
;
font-weight
:
bold
;
vertical-align
:
top
;
}
.thread_table
{
border-right
:
solid
black
1px
;
border-bottom
:
solid
black
1px
;
border-top
:
solid
black
1px
}
.thread_table
td
{
border-left
:
solid
black
1px
}
.table-header-em
td
{
border-bottom
:
solid
black
1px
}
.sectionCtl
{
text-decoration
:
none
;
color
:
blue
}
.sectionCtl
:hover
{
background
:
blue
;
color
:
white
}
.page_body
{
margin
:
10
}
.url_sql
{
display
:
none
}
.category
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
12px
;
font-weight
:
normal
}
.clip_name
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
12px
;
font-weight
:
bold
}
.clip_name_x
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
18px
}
.category_sel
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
12px
;
font-weight
:
bold
}
.block_label
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-weight
:
bold
;
font-size
:
12px
}
.heading-1
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
18px
;
font-weight
:
bold
}
.heading-2
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
12px
;
font-weight
:
bold
}
.navbar-1
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
12px
;
font-weight
:
bold
}
.navbar-2
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
12px
;
font-weight
:
bold
}
pre
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
12px
}
.normal
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
12px
}
CAPTION
{
font-weight
:
bold
;
}
.HLITE
{
font-weight
:
bold
;
margin-top
:
6pt
}
.batch
{
font-weight
:
bold
;
}
.error
{
font-weight
:
bold
;
color
:
red
;
}
.evt-error
{
color
:
red
;
}
.evt-warning
{
color
:
orange
}
.evt-connect
{
color
:
green
}
.evt-constr
{
color
:
blue
}
.evt-disconn
{
color
:
purple
}
.evt-cache_i
{
color
:
#aaaa00
}
.evt-cache_r
{
color
:
#aa3faa
}
.evt-down
{
color
:
#009933
}
.evt-up
{
color
:
#ffaaaa
}
.evt-unf_url
{
color
:
#9966ff
}
.batch-start
{
color
:
#AAAA00
}
.batch-term-success
{
color
:
#0000ff
}
.batch-term-fail
{
color
:
#ff7f00
}
.batch-item-process
{
color
:
#000000
}
.batch-item-success
{
color
:
#009933
}
.batch-item-fail
{
color
:
#ff0000
}
.batch-item-search-start
{
color
:
#871F78
}
.batch-item-search-end
{
color
:
#9966ff
}
.batch-item-retrieve-item-start
{
color
:
#982E51
}
.batch-item-retrieve-item-end
{
color
:
#982E74
}
.batch-item-update-item-start
{
color
:
#982E94
}
.batch-item-update-item-end
{
color
:
#7E2E98
}
.batch-item-send-mail-start
{
color
:
#622E98
}
.batch-item-send-mail-end
{
color
:
#2E6798
}
.batch-item-add-fvf-start
{
color
:
#2EAF98
}
.batch-item-add-fvf-end
{
color
:
#2E987E
}
.batch-item-prep-mail-start
{
color
:
#E74F05
}
.batch-item-prep-mail-end
{
color
:
#E72505
}
.batch-item-send-msnalert-start
{
color
:
#988F2E
}
.batch-item-send-msnalert-end
{
color
:
#987E2E
}
.batch-item-dblookup-start
{
color
:
#98742E
}
.batch-item-dblookup-end
{
color
:
#985D2E
}
h2
{
font-family
:
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
12px
;
font-weight
:
bold
}
.tr0
{
}
.tr1
{
background
:
#e0e0e0
}
.emph
{
font-weight
:
bold
;
color
:
red
;
}
.und
{
border-bottom
:
solid
black
1px
}
.date_select
{
background
:
#f0f0f0
;
border
:
solid
black
1px
;
float
:
left
;
padding
:
3
5
3
7
;
}
.message
{
font-weight
:
bold
;
color
:
blue
;
}
cat-home/src/main/webapp/js/failure.js
已删除
100644 → 0
浏览文件 @
3829e25a
function
generateTable
(
wrap
,
json
)
{
var
table
=
$
(
'
<table />
'
).
addClass
(
'
report-table
'
),
caption
=
$
(
'
<caption />
'
),
thead
=
$
(
'
<thead />
'
),
thr
=
$
(
'
<tr />
'
).
appendTo
(
thead
),
threads
=
json
.
threads
.
threads
,
ths
=
[
"
Minute
"
]
.
concat
(
threads
);
if
(
threads
==
null
)
{
threads
=
[];
}
/*
* caption.html( "From " + json.startTime + " To " + json.endTime + "
* Failure Report Domain:" + json.domain).appendTo(table);
*/
thead
.
appendTo
(
table
);
ths
.
forEach
(
function
(
th
)
{
var
temp
=
$
(
'
<th />
'
).
html
(
th
);
if
(
temp
!=
""
)
temp
.
appendTo
(
thr
);
});
/*
* $('<tr />').append( $('<td />').attr('colspan', threads.length +
* 1).html( "machines:" + json.machines.machines.join(','))).appendTo(
* table);
*/
for
(
var
key
in
json
.
segments
)
{
var
seg
=
json
.
segments
[
key
];
var
tr
=
$
(
'
<tr />
'
),
tds
=
[];
$
(
'
<td />
'
).
html
(
seg
.
id
.
substring
(
11
)).
appendTo
(
tr
);
threads
.
forEach
(
function
()
{
var
td
=
$
(
'
<td />
'
);
td
.
appendTo
(
tr
);
tds
.
push
(
td
);
});
if
(
seg
.
entries
==
null
)
{
seg
.
entries
=
[];
}
seg
.
entries
.
forEach
(
function
(
entry
)
{
var
index
=
threads
.
indexOf
(
entry
.
threadId
),
td
=
tds
[
index
],
type
=
entry
.
type
,
anchor
=
$
(
'
<a />
'
).
attr
(
"
href
"
,
"
m/
"
+
entry
.
path
).
addClass
(
type
).
html
(
entry
.
text
);
if
(
td
.
html
())
{
td
.
append
(
$
(
'
<br />
'
));
}
if
(
!
type
)
{
type
=
"
Other
"
;
}
td
.
append
(
anchor
);
});
tr
.
appendTo
(
table
);
}
$
(
wrap
).
append
(
table
);
}
generateTable
(
'
#failureTable
'
,
jsonData
);
var
currentDomain
=
$
(
"
#currentDomain
"
).
val
();
$
(
"
#domain-
"
+
currentDomain
).
css
(
"
background
"
,
"
#FFCC00
"
);
var
currentIp
=
$
(
"
#currentIp
"
).
val
();
$
(
"
a[data-id='ip-
"
+
currentIp
+
"
']
"
).
css
(
"
background
"
,
"
#FFCC00
"
);
cat-home/src/main/webapp/js/sql_scripts.js
已删除
100644 → 0
浏览文件 @
3829e25a
var
hideRE
=
/
\[
:: hide ::
\]
/gi
;
var
showRE
=
/
\[
:: show ::
\]
/gi
;
function
toggleSection
(
name
)
{
var
obj
=
document
.
getElementById
(
name
);
var
ctl
=
document
.
getElementById
(
name
+
"
_ctl
"
);
if
(
obj
.
style
.
display
==
"
none
"
)
{
obj
.
style
.
display
=
"
inline
"
;
ctl
.
innerHTML
=
ctl
.
innerHTML
.
replace
(
showRE
,
"
[:: hide ::]
"
);
}
else
{
obj
.
style
.
display
=
"
none
"
;
ctl
.
innerHTML
=
ctl
.
innerHTML
.
replace
(
hideRE
,
"
[:: show ::]
"
);
}
resizeIframe
(
"
iframe_
"
+
name
.
substring
(
4
));
return
false
;
}
function
computeHeight
()
{
//window.console.log("db.oh:"+ document.body.offsetHeight);
//window.console.log("d.h:"+ document.height);
//window.console.log("db.sh:"+ document.body.scrollHeight);
// msie does not define document.height
if
(
document
.
height
)
{
return
document
.
body
.
offsetHeight
+
35
;
}
else
{
return
document
.
body
.
scrollHeight
;
}
}
function
resizeIframe
(
name
)
{
var
ifr
=
document
.
getElementById
(
name
);
ifr
.
style
.
height
=
ifr
.
contentWindow
.
computeHeight
();
if
(
window
.
parent
!=
window
)
{
window
.
parent
.
resizeIframe
(
window
.
frameElement
.
id
);
}
}
function
toggleSectionHide
(
name
)
{
var
obj
=
document
.
getElementById
(
name
);
var
ctl
=
document
.
getElementById
(
name
+
"
_ctl
"
);
if
(
obj
.
style
.
display
==
"
inline
"
)
{
obj
.
style
.
display
=
"
none
"
;
ctl
.
innerHTML
=
ctl
.
innerHTML
.
replace
(
hideRE
,
"
[:: show ::]
"
);
}
else
{
obj
.
style
.
display
=
"
inline
"
;
ctl
.
innerHTML
=
ctl
.
innerHTML
.
replace
(
showRE
,
"
[:: hide ::]
"
);
}
return
false
;
}
function
toggleSQL
(
name
)
{
var
obj
=
document
.
getElementById
(
name
);
if
(
obj
.
style
.
display
==
"
none
"
)
{
obj
.
style
.
display
=
"
inline
"
;
}
else
{
obj
.
style
.
display
=
"
none
"
;
}
return
false
;
}
function
toggleSQLHide
(
name
)
{
var
obj
=
document
.
getElementById
(
name
);
if
(
obj
.
style
.
display
==
"
inline
"
)
{
obj
.
style
.
display
=
"
none
"
;
}
else
{
obj
.
style
.
display
=
"
inline
"
;
}
return
false
;
}
function
toggleSQL2
(
name
)
{
var
obj
=
document
.
getElementById
(
name
+
"
-1
"
);
if
(
obj
.
style
.
display
==
"
none
"
)
{
obj
.
style
.
display
=
"
inline
"
;
}
else
{
obj
.
style
.
display
=
"
none
"
;
}
obj
=
document
.
getElementById
(
name
+
"
-2
"
);
if
(
obj
.
style
.
display
==
"
none
"
)
{
obj
.
style
.
display
=
"
inline
"
;
}
else
{
obj
.
style
.
display
=
"
none
"
;
}
return
false
;
}
cat-home/src/main/webapp/jsp/report/failure.jsp
已删除
100644 → 0
浏览文件 @
3829e25a
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<%@ taglib
prefix=
"a"
uri=
"/WEB-INF/app.tld"
%>
<%@ taglib
prefix=
"c"
uri=
"http://java.sun.com/jsp/jstl/core"
%>
<%@ taglib
prefix=
"res"
uri=
"http://www.unidal.org/webres"
%>
<jsp:useBean
id=
"ctx"
type=
"com.dianping.cat.report.page.failure.Context"
scope=
"request"
/>
<jsp:useBean
id=
"payload"
type=
"com.dianping.cat.report.page.failure.Payload"
scope=
"request"
/>
<jsp:useBean
id=
"model"
type=
"com.dianping.cat.report.page.failure.Model"
scope=
"request"
/>
<res:useCss
value=
'
${
res
.
css
.
local
.
style_css
}
'
target=
"head-css"
/>
<res:useCss
value=
'
${
res
.
css
.
local
.
failure_css
}
'
target=
"head-css"
/>
<res:useJs
value=
'
${
res
.
js
.
local
.
jquery_min_js
}
'
target=
"head-js"
/>
<res:useJs
value=
'
${
res
.
js
.
local
.
sql_scripts_js
}
'
target=
"head-js"
/>
<script
type=
"text/javascript"
>
var
jsonData
=
$
{
model
.
jsonResult
};
</script>
<a:report
title=
"Failure Report"
timestamp=
"2012-02-07"
>
<table
id=
"failureTable"
width=
"100%"
border=
"0"
cellspacing=
"0"
></table>
</a:report>
<res:useJs
value=
"
${
res
.
js
.
local
.
failure_js
}
"
target=
"bottom-js"
/>
\ No newline at end of file
cat-home/src/main/webapp/jsp/report/service.jsp
已删除
100644 → 0
浏览文件 @
3829e25a
<%@ page
contentType=
"text/html; charset=utf-8"
%>
<jsp:useBean
id=
"ctx"
type=
"com.dianping.cat.report.page.service.Context"
scope=
"request"
/>
<jsp:useBean
id=
"payload"
type=
"com.dianping.cat.report.page.service.Payload"
scope=
"request"
/>
<jsp:useBean
id=
"model"
type=
"com.dianping.cat.report.page.service.Model"
scope=
"request"
/>
<domains>
${model.domains}
</domains>
<ips>
${model.ips}
</ips>
<data>
${model.xmlData}
</data>
\ No newline at end of file
cat-job/src/main/java/com/dianping/cat/job/hdfs/DefaultInputChannelManager.java
浏览文件 @
969e8f69
package
com.dianping.cat.job.hdfs
;
import
java.io.IOException
;
import
java.net.InetAddress
;
import
java.net.URI
;
import
java.net.UnknownHostException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -22,7 +20,8 @@ import com.dianping.cat.message.spi.MessagePathBuilder;
import
com.site.lookup.ContainerHolder
;
import
com.site.lookup.annotation.Inject
;
public
class
DefaultInputChannelManager
extends
ContainerHolder
implements
InputChannelManager
,
Initializable
,
LogEnabled
{
public
class
DefaultInputChannelManager
extends
ContainerHolder
implements
InputChannelManager
,
Initializable
,
LogEnabled
{
@Inject
private
MessagePathBuilder
m_builder
;
...
...
@@ -36,8 +35,6 @@ public class DefaultInputChannelManager extends ContainerHolder implements Input
private
Path
m_basePath
;
private
String
m_ipAddress
;
private
Map
<
String
,
InputChannel
>
m_channels
=
new
HashMap
<
String
,
InputChannel
>();
private
Logger
m_logger
;
...
...
@@ -100,14 +97,6 @@ public class DefaultInputChannelManager extends ContainerHolder implements Input
}
catch
(
Exception
e
)
{
throw
new
InitializationException
(
"Error when getting HDFS file system."
,
e
);
}
try
{
InetAddress
localHost
=
InetAddress
.
getLocalHost
();
m_ipAddress
=
localHost
.
getHostAddress
();
}
catch
(
UnknownHostException
e
)
{
m_logger
.
warn
(
"Unable to get local host!"
,
e
);
}
}
public
void
setBaseDir
(
String
baseDir
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录