Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
d75acd0e
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,发现更多精彩内容 >>
提交
d75acd0e
编写于
12月 16, 2013
作者:
Y
youyong205
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'biz' of github.com:dianping/cat into biz
上级
85d814ed
784c046a
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
47 addition
and
15 deletion
+47
-15
abtest-sample/pom.xml
abtest-sample/pom.xml
+5
-0
abtest-sample/src/main/java/com/dianping/abtest/sample/ABTestSampleServlet.java
.../java/com/dianping/abtest/sample/ABTestSampleServlet.java
+9
-3
abtest-sample/src/test/resources/com/dianping/abtest/sample/log4j.xml
...e/src/test/resources/com/dianping/abtest/sample/log4j.xml
+20
-0
cat-client/src/main/java/com/dianping/cat/CatConstants.java
cat-client/src/main/java/com/dianping/cat/CatConstants.java
+3
-1
cat-client/src/main/java/com/dianping/cat/message/internal/DefaultMessageManager.java
.../dianping/cat/message/internal/DefaultMessageManager.java
+0
-1
cat-client/src/main/resources/com/dianping/cat/configuration/client/config.xsd
...esources/com/dianping/cat/configuration/client/config.xsd
+1
-2
cat-client/src/main/resources/com/dianping/cat/status/model/status.xsd
...c/main/resources/com/dianping/cat/status/model/status.xsd
+1
-2
cat-home/src/main/resources/chrome/cat.crx
cat-home/src/main/resources/chrome/cat.crx
+0
-0
cat-home/src/main/resources/chrome/cat/cat.js
cat-home/src/main/resources/chrome/cat/cat.js
+8
-6
未找到文件。
abtest-sample/pom.xml
浏览文件 @
d75acd0e
...
...
@@ -28,6 +28,11 @@
<version>
2.0.4
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
log4j
</groupId>
<artifactId>
log4j
</artifactId>
<version>
1.2.9
</version>
</dependency>
</dependencies>
<build>
<finalName>
abtest-sample
</finalName>
...
...
abtest-sample/src/main/java/com/dianping/abtest/sample/ABTestSampleServlet.java
浏览文件 @
d75acd0e
...
...
@@ -8,6 +8,8 @@ import javax.servlet.http.HttpServlet;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.log4j.Logger
;
import
com.dianping.cat.Cat
;
import
com.dianping.cat.abtest.ABTest
;
import
com.dianping.cat.abtest.ABTestManager
;
...
...
@@ -15,19 +17,23 @@ import com.dianping.cat.abtest.ABTestName;
public
class
ABTestSampleServlet
extends
HttpServlet
{
private
static
final
long
serialVersionUID
=
-
6472784609174835547L
;
private
Logger
m_logger
=
Logger
.
getLogger
(
"ABTest"
);
private
ABTest
m_abtest
=
ABTestManager
.
getTest
(
MyABTestId
.
CASE1
);
@Override
public
void
service
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
Cat
.
logError
(
new
Exception
());
if
(
m_abtest
.
isGroupA
())
{
RequestDispatcher
rd
=
getServletContext
().
getRequestDispatcher
(
"/index1.jsp"
);
rd
.
forward
(
request
,
response
);
m_logger
.
info
(
"A"
);
}
else
{
RequestDispatcher
rd
=
getServletContext
().
getRequestDispatcher
(
"/index2.jsp"
);
rd
.
forward
(
request
,
response
);
m_logger
.
info
(
"B"
);
}
Cat
.
logMetric
(
"ABTest"
,
"view"
,
"index2"
,
"group"
,
"Control"
);
...
...
abtest-sample/src/test/resources/com/dianping/abtest/sample/log4j.xml
0 → 100644
浏览文件 @
d75acd0e
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration
xmlns:log4j=
"http://jakarta.apache.org/log4j/"
>
<appender
name=
"myConsole"
class=
"org.apache.log4j.ConsoleAppender"
>
<layout
class=
"org.apache.log4j.PatternLayout"
>
<param
name=
"ConversionPattern"
value=
"[%d{dd HH:mm:ss,SSS\} %-5p] [%t] %c{2\} - %m%n"
/>
</layout>
</appender>
<appender
name=
"catAppender"
class=
"com.dianping.cat.log4j.CatAppender"
>
</appender>
<root>
<level
value=
"info"
/>
<appender-ref
ref=
"myConsole"
/>
<appender-ref
ref=
"catAppender"
/>
</root>
</log4j:configuration>
\ No newline at end of file
cat-client/src/main/java/com/dianping/cat/CatConstants.java
浏览文件 @
d75acd0e
...
...
@@ -70,7 +70,9 @@ public class CatConstants {
public
static
final
String
TYPE_ACTION
=
"Action"
;
public
static
final
String
TYPE_METRIC
=
"metricType"
;
public
static
final
String
TYPE_METRIC
=
"MetricType"
;
public
static
final
String
TYPE_TRACE
=
"TraceMode"
;
public
static
final
int
ERROR_COUNT
=
100
;
...
...
cat-client/src/main/java/com/dianping/cat/message/internal/DefaultMessageManager.java
浏览文件 @
d75acd0e
...
...
@@ -471,5 +471,4 @@ public class DefaultMessageManager extends ContainerHolder implements MessageMan
}
}
}
}
cat-client/src/main/resources/com/dianping/cat/configuration/client/config.xsd
浏览文件 @
d75acd0e
<?xml version="1.0" encoding="utf-8"?>
<xs:schema
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
elementFormDefault=
"qualified"
attributeFormDefault=
"unqualified"
>
<?xml version="1.0" encoding="utf-8"?>
<xs:schema
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
elementFormDefault=
"qualified"
attributeFormDefault=
"unqualified"
>
<xs:element
name=
"config"
type=
"ConfigType"
/>
<xs:complexType
name=
"ConfigType"
>
<xs:sequence>
...
...
cat-client/src/main/resources/com/dianping/cat/status/model/status.xsd
浏览文件 @
d75acd0e
<?xml version="1.0" encoding="utf-8"?>
<xs:schema
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
elementFormDefault=
"qualified"
attributeFormDefault=
"unqualified"
>
<?xml version="1.0" encoding="utf-8"?>
<xs:schema
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
elementFormDefault=
"qualified"
attributeFormDefault=
"unqualified"
>
<xs:element
name=
"status"
type=
"StatusType"
/>
<xs:complexType
name=
"StatusType"
>
<xs:sequence>
...
...
cat-home/src/main/resources/chrome/cat.crx
浏览文件 @
d75acd0e
无法预览此类型文件
cat-home/src/main/resources/chrome/cat/cat.js
浏览文件 @
d75acd0e
...
...
@@ -77,7 +77,7 @@ function TabManager() {
};
this
.
headersWillBeSent
=
function
(
tabId
,
headers
)
{
headers
.
push
({
name
:
"
X-CAT-TRAC
ING
"
,
value
:
"
true
"
});
headers
.
push
({
name
:
"
X-CAT-TRAC
E-MODE
"
,
value
:
"
true
"
});
return
{
requestHeaders
:
headers
};
};
...
...
@@ -115,10 +115,12 @@ function TabManager() {
var
tabMgr
=
new
TabManager
();
var
responseCallback
=
function
(
details
)
{
var
headers
=
details
.
responseHeaders
;
var
tabId
=
details
.
tabId
;
var
url
=
details
.
url
;
tabMgr
.
headersReceived
(
tabId
,
headers
,
url
);
if
(
"
main_frame
"
==
details
.
type
){
var
headers
=
details
.
responseHeaders
;
var
tabId
=
details
.
tabId
;
var
url
=
details
.
url
;
tabMgr
.
headersReceived
(
tabId
,
headers
,
url
);
}
};
var
requestCallback
=
function
(
details
)
{
var
headers
=
details
.
requestHeaders
;
...
...
@@ -128,7 +130,7 @@ var requestCallback = function(details) {
var
filter
=
{
urls
:
[
"
*://*/*
"
]};
chrome
.
webRequest
.
onHeadersReceived
.
addListener
(
responseCallback
,
filter
,
[
"
responseHeaders
"
]);
//
chrome.webRequest.onBeforeSendHeaders.addListener(requestCallback, filter, ["blocking", "requestHeaders"]);
chrome
.
webRequest
.
onBeforeSendHeaders
.
addListener
(
requestCallback
,
filter
,
[
"
blocking
"
,
"
requestHeaders
"
]);
chrome
.
pageAction
.
onClicked
.
addListener
(
function
(
tab
)
{
//alert(localStorage["favorite_color"]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录