Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
润土的好友猹
SkyWalking
提交
1b54b61a
S
SkyWalking
项目概览
润土的好友猹
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
9
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
1b54b61a
编写于
8月 23, 2020
作者:
H
hailin0
提交者:
GitHub
8月 23, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for spring @Scheduled (#5339)
上级
4ea62183
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
759 addition
and
0 deletion
+759
-0
.github/workflows/plugins-test.3.yaml
.github/workflows/plugins-test.3.yaml
+1
-0
apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
...walking/apm/network/trace/component/ComponentsDefine.java
+2
-0
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/scheduled-annotation-plugin/pom.xml
...plugin/spring-plugins/scheduled-annotation-plugin/pom.xml
+45
-0
apm-sniffer/apm-sdk-plugin/spring-plugins/scheduled-annotation-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/scheduled/ScheduledMethodConstructorWithMethodInterceptor.java
...uled/ScheduledMethodConstructorWithMethodInterceptor.java
+46
-0
apm-sniffer/apm-sdk-plugin/spring-plugins/scheduled-annotation-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/scheduled/ScheduledMethodConstructorWithStringInterceptor.java
...uled/ScheduledMethodConstructorWithStringInterceptor.java
+41
-0
apm-sniffer/apm-sdk-plugin/spring-plugins/scheduled-annotation-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/scheduled/ScheduledMethodInterceptor.java
...m/plugin/spring/scheduled/ScheduledMethodInterceptor.java
+57
-0
apm-sniffer/apm-sdk-plugin/spring-plugins/scheduled-annotation-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/scheduled/define/ScheduledMethodInterceptorInstrumentation.java
...led/define/ScheduledMethodInterceptorInstrumentation.java
+112
-0
apm-sniffer/apm-sdk-plugin/spring-plugins/scheduled-annotation-plugin/src/main/resources/skywalking-plugin.def
...nnotation-plugin/src/main/resources/skywalking-plugin.def
+17
-0
docs/en/setup/service-agent/java-agent/Plugin-list.md
docs/en/setup/service-agent/java-agent/Plugin-list.md
+1
-0
docs/en/setup/service-agent/java-agent/Supported-list.md
docs/en/setup/service-agent/java-agent/Supported-list.md
+1
-0
oap-server/server-bootstrap/src/main/resources/component-libraries.yml
...rver-bootstrap/src/main/resources/component-libraries.yml
+3
-0
oap-server/server-core/src/test/resources/component-libraries.yml
...er/server-core/src/test/resources/component-libraries.yml
+3
-0
test/plugin/scenarios/spring-scheduled-scenario/config/expectedData.yaml
...narios/spring-scheduled-scenario/config/expectedData.yaml
+69
-0
test/plugin/scenarios/spring-scheduled-scenario/configuration.yml
...gin/scenarios/spring-scheduled-scenario/configuration.yml
+19
-0
test/plugin/scenarios/spring-scheduled-scenario/pom.xml
test/plugin/scenarios/spring-scheduled-scenario/pom.xml
+118
-0
test/plugin/scenarios/spring-scheduled-scenario/src/main/java/org/apache/skywalking/apm/testcase/spring/scheduled/controller/CaseController.java
.../testcase/spring/scheduled/controller/CaseController.java
+46
-0
test/plugin/scenarios/spring-scheduled-scenario/src/main/java/org/apache/skywalking/apm/testcase/spring/scheduled/job/SchedulingJob.java
...king/apm/testcase/spring/scheduled/job/SchedulingJob.java
+48
-0
test/plugin/scenarios/spring-scheduled-scenario/src/main/resources/log4j2.xml
...s/spring-scheduled-scenario/src/main/resources/log4j2.xml
+30
-0
test/plugin/scenarios/spring-scheduled-scenario/src/main/webapp/WEB-INF/spring-mvc-servlet.xml
...d-scenario/src/main/webapp/WEB-INF/spring-mvc-servlet.xml
+38
-0
test/plugin/scenarios/spring-scheduled-scenario/src/main/webapp/WEB-INF/web.xml
...spring-scheduled-scenario/src/main/webapp/WEB-INF/web.xml
+34
-0
test/plugin/scenarios/spring-scheduled-scenario/support-version.list
.../scenarios/spring-scheduled-scenario/support-version.list
+27
-0
未找到文件。
.github/workflows/plugins-test.3.yaml
浏览文件 @
1b54b61a
...
...
@@ -55,6 +55,7 @@ jobs:
-
{
name
:
'
hbase-scenario'
,
title
:
'
hbase-scenario
(5)'
}
-
{
name
:
'
spring-kafka-2.2.x-scenario'
,
title
:
'
Spring-Kafka
2.2.x
(7)'
}
-
{
name
:
'
spring-kafka-2.3.x-scenario'
,
title
:
'
Spring-Kafka
2.3.x
(7)'
}
-
{
name
:
'
spring-scheduled-scenario'
,
title
:
'
Spring
Scheduled
3.1.x-5.2.x
(9)'
}
steps
:
-
uses
:
actions/checkout@v2
with
:
...
...
apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
浏览文件 @
1b54b61a
...
...
@@ -172,4 +172,6 @@ public class ComponentsDefine {
public
static
final
OfficialComponent
HBASE
=
new
OfficialComponent
(
94
,
"HBase"
);
public
static
final
OfficialComponent
SPRING_KAFKA_CONSUMER
=
new
OfficialComponent
(
95
,
"spring-kafka-consumer"
);
public
static
final
OfficialComponent
SPRING_SCHEDULED
=
new
OfficialComponent
(
96
,
"SpringScheduled"
);
}
apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml
浏览文件 @
1b54b61a
...
...
@@ -40,6 +40,7 @@
<module>
mvc-annotation-5.x-plugin
</module>
<module>
spring-webflux-5.x-plugin
</module>
<module>
spring-kafka-2.x-plugin
</module>
<module>
scheduled-annotation-plugin
</module>
</modules>
<packaging>
pom
</packaging>
...
...
apm-sniffer/apm-sdk-plugin/spring-plugins/scheduled-annotation-plugin/pom.xml
0 → 100644
浏览文件 @
1b54b61a
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You 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
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.apache.skywalking
</groupId>
<version>
8.2.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apm-spring-scheduled-annotation-plugin
</artifactId>
<packaging>
jar
</packaging>
<name>
scheduled-annotation-plugin
</name>
<url>
http://maven.apache.org
</url>
<properties>
<spring-context.version>
5.1.4.RELEASE
</spring-context.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-context
</artifactId>
<version>
${spring-context.version}
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/spring-plugins/scheduled-annotation-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/scheduled/ScheduledMethodConstructorWithMethodInterceptor.java
0 → 100644
浏览文件 @
1b54b61a
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
package
org.apache.skywalking.apm.plugin.spring.scheduled
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor
;
import
java.lang.reflect.Method
;
/**
* Intercept method of {@code org.springframework.scheduling.support.ScheduledMethodRunnable#ScheduledMethodRunnable(java.lang.Object, java.lang.reflect.Method)}.
* record the execute method full name
*/
public
class
ScheduledMethodConstructorWithMethodInterceptor
implements
InstanceConstructorInterceptor
{
@Override
public
void
onConstruct
(
EnhancedInstance
objInst
,
Object
[]
allArguments
)
throws
Throwable
{
Method
method
=
(
Method
)
allArguments
[
1
];
String
fullMethodName
=
buildFullMethodName
(
method
);
objInst
.
setSkyWalkingDynamicField
(
fullMethodName
);
}
protected
String
buildFullMethodName
(
Method
method
)
{
String
className
=
method
.
getDeclaringClass
().
getName
();
String
methodName
=
method
.
getName
();
return
className
+
"."
+
methodName
;
}
}
apm-sniffer/apm-sdk-plugin/spring-plugins/scheduled-annotation-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/scheduled/ScheduledMethodConstructorWithStringInterceptor.java
0 → 100644
浏览文件 @
1b54b61a
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
package
org.apache.skywalking.apm.plugin.spring.scheduled
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
java.lang.reflect.Method
;
/**
* Intercept method of {@code org.springframework.scheduling.support.ScheduledMethodRunnable#ScheduledMethodRunnable(java.lang.Object, java.lang.String)}.
* record the execute method full name
*/
public
class
ScheduledMethodConstructorWithStringInterceptor
extends
ScheduledMethodConstructorWithMethodInterceptor
{
@Override
public
void
onConstruct
(
EnhancedInstance
objInst
,
Object
[]
allArguments
)
throws
Throwable
{
Object
targetObject
=
allArguments
[
0
];
String
methodName
=
(
String
)
allArguments
[
1
];
Method
method
=
targetObject
.
getClass
().
getMethod
(
methodName
);
String
fullMethodName
=
buildFullMethodName
(
method
);
objInst
.
setSkyWalkingDynamicField
(
fullMethodName
);
}
}
apm-sniffer/apm-sdk-plugin/spring-plugins/scheduled-annotation-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/scheduled/ScheduledMethodInterceptor.java
0 → 100644
浏览文件 @
1b54b61a
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
package
org.apache.skywalking.apm.plugin.spring.scheduled
;
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.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.network.trace.component.ComponentsDefine
;
import
java.lang.reflect.Method
;
/**
* Intercept method of {@code org.springframework.scheduling.support.ScheduledMethodRunnable#run()}.
* record the schedule task local span.
*/
public
class
ScheduledMethodInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
String
fullMethodName
=
(
String
)
objInst
.
getSkyWalkingDynamicField
();
String
operationName
=
ComponentsDefine
.
SPRING_SCHEDULED
.
getName
()
+
"/"
+
fullMethodName
;
AbstractSpan
span
=
ContextManager
.
createLocalSpan
(
operationName
);
Tags
.
LOGIC_ENDPOINT
.
set
(
span
,
Tags
.
VAL_LOCAL_SPAN_AS_LOGIC_ENDPOINT
);
span
.
setComponent
(
ComponentsDefine
.
SPRING_SCHEDULED
);
}
@Override
public
Object
afterMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Object
ret
)
throws
Throwable
{
ContextManager
.
stopSpan
();
return
ret
;
}
@Override
public
void
handleMethodException
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
Throwable
t
)
{
ContextManager
.
activeSpan
().
errorOccurred
().
log
(
t
);
}
}
apm-sniffer/apm-sdk-plugin/spring-plugins/scheduled-annotation-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/scheduled/define/ScheduledMethodInterceptorInstrumentation.java
0 → 100644
浏览文件 @
1b54b61a
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
package
org.apache.skywalking.apm.plugin.spring.scheduled.define
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
java.lang.reflect.Method
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
isPublic
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
takesArgument
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
takesArguments
;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
NameMatch
.
byName
;
/**
* Enhance {@code org.springframework.scheduling.support.ScheduledMethodRunnable} instance,
* and intercept {@code org.springframework.scheduling.support.ScheduledMethodRunnable#run()} method,
* this method is a unified entrance of execute schedule task.
*
* @see org.apache.skywalking.apm.plugin.spring.scheduled.ScheduledMethodConstructorWithMethodInterceptor
* @see org.apache.skywalking.apm.plugin.spring.scheduled.ScheduledMethodConstructorWithStringInterceptor
* @see org.apache.skywalking.apm.plugin.spring.scheduled.ScheduledMethodInterceptor
*/
public
class
ScheduledMethodInterceptorInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
static
final
String
CONSTRUCTOR_WITH_METHOD_INTERCEPTOR_CLASS
=
"org.apache.skywalking.apm.plugin.spring.scheduled.ScheduledMethodConstructorWithMethodInterceptor"
;
public
static
final
String
CONSTRUCTOR_WITH_STRING_INTERCEPTOR_CLASS
=
"org.apache.skywalking.apm.plugin.spring.scheduled.ScheduledMethodConstructorWithStringInterceptor"
;
public
static
final
String
METHOD_INTERCEPTOR_CLASS
=
"org.apache.skywalking.apm.plugin.spring.scheduled.ScheduledMethodInterceptor"
;
public
static
final
String
ENHANC_CLASS
=
"org.springframework.scheduling.support.ScheduledMethodRunnable"
;
@Override
public
ClassMatch
enhanceClass
()
{
return
byName
(
ENHANC_CLASS
);
}
@Override
public
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[]
{
new
ConstructorInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getConstructorMatcher
()
{
return
takesArguments
(
2
)
.
and
(
takesArgument
(
0
,
Object
.
class
))
.
and
(
takesArgument
(
1
,
Method
.
class
));
}
@Override
public
String
getConstructorInterceptor
()
{
return
CONSTRUCTOR_WITH_METHOD_INTERCEPTOR_CLASS
;
}
},
new
ConstructorInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getConstructorMatcher
()
{
return
takesArguments
(
2
)
.
and
(
takesArgument
(
0
,
Object
.
class
))
.
and
(
takesArgument
(
1
,
String
.
class
));
}
@Override
public
String
getConstructorInterceptor
()
{
return
CONSTRUCTOR_WITH_STRING_INTERCEPTOR_CLASS
;
}
}
};
}
@Override
public
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]
{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
"run"
)
.
and
(
isPublic
())
.
and
(
takesArguments
(
0
));
}
@Override
public
String
getMethodsInterceptor
()
{
return
METHOD_INTERCEPTOR_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
}
apm-sniffer/apm-sdk-plugin/spring-plugins/scheduled-annotation-plugin/src/main/resources/skywalking-plugin.def
0 → 100644
浏览文件 @
1b54b61a
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
spring-scheduled-annotation=org.apache.skywalking.apm.plugin.spring.scheduled.define.ScheduledMethodInterceptorInstrumentation
\ No newline at end of file
docs/en/setup/service-agent/java-agent/Plugin-list.md
浏览文件 @
1b54b61a
...
...
@@ -82,6 +82,7 @@
-
spring-mvc-annotation-4.x
-
spring-mvc-annotation-5.x
-
spring-resttemplate-4.x
-
spring-scheduled-annotation
-
spring-tx
-
spring-webflux-5.x
-
spymemcached-2.x
...
...
docs/en/setup/service-agent/java-agent/Supported-list.md
浏览文件 @
1b54b61a
...
...
@@ -85,6 +85,7 @@
*
Scheduler
*
[
Elastic Job
](
https://github.com/elasticjob/elastic-job
)
2.x
*
[
Apache ShardingSphere-Elasticjob
](
https://github.com/apache/shardingsphere-elasticjob
)
3.0.0-alpha
*
[
Spring @Scheduled
](
https://github.com/spring-projects/spring-framework
)
3.1+
*
OpenTracing community supported
*
[
Canal: Alibaba mysql database binlog incremental subscription & consumer components
](
https://github.com/alibaba/canal
)
1.0.25 -> 1.1.2
*
JSON
...
...
oap-server/server-bootstrap/src/main/resources/component-libraries.yml
浏览文件 @
1b54b61a
...
...
@@ -317,6 +317,9 @@ HBase:
spring-kafka-consumer
:
id
:
95
languages
:
Java
SpringScheduled
:
id
:
96
languages
:
Java
# .NET/.NET Core components
# [3000, 4000) for C#/.NET only
...
...
oap-server/server-core/src/test/resources/component-libraries.yml
浏览文件 @
1b54b61a
...
...
@@ -266,6 +266,9 @@ InfluxDB:
influxdb-java
:
id
:
90
languages
:
Java
SpringScheduled
:
id
:
96
languages
:
Java
# .NET/.NET Core components
# [3000, 4000) for C#/.NET only
...
...
test/plugin/scenarios/spring-scheduled-scenario/config/expectedData.yaml
0 → 100644
浏览文件 @
1b54b61a
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
segmentItems
:
-
serviceName
:
spring-scheduled-scenario
segmentSize
:
ge
2
segments
:
-
segmentId
:
not
null
spans
:
-
operationName
:
/spring-scheduled-scenario/case/call
operationId
:
0
parentSpanId
:
-1
spanId
:
0
spanLayer
:
Http
startTime
:
nq
0
endTime
:
nq
0
componentId
:
1
isError
:
false
spanType
:
Entry
peer
:
'
'
skipAnalysis
:
false
tags
:
-
{
key
:
url
,
value
:
'
http://localhost:8080/spring-scheduled-scenario/case/call'
}
-
{
key
:
http.method
,
value
:
GET
}
refs
:
-
{
parentEndpoint
:
SpringScheduled/org.apache.skywalking.apm.testcase.spring.scheduled.job.SchedulingJob.work
,
networkAddress
:
'
localhost:8080'
,
refType
:
CrossProcess
,
parentSpanId
:
1
,
parentTraceSegmentId
:
not null
,
parentServiceInstance
:
not null
,
parentService
:
not null
,
traceId
:
not null
}
-
segmentId
:
not
null
spans
:
-
operationName
:
/spring-scheduled-scenario/case/call
operationId
:
0
parentSpanId
:
0
spanId
:
1
spanLayer
:
Http
startTime
:
not
null
endTime
:
not
null
componentId
:
12
isError
:
false
spanType
:
Exit
peer
:
localhost:8080
skipAnalysis
:
false
tags
:
-
{
key
:
http.method
,
value
:
GET
}
-
{
key
:
url
,
value
:
'
http://localhost:8080/spring-scheduled-scenario/case/call'
}
-
operationName
:
SpringScheduled/org.apache.skywalking.apm.testcase.spring.scheduled.job.SchedulingJob.work
operationId
:
0
parentSpanId
:
-1
spanId
:
0
spanLayer
:
Unknown
startTime
:
not
null
endTime
:
not
null
componentId
:
96
isError
:
false
spanType
:
Local
peer
:
'
'
skipAnalysis
:
false
tags
:
-
{
key
:
x-le
,
value
:
'
{"logic-span":true}'
}
\ No newline at end of file
test/plugin/scenarios/spring-scheduled-scenario/configuration.yml
0 → 100644
浏览文件 @
1b54b61a
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
type
:
tomcat
entryService
:
http://localhost:8080/spring-scheduled-scenario/case/healthCheck
healthCheck
:
http://localhost:8080/spring-scheduled-scenario/case/healthCheck
\ No newline at end of file
test/plugin/scenarios/spring-scheduled-scenario/pom.xml
0 → 100644
浏览文件 @
1b54b61a
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You 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
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"
>
<groupId>
org.apache.skywalking.apm.testcase
</groupId>
<artifactId>
spring-scheduled-scenario
</artifactId>
<version>
1.0.0
</version>
<packaging>
war
</packaging>
<modelVersion>
4.0.0
</modelVersion>
<name>
skywalking-spring-scheduled-scenario
</name>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<compiler.version>
1.8
</compiler.version>
<lombok.version>
1.18.10
</lombok.version>
<!-- Cannot be testing spring(3.2.0 ~ 3.2.8) because the tomcat image unsupported jdk1.7 -->
<test.framework.version>
3.1.0.RELEASE
</test.framework.version>
<test.framework>
spring-scheduled
</test.framework>
</properties>
<dependencies>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
<version>
3.1.0
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-api
</artifactId>
<version>
2.8.1
</version>
</dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-core
</artifactId>
<version>
2.8.1
</version>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<version>
${lombok.version}
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-context
</artifactId>
<version>
${test.framework.version}
</version>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-web
</artifactId>
<version>
${test.framework.version}
</version>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-webmvc
</artifactId>
<version>
${test.framework.version}
</version>
</dependency>
<dependency>
<groupId>
cglib
</groupId>
<artifactId>
cglib
</artifactId>
<version>
2.2
</version>
</dependency>
<dependency>
<groupId>
com.squareup.okhttp3
</groupId>
<artifactId>
okhttp
</artifactId>
<version>
3.0.0
</version>
</dependency>
</dependencies>
<build>
<finalName>
spring-scheduled-scenario
</finalName>
<plugins>
<plugin>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
${compiler.version}
</source>
<target>
${compiler.version}
</target>
<encoding>
${project.build.sourceEncoding}
</encoding>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.tomcat.maven
</groupId>
<artifactId>
tomcat7-maven-plugin
</artifactId>
<version>
2.1
</version>
<configuration>
<port>
8080
</port>
<path>
/spring-scheduled-scenario
</path>
<uriEncoding>
UTF-8
</uriEncoding>
<server>
tomcat7
</server>
</configuration>
</plugin>
</plugins>
</build>
</project>
test/plugin/scenarios/spring-scheduled-scenario/src/main/java/org/apache/skywalking/apm/testcase/spring/scheduled/controller/CaseController.java
0 → 100644
浏览文件 @
1b54b61a
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
package
org.apache.skywalking.apm.testcase.spring.scheduled.controller
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
@Controller
@RequestMapping
(
"/case"
)
public
class
CaseController
{
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
CaseController
.
class
);
private
static
final
String
SUCCESS
=
"Success"
;
@RequestMapping
(
"/healthCheck"
)
@ResponseBody
public
String
healthCheck
()
{
return
SUCCESS
;
}
@RequestMapping
(
"/call"
)
@ResponseBody
public
String
call
()
{
return
SUCCESS
;
}
}
test/plugin/scenarios/spring-scheduled-scenario/src/main/java/org/apache/skywalking/apm/testcase/spring/scheduled/job/SchedulingJob.java
0 → 100644
浏览文件 @
1b54b61a
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
*/
package
org.apache.skywalking.apm.testcase.spring.scheduled.job
;
import
okhttp3.OkHttpClient
;
import
okhttp3.Request
;
import
okhttp3.Response
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
java.io.IOException
;
@Configuration
@EnableScheduling
public
class
SchedulingJob
{
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
SchedulingJob
.
class
);
private
static
final
OkHttpClient
client
=
new
OkHttpClient
.
Builder
().
build
();
@Scheduled
(
fixedDelay
=
5000
)
public
void
work
()
throws
IOException
{
logger
.
info
(
"work job running!"
);
Request
request
=
new
Request
.
Builder
().
url
(
"http://localhost:8080/spring-scheduled-scenario/case/call"
).
build
();
Response
response
=
client
.
newCall
(
request
).
execute
();
response
.
body
().
close
();
}
}
test/plugin/scenarios/spring-scheduled-scenario/src/main/resources/log4j2.xml
0 → 100644
浏览文件 @
1b54b61a
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You 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.
~
-->
<Configuration
status=
"WARN"
>
<Appenders>
<Console
name=
"Console"
target=
"SYSTEM_ERR"
>
<PatternLayout
charset=
"UTF-8"
pattern=
"[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%p] - %l - %m%n"
/>
</Console>
</Appenders>
<Loggers>
<Root
level=
"INFO"
>
<AppenderRef
ref=
"Console"
/>
</Root>
</Loggers>
</Configuration>
\ No newline at end of file
test/plugin/scenarios/spring-scheduled-scenario/src/main/webapp/WEB-INF/spring-mvc-servlet.xml
0 → 100644
浏览文件 @
1b54b61a
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You 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.
~
-->
<beans
xmlns=
"http://www.springframework.org/schema/beans"
xmlns:context=
"http://www.springframework.org/schema/context"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc=
"http://www.springframework.org/schema/mvc"
xmlns:task=
"http://www.springframework.org/schema/task"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-3.0.xsd"
>
<context:component-scan
base-package=
"org.apache.skywalking.apm.testcase.*"
/>
<context:annotation-config/>
<mvc:annotation-driven/>
<task:annotation-driven/>
</beans>
\ No newline at end of file
test/plugin/scenarios/spring-scheduled-scenario/src/main/webapp/WEB-INF/web.xml
0 → 100644
浏览文件 @
1b54b61a
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You 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.
~
-->
<web-app
xmlns=
"http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version=
"3.1"
>
<display-name>
skywalking-spring-scheduled-scenario
</display-name>
<servlet>
<servlet-name>
spring-mvc
</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>
1
</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>
spring-mvc
</servlet-name>
<url-pattern>
/
</url-pattern>
</servlet-mapping>
</web-app>
test/plugin/scenarios/spring-scheduled-scenario/support-version.list
0 → 100644
浏览文件 @
1b54b61a
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version
# "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.
# lists your version here
3.1.4.RELEASE
3.2.18.RELEASE
4.0.9.RELEASE
4.1.9.RELEASE
4.2.9.RELEASE
4.3.28.RELEASE
5.0.18.RELEASE
5.1.17.RELEASE
5.2.8.RELEASE
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录