Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
月轩居士
SkyWalking
提交
a254b2de
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,发现更多精彩内容 >>
提交
a254b2de
编写于
5月 14, 2017
作者:
X
Xin,Zhang
提交者:
wu-sheng
5月 14, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix issue that operation name of resin plugin is error (#196)
上级
1c4905ef
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
57 addition
and
15 deletion
+57
-15
apm-sniffer/apm-sdk-plugin/resin-3.x-plugin/src/main/java/org/skywalking/apm/plugin/resin/v3/ResinV3Interceptor.java
...rg/skywalking/apm/plugin/resin/v3/ResinV3Interceptor.java
+22
-4
apm-sniffer/apm-sdk-plugin/resin-3.x-plugin/src/test/java/org/skywalking/apm/plugin/resin/v3/ResinV3InterceptorTest.java
...kywalking/apm/plugin/resin/v3/ResinV3InterceptorTest.java
+6
-3
apm-sniffer/apm-sdk-plugin/resin-4.x-plugin/src/main/java/org/skywalking/apm/plugin/resin/v4/ResinV4Interceptor.java
...rg/skywalking/apm/plugin/resin/v4/ResinV4Interceptor.java
+22
-5
apm-sniffer/apm-sdk-plugin/resin-4.x-plugin/src/test/java/org/skywalking/apm/plugin/resin/v4/ResinV4InterceptorTest.java
...kywalking/apm/plugin/resin/v4/ResinV4InterceptorTest.java
+7
-3
未找到文件。
apm-sniffer/apm-sdk-plugin/resin-3.x-plugin/src/main/java/org/skywalking/apm/plugin/resin/v3/ResinV3Interceptor.java
浏览文件 @
a254b2de
package
org.skywalking.apm.plugin.resin.v3
;
import
com.caucho.server.
http.HttpResponse
;
import
com.caucho.server.
connection.CauchoRequest
;
import
com.caucho.server.http.HttpRequest
;
import
com.caucho.server.http.HttpResponse
;
import
org.skywalking.apm.agent.core.context.ContextCarrier
;
import
org.skywalking.apm.agent.core.context.ContextManager
;
import
org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext
;
...
...
@@ -33,13 +34,13 @@ public class ResinV3Interceptor implements InstanceMethodsAroundInterceptor {
public
void
beforeMethod
(
EnhancedClassInstanceContext
context
,
InstanceMethodInvokeContext
interceptorContext
,
MethodInterceptResult
result
)
{
Object
[]
args
=
interceptorContext
.
allArguments
();
HttpRequest
request
=
(
Http
Request
)
args
[
0
];
Span
span
=
ContextManager
.
createSpan
(
request
.
get
Request
URI
());
CauchoRequest
request
=
(
Caucho
Request
)
args
[
0
];
Span
span
=
ContextManager
.
createSpan
(
request
.
get
Page
URI
());
Tags
.
COMPONENT
.
set
(
span
,
RESIN_COMPONENT
);
Tags
.
PEER_HOST
.
set
(
span
,
request
.
getServerName
());
Tags
.
PEER_PORT
.
set
(
span
,
request
.
getServerPort
());
Tags
.
SPAN_KIND
.
set
(
span
,
Tags
.
SPAN_KIND_SERVER
);
Tags
.
URL
.
set
(
span
,
request
.
getRequestURL
().
toString
(
));
Tags
.
URL
.
set
(
span
,
appendRequestURL
(
request
));
Tags
.
SPAN_LAYER
.
asHttp
(
span
);
String
tracingHeaderValue
=
request
.
getHeader
(
HEADER_NAME_OF_CONTEXT_DATA
);
...
...
@@ -48,6 +49,23 @@ public class ResinV3Interceptor implements InstanceMethodsAroundInterceptor {
}
}
/**
* Append request URL.
*
* @param request
* @return
*/
private
String
appendRequestURL
(
CauchoRequest
request
)
{
StringBuffer
sb
=
new
StringBuffer
();
sb
.
append
(
request
.
getScheme
());
sb
.
append
(
"://"
);
sb
.
append
(
request
.
getServerName
());
sb
.
append
(
":"
);
sb
.
append
(
request
.
getServerPort
());
sb
.
append
(
request
.
getPageURI
());
return
sb
.
toString
();
}
@Override
public
Object
afterMethod
(
EnhancedClassInstanceContext
context
,
InstanceMethodInvokeContext
interceptorContext
,
Object
ret
)
{
...
...
apm-sniffer/apm-sdk-plugin/resin-3.x-plugin/src/test/java/org/skywalking/apm/plugin/resin/v3/ResinV3InterceptorTest.java
浏览文件 @
a254b2de
package
org.skywalking.apm.plugin.resin.v3
;
import
com.caucho.server.connection.CauchoRequest
;
import
com.caucho.server.http.HttpResponse
;
import
com.caucho.server.http.HttpRequest
;
import
org.hamcrest.CoreMatchers
;
import
org.junit.After
;
import
org.junit.Before
;
...
...
@@ -39,7 +39,7 @@ public class ResinV3InterceptorTest {
private
MockTracerContextListener
contextListener
;
@Mock
private
Http
Request
request
;
private
Caucho
Request
request
;
@Mock
private
HttpResponse
response
;
@Mock
...
...
@@ -59,7 +59,10 @@ public class ResinV3InterceptorTest {
TracerContext
.
ListenerManager
.
add
(
contextListener
);
when
(
request
.
getRequestURI
()).
thenReturn
(
"/test/testRequestURL"
);
when
(
request
.
getPageURI
()).
thenReturn
(
"/test/testRequestURL"
);
when
(
request
.
getScheme
()).
thenReturn
(
"http"
);
when
(
request
.
getServerName
()).
thenReturn
(
"localhost"
);
when
(
request
.
getServerPort
()).
thenReturn
(
8080
);
when
(
request
.
getRequestURL
()).
thenReturn
(
new
StringBuffer
(
"http://localhost:8080/test/testRequestURL"
));
when
(
response
.
getStatusCode
()).
thenReturn
(
200
);
when
(
methodInvokeContext
.
allArguments
()).
thenReturn
(
new
Object
[]
{
request
,
response
});
...
...
apm-sniffer/apm-sdk-plugin/resin-4.x-plugin/src/main/java/org/skywalking/apm/plugin/resin/v4/ResinV4Interceptor.java
浏览文件 @
a254b2de
package
org.skywalking.apm.plugin.resin.v4
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.caucho.server.http.CauchoRequest
;
import
com.caucho.server.http.HttpRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.skywalking.apm.agent.core.context.ContextCarrier
;
import
org.skywalking.apm.agent.core.context.ContextManager
;
import
org.skywalking.apm.agent.core.plugin.interceptor.EnhancedClassInstanceContext
;
...
...
@@ -31,13 +31,13 @@ public class ResinV4Interceptor implements InstanceMethodsAroundInterceptor {
public
void
beforeMethod
(
EnhancedClassInstanceContext
context
,
InstanceMethodInvokeContext
interceptorContext
,
MethodInterceptResult
result
)
{
Object
[]
args
=
interceptorContext
.
allArguments
();
HttpServletRequest
request
=
(
HttpServlet
Request
)
args
[
0
];
Span
span
=
ContextManager
.
createSpan
(
request
.
get
Request
URI
());
CauchoRequest
request
=
(
Caucho
Request
)
args
[
0
];
Span
span
=
ContextManager
.
createSpan
(
request
.
get
Page
URI
());
Tags
.
COMPONENT
.
set
(
span
,
RESIN_COMPONENT
);
Tags
.
PEER_HOST
.
set
(
span
,
request
.
getServerName
());
Tags
.
PEER_PORT
.
set
(
span
,
request
.
getServerPort
());
Tags
.
SPAN_KIND
.
set
(
span
,
Tags
.
SPAN_KIND_SERVER
);
Tags
.
URL
.
set
(
span
,
request
.
getRequestURL
().
toString
(
));
Tags
.
URL
.
set
(
span
,
appendRequestURL
(
request
));
Tags
.
SPAN_LAYER
.
asHttp
(
span
);
String
tracingHeaderValue
=
request
.
getHeader
(
HEADER_NAME_OF_CONTEXT_DATA
);
...
...
@@ -46,6 +46,23 @@ public class ResinV4Interceptor implements InstanceMethodsAroundInterceptor {
}
}
/**
* Append request URL.
*
* @param request
* @return
*/
private
String
appendRequestURL
(
CauchoRequest
request
)
{
StringBuffer
sb
=
new
StringBuffer
();
sb
.
append
(
request
.
getScheme
());
sb
.
append
(
"://"
);
sb
.
append
(
request
.
getServerName
());
sb
.
append
(
":"
);
sb
.
append
(
request
.
getServerPort
());
sb
.
append
(
request
.
getPageURI
());
return
sb
.
toString
();
}
@Override
public
Object
afterMethod
(
EnhancedClassInstanceContext
context
,
InstanceMethodInvokeContext
interceptorContext
,
Object
ret
)
{
...
...
apm-sniffer/apm-sdk-plugin/resin-4.x-plugin/src/test/java/org/skywalking/apm/plugin/resin/v4/ResinV4InterceptorTest.java
浏览文件 @
a254b2de
package
org.skywalking.apm.plugin.resin.v4
;
import
javax.servlet.http.HttpServletRequest
;
import
com.caucho.server.http.CauchoRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.hamcrest.CoreMatchers
;
import
org.junit.After
;
import
org.junit.Before
;
...
...
@@ -20,7 +21,6 @@ import org.skywalking.apm.trace.Span;
import
org.skywalking.apm.trace.TraceSegment
;
import
org.skywalking.apm.trace.TraceSegmentRef
;
import
org.skywalking.apm.trace.tag.Tags
;
import
javax.servlet.http.HttpServletResponse
;
import
static
org
.
hamcrest
.
CoreMatchers
.
is
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
...
...
@@ -37,7 +37,7 @@ public class ResinV4InterceptorTest {
private
MockTracerContextListener
contextListener
;
@Mock
private
HttpServlet
Request
request
;
private
Caucho
Request
request
;
@Mock
private
HttpServletResponse
response
;
@Mock
...
...
@@ -57,6 +57,10 @@ public class ResinV4InterceptorTest {
TracerContext
.
ListenerManager
.
add
(
contextListener
);
when
(
request
.
getPageURI
()).
thenReturn
(
"/test/testRequestURL"
);
when
(
request
.
getScheme
()).
thenReturn
(
"http"
);
when
(
request
.
getServerName
()).
thenReturn
(
"localhost"
);
when
(
request
.
getServerPort
()).
thenReturn
(
8080
);
when
(
request
.
getRequestURI
()).
thenReturn
(
"/test/testRequestURL"
);
when
(
request
.
getRequestURL
()).
thenReturn
(
new
StringBuffer
(
"http://localhost:8080/test/testRequestURL"
));
when
(
response
.
getStatus
()).
thenReturn
(
200
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录