Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
山不在高_有仙则灵
SkyWalking
提交
cbcb592c
S
SkyWalking
项目概览
山不在高_有仙则灵
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
12
Star
0
Fork
2
代码
文件
提交
分支
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,发现更多精彩内容 >>
未验证
提交
cbcb592c
编写于
1月 13, 2018
作者:
X
Xin,Zhang
提交者:
GitHub
1月 13, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #738 from YunaiV/master-5.0
Concurrency conflicts in Spring plugin #735
上级
10ef53e6
b5c48632
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
41 addition
and
35 deletion
+41
-35
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/EnhanceRequireObjectCache.java
.../plugin/spring/mvc/commons/EnhanceRequireObjectCache.java
+12
-9
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/AbstractMethodInterceptor.java
...ng/mvc/commons/interceptor/AbstractMethodInterceptor.java
+20
-15
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/InvokeHandlerMethodInterceptor.java
...c/commons/interceptor/InvokeHandlerMethodInterceptor.java
+3
-3
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/RequestMappingMethodInterceptor.java
.../commons/interceptor/RequestMappingMethodInterceptor.java
+3
-2
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/RestMappingMethodInterceptor.java
...mvc/commons/interceptor/RestMappingMethodInterceptor.java
+3
-6
未找到文件。
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/EnhanceRequireObjectCache.java
浏览文件 @
cbcb592c
...
...
@@ -18,25 +18,26 @@
package
org.apache.skywalking.apm.plugin.spring.mvc.commons
;
import
java.lang.reflect.Method
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.web.context.request.NativeWebRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.lang.reflect.Method
;
public
class
EnhanceRequireObjectCache
{
private
PathMappingCache
pathMappingCache
;
private
NativeWebRequest
nativeWebRequest
;
private
HttpServletResponse
httpResponse
;
private
ThreadLocal
<
NativeWebRequest
>
nativeWebRequest
=
new
ThreadLocal
<
NativeWebRequest
>()
;
private
ThreadLocal
<
HttpServletResponse
>
httpResponse
=
new
ThreadLocal
<
HttpServletResponse
>()
;
public
void
setPathMappingCache
(
PathMappingCache
pathMappingCache
)
{
this
.
pathMappingCache
=
pathMappingCache
;
}
public
HttpServletResponse
getHttpServletResponse
()
{
return
httpResponse
==
null
?
(
HttpServletResponse
)
nativeWebRequest
.
getNativeResponse
()
:
httpResponse
;
return
httpResponse
.
get
()
==
null
?
(
HttpServletResponse
)
nativeWebRequest
.
get
().
getNativeResponse
()
:
httpResponse
.
get
()
;
}
public
void
setNativeWebRequest
(
NativeWebRequest
nativeWebRequest
)
{
this
.
nativeWebRequest
=
nativeWebRequest
;
this
.
nativeWebRequest
.
set
(
nativeWebRequest
)
;
}
public
String
findPathMapping
(
Method
method
)
{
...
...
@@ -52,10 +53,12 @@ public class EnhanceRequireObjectCache {
}
public
void
setHttpResponse
(
HttpServletResponse
httpResponse
)
{
this
.
httpResponse
=
httpResponse
;
this
.
httpResponse
.
set
(
httpResponse
)
;
}
public
HttpServletResponse
getHttpResponse
()
{
return
httpResponse
;
public
void
clearRequestAndResponse
()
{
setNativeWebRequest
(
null
);
setHttpResponse
(
null
);
}
}
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/AbstractMethodInteceptor.java
→
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/AbstractMethodInte
r
ceptor.java
浏览文件 @
cbcb592c
...
...
@@ -19,27 +19,28 @@
package
org.apache.skywalking.apm.plugin.spring.mvc.commons.interceptor
;
import
java.lang.reflect.Method
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.skywalking.apm.agent.core.context.CarrierItem
;
import
org.apache.skywalking.apm.agent.core.context.ContextCarrier
;
import
org.apache.skywalking.apm.agent.core.context.ContextManager
;
import
org.apache.skywalking.apm.agent.core.context.tag.Tags
;
import
org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan
;
import
org.apache.skywalking.apm.agent.core.context.trace.SpanLayer
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.network.trace.component.ComponentsDefine
;
import
org.apache.skywalking.apm.plugin.spring.mvc.commons.EnhanceRequireObjectCache
;
import
org.apache.skywalking.apm.agent.core.context.CarrierItem
;
import
org.apache.skywalking.apm.agent.core.context.ContextManager
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.apache.skywalking.apm.network.trace.component.ComponentsDefine
;
import
org.apache.skywalking.apm.plugin.spring.mvc.commons.EnhanceRequireObjectCache
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.lang.reflect.Method
;
/**
* the abstract method inteceptor
*/
public
abstract
class
AbstractMethodInteceptor
implements
InstanceMethodsAroundInterceptor
{
public
abstract
class
AbstractMethodInte
r
ceptor
implements
InstanceMethodsAroundInterceptor
{
public
abstract
String
getRequestURL
(
Method
method
);
@Override
...
...
@@ -72,7 +73,8 @@ public abstract class AbstractMethodInteceptor implements InstanceMethodsAroundI
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
HttpServletResponse
response
=
((
EnhanceRequireObjectCache
)
objInst
.
getSkyWalkingDynamicField
()).
getHttpServletResponse
();
try
{
HttpServletResponse
response
=
((
EnhanceRequireObjectCache
)
objInst
.
getSkyWalkingDynamicField
()).
getHttpServletResponse
();
AbstractSpan
span
=
ContextManager
.
activeSpan
();
if
(
response
.
getStatus
()
>=
400
)
{
...
...
@@ -81,6 +83,9 @@ public abstract class AbstractMethodInteceptor implements InstanceMethodsAroundI
}
ContextManager
.
stopSpan
();
return
ret
;
}
finally
{
((
EnhanceRequireObjectCache
)
objInst
.
getSkyWalkingDynamicField
()).
clearRequestAndResponse
();
}
}
@Override
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/InvokeHandlerMethodInterceptor.java
浏览文件 @
cbcb592c
...
...
@@ -18,13 +18,14 @@
package
org.apache.skywalking.apm.plugin.spring.mvc.commons.interceptor
;
import
java.lang.reflect.Method
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.apache.skywalking.apm.plugin.spring.mvc.commons.EnhanceRequireObjectCache
;
import
javax.servlet.http.HttpServletResponse
;
import
java.lang.reflect.Method
;
public
class
InvokeHandlerMethodInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
...
...
@@ -42,6 +43,5 @@ public class InvokeHandlerMethodInterceptor implements InstanceMethodsAroundInte
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
}
}
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/RequestMappingMethodInterceptor.java
浏览文件 @
cbcb592c
...
...
@@ -19,16 +19,17 @@
package
org.apache.skywalking.apm.plugin.spring.mvc.commons.interceptor
;
import
java.lang.reflect.Method
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
java.lang.reflect.Method
;
/**
* The <code>RequestMappingMethodInterceptor</code> only use the first mapping value.
* it will inteceptor with <code>@RequestMapping</code>
*
* @author clevertension
*/
public
class
RequestMappingMethodInterceptor
extends
AbstractMethodInteceptor
{
public
class
RequestMappingMethodInterceptor
extends
AbstractMethodInte
r
ceptor
{
@Override
public
String
getRequestURL
(
Method
method
)
{
String
requestURL
=
""
;
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/RestMappingMethodInterceptor.java
浏览文件 @
cbcb592c
...
...
@@ -19,12 +19,9 @@
package
org.apache.skywalking.apm.plugin.spring.mvc.commons.interceptor
;
import
org.springframework.web.bind.annotation.*
;
import
java.lang.reflect.Method
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PatchMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
/**
* The <code>RestMappingMethodInterceptor</code> only use the first mapping value.
...
...
@@ -34,7 +31,7 @@ import org.springframework.web.bind.annotation.PutMapping;
*
* @author clevertension
*/
public
class
RestMappingMethodInterceptor
extends
AbstractMethodInteceptor
{
public
class
RestMappingMethodInterceptor
extends
AbstractMethodInte
r
ceptor
{
@Override
public
String
getRequestURL
(
Method
method
)
{
String
requestURL
=
""
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录