Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
山不在高_有仙则灵
SkyWalking
提交
b02a8734
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,发现更多精彩内容 >>
提交
b02a8734
编写于
12月 06, 2017
作者:
A
ascrutae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support spring mvc spring 4.0 framework
上级
362b8608
变更
34
隐藏空白更改
内联
并排
Showing
34 changed file
with
324 addition
and
340 deletion
+324
-340
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/pom.xml
...k-plugin/spring-plugins/mvc-annotation-3.x-plugin/pom.xml
+6
-0
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v3/ControllerConstructorInterceptor.java
...lugin/spring/mvc/v3/ControllerConstructorInterceptor.java
+2
-0
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v3/ControllerMethodInterceptor.java
...apm/plugin/spring/mvc/v3/ControllerMethodInterceptor.java
+0
-100
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v3/HandlerMethodInvokerInterceptor.java
...plugin/spring/mvc/v3/HandlerMethodInvokerInterceptor.java
+1
-0
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v3/define/ControllerInstrumentation.java
...lugin/spring/mvc/v3/define/ControllerInstrumentation.java
+1
-1
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v3/define/HandlerMethodInstrumentation.java
...in/spring/mvc/v3/define/HandlerMethodInstrumentation.java
+2
-2
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v3/define/InvocableHandlerInstrumentation.java
...spring/mvc/v3/define/InvocableHandlerInstrumentation.java
+2
-2
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v3/ControllerConstructorInterceptorTest.java
...n/spring/mvc/v3/ControllerConstructorInterceptorTest.java
+2
-0
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v3/ControllerMethodInterceptorTest.java
...plugin/spring/mvc/v3/ControllerMethodInterceptorTest.java
+0
-178
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v3/GetBeanInterceptorTest.java
...king/apm/plugin/spring/mvc/v3/GetBeanInterceptorTest.java
+2
-0
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v3/InvokeForRequestInterceptorTest.java
...plugin/spring/mvc/v3/InvokeForRequestInterceptorTest.java
+1
-0
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/pom.xml
...k-plugin/spring-plugins/mvc-annotation-4.x-plugin/pom.xml
+6
-0
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v4/ControllerConstructorInterceptor.java
...lugin/spring/mvc/v4/ControllerConstructorInterceptor.java
+5
-2
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v4/define/AbstractControllerInstrumentation.java
...ring/mvc/v4/define/AbstractControllerInstrumentation.java
+5
-12
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v4/define/AbstractSpring4Instrumentation.java
.../spring/mvc/v4/define/AbstractSpring4Instrumentation.java
+7
-22
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v4/define/HandlerMethodInstrumentation.java
...in/spring/mvc/v4/define/HandlerMethodInstrumentation.java
+73
-0
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v4/define/InvocableHandlerInstrumentation.java
...spring/mvc/v4/define/InvocableHandlerInstrumentation.java
+73
-0
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/main/resources/skywalking-plugin.def
...ation-4.x-plugin/src/main/resources/skywalking-plugin.def
+2
-0
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v4/ControllerConstructorInterceptorTest.java
...n/spring/mvc/v4/ControllerConstructorInterceptorTest.java
+4
-3
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v4/PathMappingCacheTest.java
...alking/apm/plugin/spring/mvc/v4/PathMappingCacheTest.java
+1
-0
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v4/RequestMappingMethodInterceptorTest.java
...in/spring/mvc/v4/RequestMappingMethodInterceptorTest.java
+12
-2
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v4/RestMappingMethodInterceptorTest.java
...lugin/spring/mvc/v4/RestMappingMethodInterceptorTest.java
+11
-2
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v4/define/ControllerInstrumentationTest.java
...n/spring/mvc/v4/define/ControllerInstrumentationTest.java
+2
-2
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v4/define/RestControllerInstrumentationTest.java
...ring/mvc/v4/define/RestControllerInstrumentationTest.java
+2
-2
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/pom.xml
...-sdk-plugin/spring-plugins/mvc-annotation-commons/pom.xml
+54
-0
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/skywalking/apm/plugin/spring/mvc/commons/Constants.java
...g/skywalking/apm/plugin/spring/mvc/commons/Constants.java
+34
-0
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/skywalking/apm/plugin/spring/mvc/commons/EnhanceRequireObjectCache.java
.../plugin/spring/mvc/commons/EnhanceRequireObjectCache.java
+1
-1
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/skywalking/apm/plugin/spring/mvc/commons/PathMappingCache.java
...lking/apm/plugin/spring/mvc/commons/PathMappingCache.java
+1
-1
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/skywalking/apm/plugin/spring/mvc/commons/interceptor/AbstractMethodInteceptor.java
...ing/mvc/commons/interceptor/AbstractMethodInteceptor.java
+4
-3
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/skywalking/apm/plugin/spring/mvc/commons/interceptor/GetBeanInterceptor.java
...in/spring/mvc/commons/interceptor/GetBeanInterceptor.java
+2
-1
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/skywalking/apm/plugin/spring/mvc/commons/interceptor/InvokeForRequestInterceptor.java
.../mvc/commons/interceptor/InvokeForRequestInterceptor.java
+3
-2
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/skywalking/apm/plugin/spring/mvc/commons/interceptor/RequestMappingMethodInterceptor.java
.../commons/interceptor/RequestMappingMethodInterceptor.java
+1
-1
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/skywalking/apm/plugin/spring/mvc/commons/interceptor/RestMappingMethodInterceptor.java
...mvc/commons/interceptor/RestMappingMethodInterceptor.java
+1
-1
apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml
apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml
+1
-0
未找到文件。
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/pom.xml
浏览文件 @
b02a8734
...
...
@@ -50,5 +50,11 @@
<version>
3.0.1
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.skywalking
</groupId>
<artifactId>
apm-springmvc-annotation-commons
</artifactId>
<version>
${project.version}
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
</project>
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v3/ControllerConstructorInterceptor.java
浏览文件 @
b02a8734
...
...
@@ -20,6 +20,8 @@ package org.skywalking.apm.plugin.spring.mvc.v3;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor
;
import
org.skywalking.apm.plugin.spring.mvc.commons.EnhanceRequireObjectCache
;
import
org.skywalking.apm.plugin.spring.mvc.commons.PathMappingCache
;
import
org.springframework.web.bind.annotation.RequestMapping
;
/**
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v3/ControllerMethodInterceptor.java
已删除
100644 → 0
浏览文件 @
362b8608
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.plugin.spring.mvc.v3
;
import
java.lang.reflect.Method
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.skywalking.apm.agent.core.context.CarrierItem
;
import
org.skywalking.apm.agent.core.context.ContextCarrier
;
import
org.skywalking.apm.agent.core.context.ContextManager
;
import
org.skywalking.apm.agent.core.context.tag.Tags
;
import
org.skywalking.apm.agent.core.context.trace.AbstractSpan
;
import
org.skywalking.apm.agent.core.context.trace.SpanLayer
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.skywalking.apm.network.trace.component.ComponentsDefine
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
/**
* {@link ControllerMethodInterceptor} create entry span when the client call the method annotation with {@link
* RequestMapping} in the class annotation with {@link org.springframework.stereotype.Controller}.
*
* @author zhangxin
*/
public
class
ControllerMethodInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
EnhanceRequireObjectCache
pathMappingCache
=
(
EnhanceRequireObjectCache
)
objInst
.
getSkyWalkingDynamicField
();
String
requestURL
=
pathMappingCache
.
findPathMapping
(
method
);
if
(
requestURL
==
null
)
{
requestURL
=
getRequestURL
(
method
);
pathMappingCache
.
addPathMapping
(
method
,
requestURL
);
requestURL
=
pathMappingCache
.
findPathMapping
(
method
);
}
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
ContextCarrier
contextCarrier
=
new
ContextCarrier
();
CarrierItem
next
=
contextCarrier
.
items
();
while
(
next
.
hasNext
())
{
next
=
next
.
next
();
next
.
setHeadValue
(
request
.
getHeader
(
next
.
getHeadKey
()));
}
AbstractSpan
span
=
ContextManager
.
createEntrySpan
(
requestURL
,
contextCarrier
);
Tags
.
URL
.
set
(
span
,
request
.
getRequestURL
().
toString
());
Tags
.
HTTP
.
METHOD
.
set
(
span
,
request
.
getMethod
());
span
.
setComponent
(
ComponentsDefine
.
SPRING_MVC_ANNOTATION
);
SpanLayer
.
asHttp
(
span
);
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
HttpServletResponse
response
=
((
EnhanceRequireObjectCache
)
objInst
.
getSkyWalkingDynamicField
()).
getHttpServletResponse
();
AbstractSpan
span
=
ContextManager
.
activeSpan
();
if
(
response
.
getStatus
()
>=
400
)
{
span
.
errorOccurred
();
Tags
.
STATUS_CODE
.
set
(
span
,
Integer
.
toString
(
response
.
getStatus
()));
}
ContextManager
.
stopSpan
();
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
ContextManager
.
activeSpan
().
errorOccurred
().
log
(
t
);
}
public
String
getRequestURL
(
Method
method
)
{
String
requestURL
=
""
;
RequestMapping
methodRequestMapping
=
method
.
getAnnotation
(
RequestMapping
.
class
);
if
(
methodRequestMapping
.
value
().
length
>
0
)
{
requestURL
=
methodRequestMapping
.
value
()[
0
];
}
return
requestURL
;
}
}
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v3/HandlerMethodInvokerInterceptor.java
浏览文件 @
b02a8734
...
...
@@ -22,6 +22,7 @@ import java.lang.reflect.Method;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.skywalking.apm.plugin.spring.mvc.commons.EnhanceRequireObjectCache
;
import
org.springframework.web.context.request.NativeWebRequest
;
/**
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v3/define/ControllerInstrumentation.java
浏览文件 @
b02a8734
...
...
@@ -28,6 +28,7 @@ import static net.bytebuddy.matcher.ElementMatchers.any;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
isAnnotatedWith
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
ClassAnnotationMatch
.
byClassAnnotationMatch
;
import
static
org
.
skywalking
.
apm
.
plugin
.
spring
.
mvc
.
commons
.
Constants
.
REQUEST_MAPPING_METHOD_INTERCEPTOR
;
/**
* {@link ControllerInstrumentation} intercept the constructor and the methods annotated with {@link
...
...
@@ -40,7 +41,6 @@ public class ControllerInstrumentation extends AbstractSpring3Instrumentation {
public
static
final
String
CONTROLLER_ENHANCE_ANNOTATION
=
"org.springframework.stereotype.Controller"
;
public
static
final
String
CONSTRUCTOR_INTERCEPTOR
=
"org.skywalking.apm.plugin.spring.mvc.v3.ControllerConstructorInterceptor"
;
public
static
final
String
REQUEST_MAPPING_ENHANCE_ANNOTATION
=
"org.springframework.web.bind.annotation.RequestMapping"
;
public
static
final
String
REQUEST_MAPPING_METHOD_INTERCEPTOR
=
"org.skywalking.apm.plugin.spring.mvc.v3.ControllerMethodInterceptor"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v3/define/HandlerMethodInstrumentation.java
浏览文件 @
b02a8734
...
...
@@ -26,6 +26,7 @@ import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
NameMatch
.
byName
;
import
static
org
.
skywalking
.
apm
.
plugin
.
spring
.
mvc
.
commons
.
Constants
.
GET_BEAN_INTERCEPTOR
;
/**
* {@link HandlerMethodInstrumentation} intercept the <code>getBean</code> method in the
...
...
@@ -36,7 +37,6 @@ import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
public
class
HandlerMethodInstrumentation
extends
AbstractSpring3Instrumentation
{
public
static
final
String
ENHANCE_METHOD
=
"getBean"
;
public
static
final
String
INTERCEPTOR_CLASS
=
"org.skywalking.apm.plugin.spring.mvc.v3.GetBeanInterceptor"
;
public
static
final
String
ENHANCE_CLASS
=
"org.springframework.web.method.HandlerMethod"
;
@Override
...
...
@@ -55,7 +55,7 @@ public class HandlerMethodInstrumentation extends AbstractSpring3Instrumentation
@Override
public
String
getMethodsInterceptor
()
{
return
INTERCEPTOR_CLASS
;
return
GET_BEAN_INTERCEPTOR
;
}
@Override
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v3/define/InvocableHandlerInstrumentation.java
浏览文件 @
b02a8734
...
...
@@ -26,6 +26,7 @@ import org.skywalking.apm.agent.core.plugin.match.ClassMatch;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
NameMatch
.
byName
;
import
static
org
.
skywalking
.
apm
.
plugin
.
spring
.
mvc
.
commons
.
Constants
.
INVOKE_FOR_REQUEST_INTERCEPTOR
;
/**
* {@link InvocableHandlerInstrumentation} intercept the <code>invokeForRequest</code> method in the
...
...
@@ -36,7 +37,6 @@ import static org.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
public
class
InvocableHandlerInstrumentation
extends
AbstractSpring3Instrumentation
{
public
static
final
String
ENHANCE_METHOD
=
"invokeForRequest"
;
public
static
final
String
INTERCEPTOR_CLASS
=
"org.skywalking.apm.plugin.spring.mvc.v3.InvokeForRequestInterceptor"
;
public
static
final
String
ENHANCE_CLASS
=
"org.springframework.web.method.support.InvocableHandlerMethod"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
...
...
@@ -53,7 +53,7 @@ public class InvocableHandlerInstrumentation extends AbstractSpring3Instrumentat
@Override
public
String
getMethodsInterceptor
()
{
return
IN
TERCEPTOR_CLASS
;
return
IN
VOKE_FOR_REQUEST_INTERCEPTOR
;
}
@Override
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v3/ControllerConstructorInterceptorTest.java
浏览文件 @
b02a8734
...
...
@@ -24,6 +24,8 @@ import org.junit.Test;
import
org.junit.runner.RunWith
;
import
org.powermock.modules.junit4.PowerMockRunner
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.skywalking.apm.plugin.spring.mvc.commons.EnhanceRequireObjectCache
;
import
org.skywalking.apm.plugin.spring.mvc.commons.PathMappingCache
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v3/ControllerMethodInterceptorTest.java
已删除
100644 → 0
浏览文件 @
362b8608
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.plugin.spring.mvc.v3
;
import
java.lang.reflect.Method
;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.junit.Before
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.Mock
;
import
org.mockito.Mockito
;
import
org.powermock.core.classloader.annotations.PrepareForTest
;
import
org.powermock.modules.junit4.PowerMockRunner
;
import
org.powermock.modules.junit4.PowerMockRunnerDelegate
;
import
org.skywalking.apm.agent.core.context.SW3CarrierItem
;
import
org.skywalking.apm.agent.core.context.trace.AbstractTracingSpan
;
import
org.skywalking.apm.agent.core.context.trace.LogDataEntity
;
import
org.skywalking.apm.agent.core.context.trace.SpanLayer
;
import
org.skywalking.apm.agent.core.context.trace.TraceSegment
;
import
org.skywalking.apm.agent.core.context.trace.TraceSegmentRef
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.skywalking.apm.agent.test.helper.SegmentHelper
;
import
org.skywalking.apm.agent.test.helper.SegmentRefHelper
;
import
org.skywalking.apm.agent.test.helper.SpanHelper
;
import
org.skywalking.apm.agent.test.tools.AgentServiceRule
;
import
org.skywalking.apm.agent.test.tools.SegmentStorage
;
import
org.skywalking.apm.agent.test.tools.SegmentStoragePoint
;
import
org.skywalking.apm.agent.test.tools.TracingSegmentRunner
;
import
org.skywalking.apm.network.trace.component.ComponentsDefine
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.context.request.NativeWebRequest
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
static
org
.
hamcrest
.
CoreMatchers
.
is
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
import
static
org
.
powermock
.
api
.
mockito
.
PowerMockito
.
mockStatic
;
import
static
org
.
powermock
.
api
.
mockito
.
PowerMockito
.
when
;
import
static
org
.
skywalking
.
apm
.
agent
.
test
.
tools
.
SpanAssert
.
assertComponent
;
import
static
org
.
skywalking
.
apm
.
agent
.
test
.
tools
.
SpanAssert
.
assertException
;
import
static
org
.
skywalking
.
apm
.
agent
.
test
.
tools
.
SpanAssert
.
assertLayer
;
import
static
org
.
skywalking
.
apm
.
agent
.
test
.
tools
.
SpanAssert
.
assertTag
;
@RunWith
(
PowerMockRunner
.
class
)
@PowerMockRunnerDelegate
(
TracingSegmentRunner
.
class
)
@PrepareForTest
({
RequestContextHolder
.
class
,
ServletRequestAttributes
.
class
})
public
class
ControllerMethodInterceptorTest
{
@SegmentStoragePoint
private
SegmentStorage
segmentStorage
;
@Rule
public
AgentServiceRule
serviceRule
=
new
AgentServiceRule
();
@Mock
private
EnhancedInstance
enhancedInstance
;
@Mock
private
NativeWebRequest
nativeWebRequest
;
@Mock
private
HttpServletResponse
httpServletResponse
;
@Mock
private
ServletRequestAttributes
servletRequestAttributes
;
@Mock
private
HttpServletRequest
httpServletRequest
;
private
Method
method
;
private
EnhanceRequireObjectCache
enhanceRequireObjectCache
;
private
ControllerMethodInterceptor
controllerMethodInterceptor
;
@Before
public
void
setUp
()
throws
NoSuchMethodException
{
controllerMethodInterceptor
=
new
ControllerMethodInterceptor
();
enhanceRequireObjectCache
=
new
EnhanceRequireObjectCache
();
enhanceRequireObjectCache
.
setPathMappingCache
(
new
PathMappingCache
(
"/test"
));
method
=
ControllerMethodInterceptorTest
.
class
.
getDeclaredMethod
(
"mockControllerService"
);
enhanceRequireObjectCache
.
addPathMapping
(
method
,
"/test"
);
enhanceRequireObjectCache
.
setNativeWebRequest
(
nativeWebRequest
);
enhanceRequireObjectCache
.
setPathMappingCache
(
new
PathMappingCache
(
"/test"
));
mockStatic
(
RequestContextHolder
.
class
);
when
(
servletRequestAttributes
.
getRequest
()).
thenReturn
(
httpServletRequest
);
when
(
nativeWebRequest
.
getNativeResponse
()).
thenReturn
(
httpServletResponse
);
when
(
enhancedInstance
.
getSkyWalkingDynamicField
()).
thenReturn
(
enhanceRequireObjectCache
);
when
(
RequestContextHolder
.
getRequestAttributes
()).
thenReturn
(
servletRequestAttributes
);
when
(
httpServletRequest
.
getMethod
()).
thenReturn
(
"GET"
);
when
(
httpServletRequest
.
getRequestURL
()).
thenReturn
(
new
StringBuffer
(
"http://localhost:8080/skywalking-test/test"
));
}
@Test
public
void
testWithoutSerializedContextData
()
throws
Throwable
{
controllerMethodInterceptor
.
beforeMethod
(
enhancedInstance
,
method
,
null
,
null
,
null
);
controllerMethodInterceptor
.
afterMethod
(
enhancedInstance
,
method
,
null
,
null
,
null
);
assertThat
(
segmentStorage
.
getTraceSegments
().
size
(),
is
(
1
));
TraceSegment
traceSegment
=
segmentStorage
.
getTraceSegments
().
get
(
0
);
List
<
AbstractTracingSpan
>
spans
=
SegmentHelper
.
getSpans
(
traceSegment
);
assertThat
(
spans
.
size
(),
is
(
1
));
assertRequestSpan
(
spans
.
get
(
0
));
}
@Test
public
void
testWithSerializedContextData
()
throws
Throwable
{
Mockito
.
when
(
httpServletRequest
.
getHeader
(
SW3CarrierItem
.
HEADER_NAME
)).
thenReturn
(
"1.234.111|3|1|1|#192.168.1.8:18002|#/portal/|#/testEntrySpan|#AQA*#AQA*Et0We0tQNQA*"
);
controllerMethodInterceptor
.
beforeMethod
(
enhancedInstance
,
method
,
null
,
null
,
null
);
controllerMethodInterceptor
.
afterMethod
(
enhancedInstance
,
method
,
null
,
null
,
null
);
assertThat
(
segmentStorage
.
getTraceSegments
().
size
(),
is
(
1
));
TraceSegment
traceSegment
=
segmentStorage
.
getTraceSegments
().
get
(
0
);
List
<
AbstractTracingSpan
>
spans
=
SegmentHelper
.
getSpans
(
traceSegment
);
assertThat
(
spans
.
size
(),
is
(
1
));
assertRequestSpan
(
spans
.
get
(
0
));
List
<
TraceSegmentRef
>
traceSegmentRefs
=
traceSegment
.
getRefs
();
assertThat
(
traceSegmentRefs
.
size
(),
is
(
1
));
assertTraceSegmentRef
(
traceSegmentRefs
.
get
(
0
));
}
@Test
public
void
testOccurException
()
throws
Throwable
{
controllerMethodInterceptor
.
beforeMethod
(
enhancedInstance
,
method
,
null
,
null
,
null
);
controllerMethodInterceptor
.
handleMethodException
(
enhancedInstance
,
method
,
null
,
null
,
new
RuntimeException
());
controllerMethodInterceptor
.
afterMethod
(
enhancedInstance
,
method
,
null
,
null
,
null
);
assertThat
(
segmentStorage
.
getTraceSegments
().
size
(),
is
(
1
));
TraceSegment
traceSegment
=
segmentStorage
.
getTraceSegments
().
get
(
0
);
List
<
AbstractTracingSpan
>
spans
=
SegmentHelper
.
getSpans
(
traceSegment
);
assertThat
(
spans
.
size
(),
is
(
1
));
assertRequestSpan
(
spans
.
get
(
0
));
List
<
LogDataEntity
>
logDataEntities
=
SpanHelper
.
getLogs
(
spans
.
get
(
0
));
assertThat
(
logDataEntities
.
size
(),
is
(
1
));
assertException
(
logDataEntities
.
get
(
0
),
RuntimeException
.
class
);
}
private
void
assertTraceSegmentRef
(
TraceSegmentRef
ref
)
{
assertThat
(
SegmentRefHelper
.
getEntryApplicationInstanceId
(
ref
),
is
(
1
));
assertThat
(
SegmentRefHelper
.
getSpanId
(
ref
),
is
(
3
));
assertThat
(
SegmentRefHelper
.
getTraceSegmentId
(
ref
).
toString
(),
is
(
"1.234.111"
));
}
private
void
assertRequestSpan
(
AbstractTracingSpan
span
)
{
assertThat
(
span
.
getOperationName
(),
is
(
"/test/test"
));
assertComponent
(
span
,
ComponentsDefine
.
SPRING_MVC_ANNOTATION
);
assertTag
(
span
,
0
,
"http://localhost:8080/skywalking-test/test"
);
assertThat
(
span
.
isEntry
(),
is
(
true
));
assertLayer
(
span
,
SpanLayer
.
HTTP
);
}
@RequestMapping
(
"/test"
)
public
void
mockControllerService
()
{
}
}
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v3/GetBeanInterceptorTest.java
浏览文件 @
b02a8734
...
...
@@ -25,6 +25,8 @@ import org.mockito.Matchers;
import
org.mockito.Mock
;
import
org.mockito.runners.MockitoJUnitRunner
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.skywalking.apm.plugin.spring.mvc.commons.EnhanceRequireObjectCache
;
import
org.skywalking.apm.plugin.spring.mvc.commons.interceptor.GetBeanInterceptor
;
import
org.springframework.web.context.request.NativeWebRequest
;
import
static
org
.
mockito
.
Mockito
.
times
;
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-3.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v3/InvokeForRequestInterceptorTest.java
浏览文件 @
b02a8734
...
...
@@ -25,6 +25,7 @@ import org.mockito.Matchers;
import
org.mockito.Mock
;
import
org.mockito.runners.MockitoJUnitRunner
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.skywalking.apm.plugin.spring.mvc.commons.interceptor.InvokeForRequestInterceptor
;
import
org.springframework.web.context.request.NativeWebRequest
;
import
static
org
.
mockito
.
Mockito
.
times
;
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/pom.xml
浏览文件 @
b02a8734
...
...
@@ -50,5 +50,11 @@
<version>
3.0.1
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.skywalking
</groupId>
<artifactId>
apm-springmvc-annotation-commons
</artifactId>
<version>
${project.version}
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
</project>
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v4/ControllerConstructorInterceptor.java
浏览文件 @
b02a8734
...
...
@@ -20,6 +20,8 @@ package org.skywalking.apm.plugin.spring.mvc.v4;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor
;
import
org.skywalking.apm.plugin.spring.mvc.commons.EnhanceRequireObjectCache
;
import
org.skywalking.apm.plugin.spring.mvc.commons.PathMappingCache
;
import
org.springframework.web.bind.annotation.RequestMapping
;
/**
...
...
@@ -48,7 +50,8 @@ public class ControllerConstructorInterceptor implements InstanceConstructorInte
basePath
=
basePathRequestMapping
.
path
()[
0
];
}
}
PathMappingCache
pathMappingCache
=
new
PathMappingCache
(
basePath
);
objInst
.
setSkyWalkingDynamicField
(
pathMappingCache
);
EnhanceRequireObjectCache
enhanceRequireObjectCache
=
new
EnhanceRequireObjectCache
();
enhanceRequireObjectCache
.
setPathMappingCache
(
new
PathMappingCache
(
basePath
));
objInst
.
setSkyWalkingDynamicField
(
enhanceRequireObjectCache
);
}
}
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v4/define/AbstractControllerInstrumentation.java
浏览文件 @
b02a8734
...
...
@@ -22,13 +22,14 @@ import net.bytebuddy.description.method.MethodDescription;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
any
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
isAnnotatedWith
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
ClassAnnotationMatch
.
byClassAnnotationMatch
;
import
static
org
.
skywalking
.
apm
.
plugin
.
spring
.
mvc
.
commons
.
Constants
.
REQUEST_MAPPING_METHOD_INTERCEPTOR
;
import
static
org
.
skywalking
.
apm
.
plugin
.
spring
.
mvc
.
commons
.
Constants
.
REST_MAPPING_METHOD_INTERCEPTOR
;
/**
* {@link ControllerInstrumentation} enhance all constructor and method annotated with
...
...
@@ -45,7 +46,7 @@ import static org.skywalking.apm.agent.core.plugin.match.ClassAnnotationMatch.by
*
* @author zhangxin
*/
public
abstract
class
AbstractControllerInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
abstract
class
AbstractControllerInstrumentation
extends
AbstractSpring4Instrumentation
{
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[]
{
...
...
@@ -74,7 +75,7 @@ public abstract class AbstractControllerInstrumentation extends ClassInstanceMet
@Override
public
String
getMethodsInterceptor
()
{
return
"org.skywalking.apm.plugin.spring.mvc.v4.RequestMappingMethodInterceptor"
;
return
REQUEST_MAPPING_METHOD_INTERCEPTOR
;
}
@Override
...
...
@@ -94,7 +95,7 @@ public abstract class AbstractControllerInstrumentation extends ClassInstanceMet
@Override
public
String
getMethodsInterceptor
()
{
return
"org.skywalking.apm.plugin.spring.mvc.v4.RestMappingMethodInterceptor"
;
return
REST_MAPPING_METHOD_INTERCEPTOR
;
}
@Override
...
...
@@ -112,12 +113,4 @@ public abstract class AbstractControllerInstrumentation extends ClassInstanceMet
protected
abstract
String
[]
getEnhanceAnnotations
();
@Override
protected
String
[]
witnessClasses
()
{
/**
* @see {@link org.springframework.web.servlet.tags.ArgumentTag}
*/
return
new
String
[]{
"org.springframework.web.servlet.tags.ArgumentTag"
};
}
}
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v4/
PathMappingCache
.java
→
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v4/
define/AbstractSpring4Instrumentation
.java
浏览文件 @
b02a8734
...
...
@@ -16,30 +16,15 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.plugin.spring.mvc.v4
;
package
org.skywalking.apm.plugin.spring.mvc.v4
.define
;
import
java.lang.reflect.Method
;
import
java.util.concurrent.ConcurrentHashMap
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
/**
* The <code>PathMappingCache</code> represents a field
*
* @author wusheng
*/
public
class
PathMappingCache
{
private
String
classPath
=
""
;
private
ConcurrentHashMap
<
Method
,
String
>
methodPathMapping
=
new
ConcurrentHashMap
<
Method
,
String
>();
public
PathMappingCache
(
String
classPath
)
{
this
.
classPath
=
classPath
;
}
public
String
findPathMapping
(
Method
method
)
{
return
methodPathMapping
.
get
(
method
);
}
public
abstract
class
AbstractSpring4Instrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
static
final
String
WITHNESS_CLASSES
=
"org.springframework.web.servlet.tags.ArgumentTag"
;
public
void
addPathMapping
(
Method
method
,
String
methodPath
)
{
methodPathMapping
.
put
(
method
,
classPath
+
methodPath
);
@Override
protected
final
String
[]
witnessClasses
()
{
return
new
String
[]
{
WITHNESS_CLASSES
};
}
}
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v4/define/HandlerMethodInstrumentation.java
0 → 100644
浏览文件 @
b02a8734
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.plugin.spring.mvc.v4.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
NameMatch
.
byName
;
import
static
org
.
skywalking
.
apm
.
plugin
.
spring
.
mvc
.
commons
.
Constants
.
GET_BEAN_INTERCEPTOR
;
/**
* {@link HandlerMethodInstrumentation} intercept the <code>getBean</code> method in the
* <code>org.springframework.web.method.HandlerMethod</code> class.
*
* @author zhangxin
*/
public
class
HandlerMethodInstrumentation
extends
AbstractSpring4Instrumentation
{
public
static
final
String
ENHANCE_METHOD
=
"getBean"
;
public
static
final
String
ENHANCE_CLASS
=
"org.springframework.web.method.HandlerMethod"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
protected
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
ENHANCE_METHOD
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
GET_BEAN_INTERCEPTOR
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
byName
(
ENHANCE_CLASS
);
}
}
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v4/define/InvocableHandlerInstrumentation.java
0 → 100644
浏览文件 @
b02a8734
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.plugin.spring.mvc.v4.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
org
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
NameMatch
.
byName
;
import
static
org
.
skywalking
.
apm
.
plugin
.
spring
.
mvc
.
commons
.
Constants
.
INVOKE_FOR_REQUEST_INTERCEPTOR
;
/**
* {@link InvocableHandlerInstrumentation} intercept the <code>invokeForRequest</code> method in the
* <code>org.springframework.web.method.support.InvocableHandlerMethod</code> class.
*
* @author zhangxin
*/
public
class
InvocableHandlerInstrumentation
extends
AbstractSpring4Instrumentation
{
public
static
final
String
ENHANCE_METHOD
=
"invokeForRequest"
;
public
static
final
String
ENHANCE_CLASS
=
"org.springframework.web.method.support.InvocableHandlerMethod"
;
@Override
protected
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
protected
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
ENHANCE_METHOD
);
}
@Override
public
String
getMethodsInterceptor
()
{
return
INVOKE_FOR_REQUEST_INTERCEPTOR
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
byName
(
ENHANCE_CLASS
);
}
}
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/main/resources/skywalking-plugin.def
浏览文件 @
b02a8734
spring-mvc-annotation-4.x=org.skywalking.apm.plugin.spring.mvc.v4.define.ControllerInstrumentation
spring-mvc-annotation-4.x=org.skywalking.apm.plugin.spring.mvc.v4.define.RestControllerInstrumentation
spring-mvc-annotation-4.x=org.skywalking.apm.plugin.spring.mvc.v4.define.HandlerMethodInstrumentation
spring-mvc-annotation-4.x=org.skywalking.apm.plugin.spring.mvc.v4.define.InvocableHandlerInstrumentation
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v4/ControllerConstructorInterceptorTest.java
浏览文件 @
b02a8734
...
...
@@ -27,6 +27,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
import
org.powermock.modules.junit4.PowerMockRunnerDelegate
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.skywalking.apm.agent.test.tools.TracingSegmentRunner
;
import
org.skywalking.apm.plugin.spring.mvc.commons.EnhanceRequireObjectCache
;
import
org.springframework.web.bind.annotation.RequestMapping
;
@RunWith
(
PowerMockRunner
.
class
)
...
...
@@ -45,7 +46,7 @@ public class ControllerConstructorInterceptorTest {
@Test
public
void
testOnConstruct_Accuracy1
()
throws
Throwable
{
controllerConstructorInterceptor
.
onConstruct
(
inst1
,
null
);
PathMappingCache
cache
=
(
PathMapping
Cache
)
inst1
.
getSkyWalkingDynamicField
();
EnhanceRequireObjectCache
cache
=
(
EnhanceRequireObject
Cache
)
inst1
.
getSkyWalkingDynamicField
();
Assert
.
assertNotNull
(
cache
);
Object
obj
=
new
Object
();
...
...
@@ -58,7 +59,7 @@ public class ControllerConstructorInterceptorTest {
@Test
public
void
testOnConstruct_Accuracy2
()
throws
Throwable
{
controllerConstructorInterceptor
.
onConstruct
(
inst2
,
null
);
PathMappingCache
cache
=
(
PathMapping
Cache
)
inst2
.
getSkyWalkingDynamicField
();
EnhanceRequireObjectCache
cache
=
(
EnhanceRequireObject
Cache
)
inst2
.
getSkyWalkingDynamicField
();
Assert
.
assertNotNull
(
cache
);
Object
obj
=
new
Object
();
...
...
@@ -71,7 +72,7 @@ public class ControllerConstructorInterceptorTest {
@Test
public
void
testOnConstruct_Accuracy3
()
throws
Throwable
{
controllerConstructorInterceptor
.
onConstruct
(
inst3
,
null
);
PathMappingCache
cache
=
(
PathMapping
Cache
)
inst3
.
getSkyWalkingDynamicField
();
EnhanceRequireObjectCache
cache
=
(
EnhanceRequireObject
Cache
)
inst3
.
getSkyWalkingDynamicField
();
Assert
.
assertNotNull
(
cache
);
Object
obj
=
new
Object
();
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v4/PathMappingCacheTest.java
浏览文件 @
b02a8734
...
...
@@ -26,6 +26,7 @@ import org.junit.runner.RunWith;
import
org.powermock.modules.junit4.PowerMockRunner
;
import
org.powermock.modules.junit4.PowerMockRunnerDelegate
;
import
org.skywalking.apm.agent.test.tools.TracingSegmentRunner
;
import
org.skywalking.apm.plugin.spring.mvc.commons.PathMappingCache
;
@RunWith
(
PowerMockRunner
.
class
)
@PowerMockRunnerDelegate
(
TracingSegmentRunner
.
class
)
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v4/RequestMappingMethodInterceptorTest.java
浏览文件 @
b02a8734
...
...
@@ -44,7 +44,11 @@ import org.skywalking.apm.agent.test.tools.SegmentStorage;
import
org.skywalking.apm.agent.test.tools.SegmentStoragePoint
;
import
org.skywalking.apm.agent.test.tools.TracingSegmentRunner
;
import
org.skywalking.apm.network.trace.component.ComponentsDefine
;
import
org.skywalking.apm.plugin.spring.mvc.commons.EnhanceRequireObjectCache
;
import
org.skywalking.apm.plugin.spring.mvc.commons.PathMappingCache
;
import
org.skywalking.apm.plugin.spring.mvc.commons.interceptor.RequestMappingMethodInterceptor
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.context.request.NativeWebRequest
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
...
...
@@ -84,6 +88,9 @@ public class RequestMappingMethodInterceptorTest {
private
ControllerConstructorInterceptor
controllerConstructorInterceptor
;
@Mock
private
NativeWebRequest
nativeWebRequest
;
@Before
public
void
setUp
()
throws
Exception
{
interceptor
=
new
RequestMappingMethodInterceptor
();
...
...
@@ -97,6 +104,7 @@ public class RequestMappingMethodInterceptorTest {
when
(
request
.
getRequestURI
()).
thenReturn
(
"/test/testRequestURL"
);
when
(
request
.
getRequestURL
()).
thenReturn
(
new
StringBuffer
(
"http://localhost:8080/test/testRequestURL"
));
when
(
response
.
getStatus
()).
thenReturn
(
200
);
when
(
nativeWebRequest
.
getNativeResponse
()).
thenReturn
(
response
);
arguments
=
new
Object
[]
{
request
,
response
};
argumentType
=
new
Class
[]
{
request
.
getClass
(),
response
.
getClass
()};
...
...
@@ -157,16 +165,18 @@ public class RequestMappingMethodInterceptorTest {
@RequestMapping
(
value
=
"/test"
)
private
class
MockEnhancedInstance1
implements
EnhancedInstance
{
private
Object
value
;
private
EnhanceRequireObjectCache
value
=
new
EnhanceRequireObjectCache
()
;
@Override
public
Object
getSkyWalkingDynamicField
()
{
value
.
setPathMappingCache
(
new
PathMappingCache
(
"/test"
));
value
.
setNativeWebRequest
(
nativeWebRequest
);
return
value
;
}
@Override
public
void
setSkyWalkingDynamicField
(
Object
value
)
{
this
.
value
=
value
;
}
}
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v4/RestMappingMethodInterceptorTest.java
浏览文件 @
b02a8734
...
...
@@ -44,12 +44,16 @@ import org.skywalking.apm.agent.test.tools.SegmentStorage;
import
org.skywalking.apm.agent.test.tools.SegmentStoragePoint
;
import
org.skywalking.apm.agent.test.tools.TracingSegmentRunner
;
import
org.skywalking.apm.network.trace.component.ComponentsDefine
;
import
org.skywalking.apm.plugin.spring.mvc.commons.EnhanceRequireObjectCache
;
import
org.skywalking.apm.plugin.spring.mvc.commons.PathMappingCache
;
import
org.skywalking.apm.plugin.spring.mvc.commons.interceptor.RestMappingMethodInterceptor
;
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
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.context.request.NativeWebRequest
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
...
...
@@ -80,6 +84,9 @@ public class RestMappingMethodInterceptorTest {
@Mock
private
MethodInterceptResult
methodInterceptResult
;
@Mock
private
NativeWebRequest
nativeWebRequest
;
private
Object
[]
arguments
;
private
Class
[]
argumentType
;
...
...
@@ -97,6 +104,7 @@ public class RestMappingMethodInterceptorTest {
when
(
request
.
getServerName
()).
thenReturn
(
"localhost"
);
when
(
request
.
getServerPort
()).
thenReturn
(
8080
);
when
(
response
.
getStatus
()).
thenReturn
(
200
);
when
(
nativeWebRequest
.
getNativeResponse
()).
thenReturn
(
response
);
arguments
=
new
Object
[]
{
request
,
response
};
argumentType
=
new
Class
[]
{
request
.
getClass
(),
response
.
getClass
()};
...
...
@@ -263,16 +271,17 @@ public class RestMappingMethodInterceptorTest {
@RequestMapping
(
value
=
"/test"
)
private
class
MockEnhancedInstance1
implements
EnhancedInstance
{
private
Object
value
;
private
EnhanceRequireObjectCache
value
=
new
EnhanceRequireObjectCache
()
;
@Override
public
Object
getSkyWalkingDynamicField
()
{
value
.
setPathMappingCache
(
new
PathMappingCache
(
"/test"
));
value
.
setNativeWebRequest
(
nativeWebRequest
);
return
value
;
}
@Override
public
void
setSkyWalkingDynamicField
(
Object
value
)
{
this
.
value
=
value
;
}
}
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v4/define/ControllerInstrumentationTest.java
浏览文件 @
b02a8734
...
...
@@ -52,8 +52,8 @@ public class ControllerInstrumentationTest {
public
void
testGetInstanceMethodsInterceptPoints
()
throws
Throwable
{
InstanceMethodsInterceptPoint
[]
methodPoints
=
controllerInstrumentation
.
getInstanceMethodsInterceptPoints
();
assertThat
(
methodPoints
.
length
,
is
(
2
));
assertThat
(
methodPoints
[
0
].
getMethodsInterceptor
(),
is
(
"org.skywalking.apm.plugin.spring.mvc.
v4
.RequestMappingMethodInterceptor"
));
assertThat
(
methodPoints
[
1
].
getMethodsInterceptor
(),
is
(
"org.skywalking.apm.plugin.spring.mvc.
v4
.RestMappingMethodInterceptor"
));
assertThat
(
methodPoints
[
0
].
getMethodsInterceptor
(),
is
(
"org.skywalking.apm.plugin.spring.mvc.
commons.interceptor
.RequestMappingMethodInterceptor"
));
assertThat
(
methodPoints
[
1
].
getMethodsInterceptor
(),
is
(
"org.skywalking.apm.plugin.spring.mvc.
commons.interceptor
.RestMappingMethodInterceptor"
));
Assert
.
assertFalse
(
methodPoints
[
0
].
isOverrideArgs
());
Assert
.
assertFalse
(
methodPoints
[
1
].
isOverrideArgs
());
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/test/java/org/skywalking/apm/plugin/spring/mvc/v4/define/RestControllerInstrumentationTest.java
浏览文件 @
b02a8734
...
...
@@ -50,8 +50,8 @@ public class RestControllerInstrumentationTest {
public
void
testGetInstanceMethodsInterceptPoints
()
throws
Throwable
{
InstanceMethodsInterceptPoint
[]
methodPoints
=
restControllerInstrumentation
.
getInstanceMethodsInterceptPoints
();
assertThat
(
methodPoints
.
length
,
is
(
2
));
assertThat
(
methodPoints
[
0
].
getMethodsInterceptor
(),
is
(
"org.skywalking.apm.plugin.spring.mvc.
v4
.RequestMappingMethodInterceptor"
));
assertThat
(
methodPoints
[
1
].
getMethodsInterceptor
(),
is
(
"org.skywalking.apm.plugin.spring.mvc.
v4
.RestMappingMethodInterceptor"
));
assertThat
(
methodPoints
[
0
].
getMethodsInterceptor
(),
is
(
"org.skywalking.apm.plugin.spring.mvc.
commons.interceptor
.RequestMappingMethodInterceptor"
));
assertThat
(
methodPoints
[
1
].
getMethodsInterceptor
(),
is
(
"org.skywalking.apm.plugin.spring.mvc.
commons.interceptor
.RestMappingMethodInterceptor"
));
Assert
.
assertFalse
(
methodPoints
[
0
].
isOverrideArgs
());
Assert
.
assertFalse
(
methodPoints
[
1
].
isOverrideArgs
());
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/pom.xml
0 → 100644
浏览文件 @
b02a8734
<!--
~ Copyright 2017, OpenSkywalking Organization All rights reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
~ Project repository: https://github.com/OpenSkywalking/skywalking
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
spring-plugins
</artifactId>
<groupId>
org.skywalking
</groupId>
<version>
3.2.6-2017
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apm-springmvc-annotation-commons
</artifactId>
<packaging>
jar
</packaging>
<name>
mvc-annotation-commons
</name>
<url>
http://maven.apache.org
</url>
<dependencies>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-core
</artifactId>
<version>
4.3.10.RELEASE
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-webmvc
</artifactId>
<version>
4.3.8.RELEASE
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
<version>
3.0.1
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
</project>
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/skywalking/apm/plugin/spring/mvc/commons/Constants.java
0 → 100644
浏览文件 @
b02a8734
/*
* Copyright 2017, OpenSkywalking Organization All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.plugin.spring.mvc.commons
;
/**
* Interceptor class name constant variables
*
* @author zhangxin
*/
public
class
Constants
{
public
static
final
String
GET_BEAN_INTERCEPTOR
=
"org.skywalking.apm.plugin.spring.mvc.commons.interceptor.GetBeanInterceptor"
;
public
static
final
String
INVOKE_FOR_REQUEST_INTERCEPTOR
=
"org.skywalking.apm.plugin.spring.mvc.commons.interceptor.InvokeForRequestInterceptor"
;
public
static
final
String
REQUEST_MAPPING_METHOD_INTERCEPTOR
=
"org.skywalking.apm.plugin.spring.mvc.commons.interceptor.RequestMappingMethodInterceptor"
;
public
static
final
String
REST_MAPPING_METHOD_INTERCEPTOR
=
"org.skywalking.apm.plugin.spring.mvc.commons.interceptor.RestMappingMethodInterceptor"
;
}
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-
3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v3
/EnhanceRequireObjectCache.java
→
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-
commons/src/main/java/org/skywalking/apm/plugin/spring/mvc/commons
/EnhanceRequireObjectCache.java
浏览文件 @
b02a8734
...
...
@@ -16,7 +16,7 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.plugin.spring.mvc.
v3
;
package
org.skywalking.apm.plugin.spring.mvc.
commons
;
import
java.lang.reflect.Method
;
import
javax.servlet.http.HttpServletResponse
;
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-
3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v3
/PathMappingCache.java
→
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-
commons/src/main/java/org/skywalking/apm/plugin/spring/mvc/commons
/PathMappingCache.java
浏览文件 @
b02a8734
...
...
@@ -16,7 +16,7 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.plugin.spring.mvc.
v3
;
package
org.skywalking.apm.plugin.spring.mvc.
commons
;
import
java.lang.reflect.Method
;
import
java.util.concurrent.ConcurrentHashMap
;
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-
4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v4
/AbstractMethodInteceptor.java
→
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-
commons/src/main/java/org/skywalking/apm/plugin/spring/mvc/commons/interceptor
/AbstractMethodInteceptor.java
浏览文件 @
b02a8734
...
...
@@ -16,7 +16,7 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.plugin.spring.mvc.
v4
;
package
org.skywalking.apm.plugin.spring.mvc.
commons.interceptor
;
import
java.lang.reflect.Method
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -31,6 +31,7 @@ import org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.skywalking.apm.network.trace.component.ComponentsDefine
;
import
org.skywalking.apm.plugin.spring.mvc.commons.EnhanceRequireObjectCache
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
...
...
@@ -43,7 +44,7 @@ public abstract class AbstractMethodInteceptor implements InstanceMethodsAroundI
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
PathMappingCache
pathMappingCache
=
(
PathMapping
Cache
)
objInst
.
getSkyWalkingDynamicField
();
EnhanceRequireObjectCache
pathMappingCache
=
(
EnhanceRequireObject
Cache
)
objInst
.
getSkyWalkingDynamicField
();
String
requestURL
=
pathMappingCache
.
findPathMapping
(
method
);
if
(
requestURL
==
null
)
{
requestURL
=
getRequestURL
(
method
);
...
...
@@ -70,7 +71,7 @@ public abstract class AbstractMethodInteceptor implements InstanceMethodsAroundI
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
HttpServletResponse
response
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
g
etResponse
();
HttpServletResponse
response
=
((
EnhanceRequireObjectCache
)
objInst
.
getSkyWalkingDynamicField
()).
getHttpServl
etResponse
();
AbstractSpan
span
=
ContextManager
.
activeSpan
();
if
(
response
.
getStatus
()
>=
400
)
{
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-
3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v3
/GetBeanInterceptor.java
→
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-
commons/src/main/java/org/skywalking/apm/plugin/spring/mvc/commons/interceptor
/GetBeanInterceptor.java
浏览文件 @
b02a8734
...
...
@@ -16,12 +16,13 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.plugin.spring.mvc.
v3
;
package
org.skywalking.apm.plugin.spring.mvc.
commons.interceptor
;
import
java.lang.reflect.Method
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.skywalking.apm.plugin.spring.mvc.commons.EnhanceRequireObjectCache
;
import
org.springframework.web.context.request.NativeWebRequest
;
/**
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-
3.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v3
/InvokeForRequestInterceptor.java
→
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-
commons/src/main/java/org/skywalking/apm/plugin/spring/mvc/commons/interceptor
/InvokeForRequestInterceptor.java
浏览文件 @
b02a8734
...
...
@@ -16,14 +16,15 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.plugin.spring.mvc.
v3
;
package
org.skywalking.apm.plugin.spring.mvc.
commons.interceptor
;
import
java.lang.reflect.Method
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
org.springframework.web.context.request.NativeWebRequest
;
import
java.lang.reflect.Method
;
/**
* {@link InvokeForRequestInterceptor} pass the {@link NativeWebRequest} object into the {@link
* org.springframework.stereotype.Controller} object.
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-
4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v4
/RequestMappingMethodInterceptor.java
→
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-
commons/src/main/java/org/skywalking/apm/plugin/spring/mvc/commons/interceptor
/RequestMappingMethodInterceptor.java
浏览文件 @
b02a8734
...
...
@@ -16,7 +16,7 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.plugin.spring.mvc.
v4
;
package
org.skywalking.apm.plugin.spring.mvc.
commons.interceptor
;
import
java.lang.reflect.Method
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-
4.x-plugin/src/main/java/org/skywalking/apm/plugin/spring/mvc/v4
/RestMappingMethodInterceptor.java
→
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-
commons/src/main/java/org/skywalking/apm/plugin/spring/mvc/commons/interceptor
/RestMappingMethodInterceptor.java
浏览文件 @
b02a8734
...
...
@@ -16,7 +16,7 @@
* Project repository: https://github.com/OpenSkywalking/skywalking
*/
package
org.skywalking.apm.plugin.spring.mvc.
v4
;
package
org.skywalking.apm.plugin.spring.mvc.
commons.interceptor
;
import
java.lang.reflect.Method
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml
浏览文件 @
b02a8734
...
...
@@ -35,6 +35,7 @@
<module>
spring-cloud
</module>
<module>
mvc-annotation-3.x-plugin
</module>
<module>
core-patch
</module>
<module>
mvc-annotation-commons
</module>
</modules>
<packaging>
pom
</packaging>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录