Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
killuaz丶x
SkyWalking
提交
f8c887e2
S
SkyWalking
项目概览
killuaz丶x
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
1
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,发现更多精彩内容 >>
未验证
提交
f8c887e2
编写于
9月 05, 2020
作者:
B
Brandon Fergerson
提交者:
GitHub
9月 05, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Include request method type in rest mapping annotations (#5085)
上级
4f1dab70
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
44 addition
and
31 deletion
+44
-31
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/spring/mvc/v4/RestMappingMethodInterceptorTest.java
...lugin/spring/mvc/v4/RestMappingMethodInterceptorTest.java
+10
-10
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
+15
-1
test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/kafka/KafkaProfileE2E.java
...java/org/apache/skywalking/e2e/kafka/KafkaProfileE2E.java
+2
-3
test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/profile/ProfileE2E.java
...st/java/org/apache/skywalking/e2e/profile/ProfileE2E.java
+1
-1
test/e2e/e2e-test/src/test/resources/expected/profile/endpoints.yml
...2e-test/src/test/resources/expected/profile/endpoints.yml
+2
-2
test/e2e/e2e-test/src/test/resources/expected/profile/finished.yml
...e2e-test/src/test/resources/expected/profile/finished.yml
+1
-1
test/e2e/e2e-test/src/test/resources/expected/profile/notified.yml
...e2e-test/src/test/resources/expected/profile/notified.yml
+1
-1
test/e2e/e2e-test/src/test/resources/expected/profile/profileSegment.yml
...st/src/test/resources/expected/profile/profileSegment.yml
+1
-1
test/e2e/e2e-test/src/test/resources/expected/profile/profileSegments.yml
...t/src/test/resources/expected/profile/profileSegments.yml
+1
-1
test/plugin/scenarios/elasticsearch-5.x-scenario/config/expectedData.yaml
...arios/elasticsearch-5.x-scenario/config/expectedData.yaml
+1
-1
test/plugin/scenarios/jdk-threading-scenario/config/expectedData.yaml
...scenarios/jdk-threading-scenario/config/expectedData.yaml
+3
-3
test/plugin/scenarios/spring-4.3.x-scenario/config/expectedData.yaml
.../scenarios/spring-4.3.x-scenario/config/expectedData.yaml
+5
-5
test/plugin/scenarios/springmvc-reactive-scenario/config/expectedData.yaml
...rios/springmvc-reactive-scenario/config/expectedData.yaml
+1
-1
未找到文件。
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-4.x-plugin/src/test/java/org/apache/skywalking/apm/plugin/spring/mvc/v4/RestMappingMethodInterceptorTest.java
浏览文件 @
f8c887e2
...
...
@@ -147,7 +147,7 @@ public class RestMappingMethodInterceptorTest {
TraceSegment
traceSegment
=
segmentStorage
.
getTraceSegments
().
get
(
0
);
List
<
AbstractTracingSpan
>
spans
=
SegmentHelper
.
getSpans
(
traceSegment
);
assertHttpSpan
(
spans
.
get
(
0
),
"/getRequestURL"
);
assertHttpSpan
(
spans
.
get
(
0
),
"
{GET}"
,
"
/getRequestURL"
);
}
@Test
...
...
@@ -173,7 +173,7 @@ public class RestMappingMethodInterceptorTest {
TraceSegment
traceSegment
=
segmentStorage
.
getTraceSegments
().
get
(
0
);
List
<
AbstractTracingSpan
>
spans
=
SegmentHelper
.
getSpans
(
traceSegment
);
assertHttpSpan
(
spans
.
get
(
0
),
"/postRequestURL"
);
assertHttpSpan
(
spans
.
get
(
0
),
"
{POST}"
,
"
/postRequestURL"
);
}
@Test
...
...
@@ -199,7 +199,7 @@ public class RestMappingMethodInterceptorTest {
TraceSegment
traceSegment
=
segmentStorage
.
getTraceSegments
().
get
(
0
);
List
<
AbstractTracingSpan
>
spans
=
SegmentHelper
.
getSpans
(
traceSegment
);
assertHttpSpan
(
spans
.
get
(
0
),
"/putRequestURL"
);
assertHttpSpan
(
spans
.
get
(
0
),
"
{PUT}"
,
"
/putRequestURL"
);
}
@Test
...
...
@@ -226,7 +226,7 @@ public class RestMappingMethodInterceptorTest {
TraceSegment
traceSegment
=
segmentStorage
.
getTraceSegments
().
get
(
0
);
List
<
AbstractTracingSpan
>
spans
=
SegmentHelper
.
getSpans
(
traceSegment
);
assertHttpSpan
(
spans
.
get
(
0
),
"/deleteRequestURL"
);
assertHttpSpan
(
spans
.
get
(
0
),
"
{DELETE}"
,
"
/deleteRequestURL"
);
}
@Test
...
...
@@ -252,7 +252,7 @@ public class RestMappingMethodInterceptorTest {
TraceSegment
traceSegment
=
segmentStorage
.
getTraceSegments
().
get
(
0
);
List
<
AbstractTracingSpan
>
spans
=
SegmentHelper
.
getSpans
(
traceSegment
);
assertHttpSpan
(
spans
.
get
(
0
),
"/patchRequestURL"
);
assertHttpSpan
(
spans
.
get
(
0
),
"
{PATCH}"
,
"
/patchRequestURL"
);
}
@Test
...
...
@@ -278,7 +278,7 @@ public class RestMappingMethodInterceptorTest {
TraceSegment
traceSegment
=
segmentStorage
.
getTraceSegments
().
get
(
0
);
List
<
AbstractTracingSpan
>
spans
=
SegmentHelper
.
getSpans
(
traceSegment
);
assertHttpSpan
(
spans
.
get
(
0
),
""
);
assertHttpSpan
(
spans
.
get
(
0
),
""
,
""
);
}
@Test
...
...
@@ -304,7 +304,7 @@ public class RestMappingMethodInterceptorTest {
TraceSegment
traceSegment
=
segmentStorage
.
getTraceSegments
().
get
(
0
);
List
<
AbstractTracingSpan
>
spans
=
SegmentHelper
.
getSpans
(
traceSegment
);
assertHttpSpan
(
spans
.
get
(
0
),
"/getRequestURL"
);
assertHttpSpan
(
spans
.
get
(
0
),
"
{GET}"
,
"
/getRequestURL"
);
List
<
LogDataEntity
>
logDataEntities
=
SpanHelper
.
getLogs
(
spans
.
get
(
0
));
assertThat
(
logDataEntities
.
size
(),
is
(
1
));
SpanAssert
.
assertException
(
logDataEntities
.
get
(
0
),
RuntimeException
.
class
);
...
...
@@ -335,7 +335,7 @@ public class RestMappingMethodInterceptorTest {
TraceSegment
traceSegment
=
segmentStorage
.
getTraceSegments
().
get
(
0
);
List
<
AbstractTracingSpan
>
spans
=
SegmentHelper
.
getSpans
(
traceSegment
);
assertHttpSpan
(
spans
.
get
(
0
),
"/getRequestURL"
);
assertHttpSpan
(
spans
.
get
(
0
),
"
{GET}"
,
"
/getRequestURL"
);
SpanAssert
.
assertTag
(
spans
.
get
(
0
),
2
,
"connection=[keep-alive]"
);
}
...
...
@@ -345,8 +345,8 @@ public class RestMappingMethodInterceptorTest {
MatcherAssert
.
assertThat
(
SegmentRefHelper
.
getTraceSegmentId
(
ref
).
toString
(),
is
(
"1.444.555"
));
}
private
void
assertHttpSpan
(
AbstractTracingSpan
span
,
String
suffix
)
{
assertThat
(
span
.
getOperationName
(),
is
(
"/test"
+
suffix
));
private
void
assertHttpSpan
(
AbstractTracingSpan
span
,
String
prefix
,
String
suffix
)
{
assertThat
(
span
.
getOperationName
(),
is
(
prefix
+
"/test"
+
suffix
));
SpanAssert
.
assertComponent
(
span
,
ComponentsDefine
.
SPRING_MVC_ANNOTATION
);
SpanAssert
.
assertTag
(
span
,
0
,
"http://localhost:8080/test"
+
suffix
);
assertThat
(
span
.
isEntry
(),
is
(
true
));
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/RestMappingMethodInterceptor.java
浏览文件 @
f8c887e2
...
...
@@ -80,6 +80,20 @@ public class RestMappingMethodInterceptor extends AbstractMethodInterceptor {
@Override
public
String
getAcceptedMethodTypes
(
Method
method
)
{
return
""
;
return
ParsePathUtil
.
recursiveParseMethodAnnotation
(
method
,
m
->
{
if
(
AnnotationUtils
.
getAnnotation
(
m
,
GetMapping
.
class
)
!=
null
)
{
return
"{GET}"
;
}
else
if
(
AnnotationUtils
.
getAnnotation
(
m
,
PostMapping
.
class
)
!=
null
)
{
return
"{POST}"
;
}
else
if
(
AnnotationUtils
.
getAnnotation
(
m
,
PutMapping
.
class
)
!=
null
)
{
return
"{PUT}"
;
}
else
if
(
AnnotationUtils
.
getAnnotation
(
m
,
DeleteMapping
.
class
)
!=
null
)
{
return
"{DELETE}"
;
}
else
if
(
AnnotationUtils
.
getAnnotation
(
m
,
PatchMapping
.
class
)
!=
null
)
{
return
"{PATCH}"
;
}
else
{
return
null
;
}
});
}
}
test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/kafka/KafkaProfileE2E.java
浏览文件 @
f8c887e2
...
...
@@ -141,9 +141,8 @@ public class KafkaProfileE2E extends SkyWalkingTestAdapter {
@Order
(
3
)
void
createProfileTask
()
throws
Exception
{
final
ProfileTaskCreationRequest
creationRequest
=
ProfileTaskCreationRequest
.
builder
()
.
serviceId
(
"ZTJlLXByb2ZpbGUtc2VydmljZQ==.1"
)
.
endpointName
(
"/profile/{name}"
)
.
serviceId
(
"ZTJlLXByb2ZpbGUtc2VydmljZQ==.1"
)
.
endpointName
(
"{POST}/profile/{name}"
)
.
duration
(
1
)
.
startTime
(-
1
)
.
minDurationThreshold
(
1500
)
...
...
test/e2e/e2e-test/src/test/java/org/apache/skywalking/e2e/profile/ProfileE2E.java
浏览文件 @
f8c887e2
...
...
@@ -141,7 +141,7 @@ public class ProfileE2E extends SkyWalkingTestAdapter {
void
createProfileTask
()
throws
Exception
{
final
ProfileTaskCreationRequest
creationRequest
=
ProfileTaskCreationRequest
.
builder
()
.
serviceId
(
"ZTJlLXByb2ZpbGUtc2VydmljZQ==.1"
)
.
endpointName
(
"/profile/{name}"
)
.
endpointName
(
"
{POST}
/profile/{name}"
)
.
duration
(
1
)
.
startTime
(-
1
)
.
minDurationThreshold
(
1500
)
...
...
test/e2e/e2e-test/src/test/resources/expected/profile/endpoints.yml
浏览文件 @
f8c887e2
...
...
@@ -14,5 +14,5 @@
# limitations under the License.
endpoints
:
-
key
:
ZTJlLXByb2ZpbGUtc2VydmljZQ==.1_L3Byb2ZpbGUve25hbWV9
label
:
/profile/{name}
-
key
:
ZTJlLXByb2ZpbGUtc2VydmljZQ==.1_
e1BPU1R9
L3Byb2ZpbGUve25hbWV9
label
:
'
{POST}/profile/{name}'
test/e2e/e2e-test/src/test/resources/expected/profile/finished.yml
浏览文件 @
f8c887e2
...
...
@@ -16,7 +16,7 @@
tasks
:
-
id
:
not
null
serviceId
:
ZTJlLXByb2ZpbGUtc2VydmljZQ==.1
endpointName
:
/profile/{name}
endpointName
:
'
{POST}/profile/{name}'
startTime
:
gt
0
duration
:
gt
0
minDurationThreshold
:
gt
0
...
...
test/e2e/e2e-test/src/test/resources/expected/profile/notified.yml
浏览文件 @
f8c887e2
...
...
@@ -16,7 +16,7 @@
tasks
:
-
id
:
not
null
serviceId
:
ZTJlLXByb2ZpbGUtc2VydmljZQ==.1
endpointName
:
/profile/{name}
endpointName
:
'
{POST}/profile/{name}'
startTime
:
gt
0
duration
:
gt
0
minDurationThreshold
:
gt
0
...
...
test/e2e/e2e-test/src/test/resources/expected/profile/profileSegment.yml
浏览文件 @
f8c887e2
...
...
@@ -19,7 +19,7 @@ spans:
serviceCode
:
not
null
startTime
:
gt
0
endTime
:
gt
0
endpointName
:
/profile/{name}
endpointName
:
'
{POST}/profile/{name}'
tags
:
-
key
:
url
value
:
not
null
...
...
test/e2e/e2e-test/src/test/resources/expected/profile/profileSegments.yml
浏览文件 @
f8c887e2
...
...
@@ -16,7 +16,7 @@
traces
:
-
key
:
not
null
endpointNames
:
-
/profile/{name}
-
'
{POST}/profile/{name}'
duration
:
ge
0
start
:
gt
0
isError
:
false
...
...
test/plugin/scenarios/elasticsearch-5.x-scenario/config/expectedData.yaml
浏览文件 @
f8c887e2
...
...
@@ -139,7 +139,7 @@ segmentItems:
-
{
key
:
es.indices
,
value
:
'
'
}
-
{
key
:
es.types
,
value
:
'
'
}
skipAnalysis
:
'
false'
-
operationName
:
/case/elasticsearch
-
operationName
:
'
{GET}/case/elasticsearch'
operationId
:
0
parentSpanId
:
-1
spanId
:
0
...
...
test/plugin/scenarios/jdk-threading-scenario/config/expectedData.yaml
浏览文件 @
f8c887e2
...
...
@@ -19,7 +19,7 @@ segmentItems:
segments
:
-
segmentId
:
not
null
spans
:
-
operationName
:
/greet/{username}
-
operationName
:
'
{GET}/greet/{username}'
operationId
:
0
parentSpanId
:
-1
spanId
:
0
...
...
@@ -63,7 +63,7 @@ segmentItems:
spanType
:
Local
peer
:
'
'
refs
:
-
{
parentEndpoint
:
'
/greet/{username}'
,
networkAddress
:
'
'
,
refType
:
CrossThread
,
-
{
parentEndpoint
:
'
{GET}
/greet/{username}'
,
networkAddress
:
'
'
,
refType
:
CrossThread
,
parentSpanId
:
0
,
parentTraceSegmentId
:
not null
,
parentServiceInstance
:
not
null
,
parentService
:
jdk-threading-scenario
,
traceId
:
not null
}
skipAnalysis
:
'
false'
...
...
@@ -96,7 +96,7 @@ segmentItems:
spanType
:
Local
peer
:
'
'
refs
:
-
{
parentEndpoint
:
'
/greet/{username}'
,
networkAddress
:
'
'
,
refType
:
CrossThread
,
-
{
parentEndpoint
:
'
{GET}
/greet/{username}'
,
networkAddress
:
'
'
,
refType
:
CrossThread
,
parentSpanId
:
0
,
parentTraceSegmentId
:
not null
,
parentServiceInstance
:
not
null
,
parentService
:
jdk-threading-scenario
,
traceId
:
not null
}
skipAnalysis
:
'
false'
test/plugin/scenarios/spring-4.3.x-scenario/config/expectedData.yaml
浏览文件 @
f8c887e2
...
...
@@ -70,7 +70,7 @@ segmentItems:
skipAnalysis
:
'
false'
-
segmentId
:
not
null
spans
:
-
operationName
:
/create/
-
operationName
:
'
{POST}/create/'
operationId
:
0
parentSpanId
:
-1
spanId
:
0
...
...
@@ -91,7 +91,7 @@ segmentItems:
skipAnalysis
:
'
false'
-
segmentId
:
not
null
spans
:
-
operationName
:
/get/{id}
-
operationName
:
'
{GET}/get/{id}'
operationId
:
0
parentSpanId
:
-1
spanId
:
0
...
...
@@ -112,7 +112,7 @@ segmentItems:
skipAnalysis
:
'
false'
-
segmentId
:
not
null
spans
:
-
operationName
:
/update/{id}
-
operationName
:
'
{PUT}/update/{id}'
operationId
:
0
parentSpanId
:
-1
spanId
:
0
...
...
@@ -133,7 +133,7 @@ segmentItems:
skipAnalysis
:
'
false'
-
segmentId
:
not
null
spans
:
-
operationName
:
/delete/{id}
-
operationName
:
'
{DELETE}/delete/{id}'
operationId
:
0
parentSpanId
:
-1
spanId
:
0
...
...
@@ -196,7 +196,7 @@ segmentItems:
skipAnalysis
:
'
false'
-
segmentId
:
not
null
spans
:
-
operationName
:
/impl/restmapping
-
operationName
:
'
{GET}/impl/restmapping'
operationId
:
0
parentSpanId
:
-1
spanId
:
0
...
...
test/plugin/scenarios/springmvc-reactive-scenario/config/expectedData.yaml
浏览文件 @
f8c887e2
...
...
@@ -36,7 +36,7 @@ segmentItems:
-
{
key
:
db.instance
,
value
:
test
}
-
{
key
:
db.statement
,
value
:
not null
}
skipAnalysis
:
'
false'
-
operationName
:
/testcase/{test}
-
operationName
:
'
{GET}/testcase/{test}'
operationId
:
0
parentSpanId
:
-1
spanId
:
0
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录