Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
月轩居士
SkyWalking
提交
0b0bc1cf
S
SkyWalking
项目概览
月轩居士
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0b0bc1cf
编写于
12月 04, 2016
作者:
A
ascrutae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
移除Tomcat插件测试代码,修复部分问题
上级
19e64e02
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
38 addition
and
204 deletion
+38
-204
skywalking-sniffer/skywalking-agent/pom.xml
skywalking-sniffer/skywalking-agent/pom.xml
+1
-1
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/client/Agent2RoutingClient.java
...java/com/a/eye/skywalking/client/Agent2RoutingClient.java
+11
-11
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/disruptor/ack/SendAckSpanEventHandler.java
...eye/skywalking/disruptor/ack/SendAckSpanEventHandler.java
+10
-9
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/disruptor/request/SendRequestSpanEventHandler.java
...alking/disruptor/request/SendRequestSpanEventHandler.java
+11
-9
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/invoke/monitor/BaseInvokeMonitor.java
...om/a/eye/skywalking/invoke/monitor/BaseInvokeMonitor.java
+5
-3
skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/test/java/test/com/ai/skywalking/plugin/tomcat78x/EmbedTomcat.java
.../test/com/ai/skywalking/plugin/tomcat78x/EmbedTomcat.java
+0
-39
skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/test/java/test/com/ai/skywalking/plugin/tomcat78x/TomcatPluginTest.java
.../com/ai/skywalking/plugin/tomcat78x/TomcatPluginTest.java
+0
-59
skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/test/java/test/com/ai/skywalking/plugin/tomcat78x/servlet/HelloServlet.java
.../ai/skywalking/plugin/tomcat78x/servlet/HelloServlet.java
+0
-23
skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/test/resources/sky-walking.auth
...tomcat-7.x-8.x-plugin/src/test/resources/sky-walking.auth
+0
-45
skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/test/resources/webapp/HelloWorld.jsp
...t-7.x-8.x-plugin/src/test/resources/webapp/HelloWorld.jsp
+0
-5
未找到文件。
skywalking-sniffer/skywalking-agent/pom.xml
浏览文件 @
0b0bc1cf
...
...
@@ -19,7 +19,7 @@
<shade.package>
com.a.eye.skywalking.api.dependencies
</shade.package>
<premain.class>
com.a.eye.skywalking.agent.SkyWalkingAgent
</premain.class>
<shade.net.bytebuddy.source>
net.bytebuddy
</shade.net.bytebuddy.source>
<shade.net.bytebuddy.target>
${shade.package}.${shade.net.bytebuddy.source}
}
</shade.net.bytebuddy.target>
<shade.net.bytebuddy.target>
${shade.package}.${shade.net.bytebuddy.source}
</shade.net.bytebuddy.target>
<!-- disruptor -->
<shade.com.lmax.disruptor.source>
com.lmax.disruptor
</shade.com.lmax.disruptor.source>
<shade.com.lmax.disruptor.target>
${shade.package}.${shade.com.lmax.disruptor.source}
</shade.com.lmax.disruptor.target>
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/client/Agent2RoutingClient.java
浏览文件 @
0b0bc1cf
...
...
@@ -25,13 +25,13 @@ import java.util.concurrent.locks.LockSupport;
public
class
Agent2RoutingClient
extends
Thread
{
private
static
ILog
logger
=
LogManager
.
getLogger
(
Agent2RoutingClient
.
class
);
private
List
<
ServerAddr
>
addrList
;
private
Client
client
;
private
List
<
ServerAddr
>
addrList
;
private
Client
client
;
private
SpanStorageClient
spanStorageClient
;
private
NetworkListener
listener
;
private
SendRequestSpanEventHandler
requestSpanDataSupplier
=
null
;
private
SendAckSpanEventHandler
ackSpanDataSupplier
=
null
;
private
volatile
boolean
connected
=
false
;
private
NetworkListener
listener
;
private
SendRequestSpanEventHandler
requestSpanDataSupplier
=
null
;
private
SendAckSpanEventHandler
ackSpanDataSupplier
=
null
;
private
volatile
boolean
connected
=
false
;
public
static
Agent2RoutingClient
INSTANCE
=
new
Agent2RoutingClient
();
...
...
@@ -80,7 +80,7 @@ public class Agent2RoutingClient extends Thread {
public
void
run
()
{
while
(
true
)
{
try
{
while
(
connected
&&
!
client
.
isShutdown
())
{
while
(
requestSpanDataSupplier
!=
null
&&
ackSpanDataSupplier
!=
null
&&
connected
&&
!
client
.
isShutdown
())
{
List
<
RequestSpan
>
requestData
=
this
.
requestSpanDataSupplier
.
getBufferData
();
List
<
AckSpan
>
ackData
=
this
.
ackSpanDataSupplier
.
getBufferData
();
...
...
@@ -103,7 +103,7 @@ public class Agent2RoutingClient extends Thread {
listener
.
wait2Confirm
();
}
if
(!
hasData
)
{
if
(!
hasData
)
{
try
{
Thread
.
sleep
(
10
*
1000L
);
}
catch
(
InterruptedException
e
)
{
...
...
@@ -150,13 +150,13 @@ public class Agent2RoutingClient extends Thread {
HealthCollector
.
getCurrentHeathReading
(
"Agent2RoutingClient"
).
updateData
(
HeathReading
.
INFO
,
"batch send data to routing node."
);
}
void
wait2Confirm
(){
void
wait2Confirm
()
{
// wait 20s, most.
int
countDown
=
100
*
20
;
while
(!
listener
.
isBatchFinished
())
{
try
{
Thread
.
sleep
(
10L
);
if
(
countDown
--
<
0
)
{
if
(
countDown
--
<
0
)
{
batchFinished
=
true
;
}
}
catch
(
InterruptedException
e
)
{
...
...
@@ -169,7 +169,7 @@ public class Agent2RoutingClient extends Thread {
class
ServerAddr
{
String
ip
;
String
ip
;
Integer
port
;
public
ServerAddr
(
String
ip
,
String
port
)
{
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/disruptor/ack/SendAckSpanEventHandler.java
浏览文件 @
0b0bc1cf
...
...
@@ -6,7 +6,6 @@ import com.a.eye.skywalking.health.report.HeathReading;
import
com.a.eye.skywalking.logging.api.ILog
;
import
com.a.eye.skywalking.logging.api.LogManager
;
import
com.a.eye.skywalking.network.grpc.AckSpan
;
import
com.a.eye.skywalking.network.grpc.RequestSpan
;
import
com.lmax.disruptor.EventHandler
;
import
java.util.ArrayList
;
...
...
@@ -16,10 +15,10 @@ import java.util.List;
* Created by wusheng on 2016/11/24.
*/
public
class
SendAckSpanEventHandler
implements
EventHandler
<
AckSpanHolder
>
{
private
static
ILog
logger
=
LogManager
.
getLogger
(
SendAckSpanEventHandler
.
class
);
private
int
bufferSize
=
100
;
private
AckSpan
[]
buffer
=
new
AckSpan
[
bufferSize
];
private
int
bufferIdx
=
0
;
private
static
ILog
logger
=
LogManager
.
getLogger
(
SendAckSpanEventHandler
.
class
);
private
int
bufferSize
=
100
;
private
AckSpan
[]
buffer
=
new
AckSpan
[
bufferSize
];
private
int
bufferIdx
=
0
;
public
SendAckSpanEventHandler
()
{
Agent2RoutingClient
.
INSTANCE
.
setAckSpanDataSupplier
(
this
);
...
...
@@ -27,7 +26,7 @@ public class SendAckSpanEventHandler implements EventHandler<AckSpanHolder> {
@Override
public
void
onEvent
(
AckSpanHolder
event
,
long
sequence
,
boolean
endOfBatch
)
throws
Exception
{
if
(
buffer
[
bufferIdx
]
!=
null
)
{
if
(
buffer
[
bufferIdx
]
!=
null
)
{
return
;
}
...
...
@@ -43,11 +42,13 @@ public class SendAckSpanEventHandler implements EventHandler<AckSpanHolder> {
}
}
public
List
<
AckSpan
>
getBufferData
(){
public
List
<
AckSpan
>
getBufferData
()
{
List
<
AckSpan
>
data
=
new
ArrayList
<
AckSpan
>(
bufferSize
);
for
(
int
i
=
0
;
i
<
buffer
.
length
;
i
++)
{
data
.
add
(
buffer
[
i
]);
buffer
[
i
]
=
null
;
if
(
buffer
[
i
]
!=
null
)
{
data
.
add
(
buffer
[
i
]);
buffer
[
i
]
=
null
;
}
}
return
data
;
}
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/disruptor/request/SendRequestSpanEventHandler.java
浏览文件 @
0b0bc1cf
...
...
@@ -15,10 +15,10 @@ import java.util.List;
* Created by wusheng on 2016/11/24.
*/
public
class
SendRequestSpanEventHandler
implements
EventHandler
<
RequestSpanHolder
>
{
private
static
ILog
logger
=
LogManager
.
getLogger
(
SendRequestSpanEventHandler
.
class
);
private
static
final
int
bufferSize
=
100
;
private
RequestSpan
[]
buffer
=
new
RequestSpan
[
bufferSize
];
private
int
bufferIdx
=
0
;
private
static
ILog
logger
=
LogManager
.
getLogger
(
SendRequestSpanEventHandler
.
class
);
private
static
final
int
bufferSize
=
100
;
private
RequestSpan
[]
buffer
=
new
RequestSpan
[
bufferSize
];
private
int
bufferIdx
=
0
;
public
SendRequestSpanEventHandler
()
{
Agent2RoutingClient
.
INSTANCE
.
setRequestSpanDataSupplier
(
this
);
...
...
@@ -26,14 +26,14 @@ public class SendRequestSpanEventHandler implements EventHandler<RequestSpanHold
@Override
public
void
onEvent
(
RequestSpanHolder
event
,
long
sequence
,
boolean
endOfBatch
)
throws
Exception
{
if
(
buffer
[
bufferIdx
]
!=
null
)
{
if
(
buffer
[
bufferIdx
]
!=
null
)
{
return
;
}
buffer
[
bufferIdx
]
=
event
.
getData
();
bufferIdx
++;
if
(
bufferIdx
==
buffer
.
length
)
{
if
(
bufferIdx
==
buffer
.
length
)
{
bufferIdx
=
0
;
}
...
...
@@ -42,11 +42,13 @@ public class SendRequestSpanEventHandler implements EventHandler<RequestSpanHold
}
}
public
List
<
RequestSpan
>
getBufferData
(){
public
List
<
RequestSpan
>
getBufferData
()
{
List
<
RequestSpan
>
data
=
new
ArrayList
<
RequestSpan
>(
bufferSize
);
for
(
int
i
=
0
;
i
<
buffer
.
length
;
i
++)
{
data
.
add
(
buffer
[
i
]);
buffer
[
i
]
=
null
;
if
(
buffer
[
i
]
!=
null
)
{
data
.
add
(
buffer
[
i
]);
buffer
[
i
]
=
null
;
}
}
return
data
;
}
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/invoke/monitor/BaseInvokeMonitor.java
浏览文件 @
0b0bc1cf
...
...
@@ -43,19 +43,21 @@ public abstract class BaseInvokeMonitor {
return
new
ContextData
(
spanData
);
}
protected
void
sendRequestSpan
(
Span
span
,
Identification
id
){
protected
void
sendRequestSpan
(
Span
span
,
Identification
id
)
{
RequestSpan
.
Builder
requestSpanBuilder
=
span
.
buildRequestSpan
(
RequestSpan
.
newBuilder
());
if
(
id
.
getBusinessKey
()
!=
null
&&
id
.
getBusinessKey
().
length
()
>
0
)
{
requestSpanBuilder
=
requestSpanBuilder
.
setBusinessKey
(
id
.
getBusinessKey
());
}
RequestSpan
requestSpan
=
requestSpanBuilder
.
setViewPointId
(
id
.
getViewPoint
())
.
setSpanTypeDesc
(
id
.
getSpanTypeDesc
())
.
setBusinessKey
(
id
.
getBusinessKey
())
.
setCallType
(
id
.
getCallType
()).
setProcessNo
(
BuriedPointMachineUtil
.
getProcessNo
())
.
setAddress
(
BuriedPointMachineUtil
.
getHostDesc
()).
build
();
RequestSpanDisruptor
.
INSTANCE
.
ready2Send
(
requestSpan
);
}
protected
void
sendAckSpan
(
Span
span
){
protected
void
sendAckSpan
(
Span
span
)
{
AckSpan
ackSpan
=
span
.
buildAckSpan
(
AckSpan
.
newBuilder
()).
build
();
AckSpanDisruptor
.
INSTANCE
.
ready2Send
(
ackSpan
);
...
...
skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/test/java/test/com/ai/skywalking/plugin/tomcat78x/EmbedTomcat.java
已删除
100644 → 0
浏览文件 @
19e64e02
package
test.com.ai.skywalking.plugin.tomcat78x
;
import
org.apache.catalina.LifecycleException
;
import
org.apache.catalina.WebResourceRoot
;
import
org.apache.catalina.core.StandardContext
;
import
org.apache.catalina.startup.Tomcat
;
import
org.apache.catalina.webresources.DirResourceSet
;
import
org.apache.catalina.webresources.StandardRoot
;
import
org.junit.Test
;
import
javax.servlet.ServletException
;
import
java.io.File
;
public
class
EmbedTomcat
{
@Test
public
void
testGetResourcePath
(){
System
.
out
.
println
(
EmbedTomcat
.
class
.
getResource
(
"/"
).
getPath
());
}
@Test
public
void
testStartTomcat
()
throws
ServletException
,
LifecycleException
{
start
();
}
public
static
void
start
()
throws
ServletException
,
LifecycleException
{
String
webappDirLocation
=
EmbedTomcat
.
class
.
getResource
(
"/"
).
getPath
()
+
"webapp/"
;
Tomcat
tomcat
=
new
Tomcat
();
tomcat
.
setPort
(
8080
);
StandardContext
standardContext
=
(
StandardContext
)
tomcat
.
addWebapp
(
"/"
,
new
File
(
webappDirLocation
).
getAbsolutePath
());
File
additionWebInfClasses
=
new
File
(
EmbedTomcat
.
class
.
getResource
(
"/"
).
getPath
());
WebResourceRoot
resourceRoot
=
new
StandardRoot
(
standardContext
);
resourceRoot
.
addPreResources
(
new
DirResourceSet
(
resourceRoot
,
"/WEB-INF/classes"
,
additionWebInfClasses
.
getAbsolutePath
(),
"/"
));
standardContext
.
setResources
(
resourceRoot
);
tomcat
.
start
();
}
}
skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/test/java/test/com/ai/skywalking/plugin/tomcat78x/TomcatPluginTest.java
已删除
100644 → 0
浏览文件 @
19e64e02
package
test.com.ai.skywalking.plugin.tomcat78x
;
import
com.a.eye.skywalking.plugin.PluginException
;
import
com.a.eye.skywalking.plugin.TracingBootstrap
;
import
com.a.eye.skywalking.testframework.api.RequestSpanAssert
;
import
org.apache.catalina.LifecycleException
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.client.ClientProtocolException
;
import
org.apache.http.client.ResponseHandler
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.util.EntityUtils
;
import
org.junit.Test
;
import
javax.servlet.ServletException
;
import
java.io.IOException
;
import
java.lang.reflect.InvocationTargetException
;
public
class
TomcatPluginTest
{
@Test
public
void
test
()
throws
ClassNotFoundException
,
NoSuchMethodException
,
InvocationTargetException
,
IllegalAccessException
,
PluginException
{
TracingBootstrap
.
main
(
new
String
[]
{
TomcatPluginTest
.
class
.
getName
()});
}
public
static
void
main
(
String
[]
args
)
throws
ServletException
,
LifecycleException
,
IOException
,
InterruptedException
{
// start tomcat
EmbedTomcat
.
start
();
// curl httpclient
visitURL
(
"http://127.0.0.1:8080/hello"
);
// assert client
RequestSpanAssert
.
assertEquals
(
new
String
[][]
{{
"0"
,
"http://127.0.0.1:8080/hello"
,
""
}});
}
public
static
void
visitURL
(
String
url
)
throws
IOException
{
CloseableHttpClient
httpclient
=
HttpClients
.
createDefault
();
try
{
HttpGet
httpget
=
new
HttpGet
(
url
);
ResponseHandler
<
String
>
responseHandler
=
new
ResponseHandler
<
String
>()
{
@Override
public
String
handleResponse
(
final
HttpResponse
response
)
throws
ClientProtocolException
,
IOException
{
int
status
=
response
.
getStatusLine
().
getStatusCode
();
if
(
status
>=
200
&&
status
<
300
)
{
HttpEntity
entity
=
response
.
getEntity
();
return
entity
!=
null
?
EntityUtils
.
toString
(
entity
)
:
null
;
}
else
{
throw
new
ClientProtocolException
(
"Unexpected response status: "
+
status
);
}
}
};
String
responseBody
=
httpclient
.
execute
(
httpget
,
responseHandler
);
}
finally
{
httpclient
.
close
();
}
}
}
skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/test/java/test/com/ai/skywalking/plugin/tomcat78x/servlet/HelloServlet.java
已删除
100644 → 0
浏览文件 @
19e64e02
package
test.com.ai.skywalking.plugin.tomcat78x.servlet
;
import
javax.servlet.ServletException
;
import
javax.servlet.annotation.WebServlet
;
import
javax.servlet.http.HttpServlet
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
/**
* Created by xin on 16/7/22.
*/
@WebServlet
(
name
=
"myServlet"
,
urlPatterns
=
{
"/hello"
}
)
public
class
HelloServlet
extends
HttpServlet
{
@Override
protected
void
doGet
(
HttpServletRequest
req
,
HttpServletResponse
resp
)
throws
ServletException
,
IOException
{
System
.
out
.
println
(
"Hello World"
);
}
}
skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/test/resources/sky-walking.auth
已删除
100644 → 0
浏览文件 @
19e64e02
#skyWalking用户ID
skywalking.user_id=123
#skyWalking应用编码
skywalking.application_code=test
#skywalking auth的环境变量名字
skywalking.auth_system_env_name=SKYWALKING_RUN
#skywalking数据编码
skywalking.charset=UTF-8
skywalking.auth_override=true
#是否打印数据
buriedpoint.printf=true
#埋点异常的最大长度
buriedpoint.max_exception_stack_length=4000
#业务字段的最大长度
buriedpoint.businesskey_max_length=300
#过滤异常
buriedpoint.exclusive_exceptions=java.lang.RuntimeException
#最大发送者的连接数阀比例
sender.connect_percent=100
#发送服务端配置
sender.servers_addr=127.0.0.1:34000
#最大发送的副本数量
sender.max_copy_num=2
#发送的最大长度
sender.max_send_length=20000
#当没有Sender时,尝试获取sender的等待周期
sender.retry_get_sender_wait_interval=2000
#最大消费线程数
consumer.max_consumer=0
#消费者最大等待时间
consumer.max_wait_time=5
#发送失败等待时间
consumer.consumer_fail_retry_wait_interval=50
#每个Buffer的最大个数
buffer.buffer_max_size=18000
#Buffer池的最大长度
buffer.pool_size=5
#发送检查线程检查周期
senderchecker.check_polling_time=200
skywalking-sniffer/skywalking-sdk-plugin/tomcat-7.x-8.x-plugin/src/test/resources/webapp/HelloWorld.jsp
已删除
100644 → 0
浏览文件 @
19e64e02
<html>
<body>
<h2>
Hello World
</h2>
</body>
</html>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录