Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
月轩居士
SkyWalking
提交
69297b9e
S
SkyWalking
项目概览
月轩居士
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
69297b9e
编写于
8月 10, 2020
作者:
于
于玉桔
提交者:
GitHub
8月 10, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support Apache ShardingSphere-Elasticjob (#5153)
上级
b1305ba0
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
701 addition
and
0 deletion
+701
-0
.github/workflows/plugins-test.0.yaml
.github/workflows/plugins-test.0.yaml
+1
-0
apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/pom.xml
+48
-0
apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticjob/ElasticJobExecutorInterceptor.java
.../apm/plugin/elasticjob/ElasticJobExecutorInterceptor.java
+59
-0
apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticjob/define/ElasticJobExecutorInstrumentation.java
.../elasticjob/define/ElasticJobExecutorInstrumentation.java
+74
-0
apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/src/main/resources/skywalking-plugin.def
...c-job-3.x-plugin/src/main/resources/skywalking-plugin.def
+17
-0
apm-sniffer/apm-sdk-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/pom.xml
+1
-0
docs/en/setup/service-agent/java-agent/Supported-list.md
docs/en/setup/service-agent/java-agent/Supported-list.md
+1
-0
test/plugin/scenarios/elasticjob-3.x-scenario/bin/startup.sh
test/plugin/scenarios/elasticjob-3.x-scenario/bin/startup.sh
+21
-0
test/plugin/scenarios/elasticjob-3.x-scenario/config/expectedData.yaml
...cenarios/elasticjob-3.x-scenario/config/expectedData.yaml
+53
-0
test/plugin/scenarios/elasticjob-3.x-scenario/configuration.yml
...lugin/scenarios/elasticjob-3.x-scenario/configuration.yml
+28
-0
test/plugin/scenarios/elasticjob-3.x-scenario/pom.xml
test/plugin/scenarios/elasticjob-3.x-scenario/pom.xml
+137
-0
test/plugin/scenarios/elasticjob-3.x-scenario/src/main/assembly/assembly.xml
...os/elasticjob-3.x-scenario/src/main/assembly/assembly.xml
+41
-0
test/plugin/scenarios/elasticjob-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticjob/Application.java
...pache/skywalking/apm/testcase/elasticjob/Application.java
+39
-0
test/plugin/scenarios/elasticjob-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticjob/controller/CaseController.java
...ng/apm/testcase/elasticjob/controller/CaseController.java
+46
-0
test/plugin/scenarios/elasticjob-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticjob/job/DemoSimpleJob.java
...skywalking/apm/testcase/elasticjob/job/DemoSimpleJob.java
+52
-0
test/plugin/scenarios/elasticjob-3.x-scenario/src/main/resources/application.yaml
...asticjob-3.x-scenario/src/main/resources/application.yaml
+34
-0
test/plugin/scenarios/elasticjob-3.x-scenario/src/main/resources/log4j2.xml
...ios/elasticjob-3.x-scenario/src/main/resources/log4j2.xml
+30
-0
test/plugin/scenarios/elasticjob-3.x-scenario/support-version.list
...in/scenarios/elasticjob-3.x-scenario/support-version.list
+19
-0
未找到文件。
.github/workflows/plugins-test.0.yaml
浏览文件 @
69297b9e
...
...
@@ -55,6 +55,7 @@ jobs:
-
{
name
:
'
gateway-2.0.x-scenario'
,
title
:
'
Spring-Cloud-Gateway
2.0.x
(3)'
}
-
{
name
:
'
grpc-scenario'
,
title
:
'
gRPC
1.6.0-1.25.0
(22)'
}
-
{
name
:
'
gson-scenario'
,
title
:
'
Gson
(7)'
}
-
{
name
:
'
elasticjob-3.x-scenario'
,
title
:
'
elasticjob-3.x-scenario
(1)'
}
steps
:
-
uses
:
actions/checkout@v2
with
:
...
...
apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/pom.xml
0 → 100644
浏览文件 @
69297b9e
<?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"
>
<parent>
<groupId>
org.apache.skywalking
</groupId>
<artifactId>
apm-sdk-plugin
</artifactId>
<version>
8.2.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apm-elastic-job-3.x-plugin
</artifactId>
<packaging>
jar
</packaging>
<name>
elastic-job-3.x-plugin
</name>
<url>
http://maven.apache.org
</url>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<elasticjob.version>
3.0.0-alpha
</elasticjob.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.apache.shardingsphere.elasticjob
</groupId>
<artifactId>
elasticjob-executor-kernel
</artifactId>
<version>
${elasticjob.version}
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
</project>
apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticjob/ElasticJobExecutorInterceptor.java
0 → 100644
浏览文件 @
69297b9e
/*
* 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.elasticjob
;
import
org.apache.shardingsphere.elasticjob.api.listener.ShardingContexts
;
import
org.apache.skywalking.apm.agent.core.context.ContextCarrier
;
import
org.apache.skywalking.apm.agent.core.context.ContextManager
;
import
org.apache.skywalking.apm.agent.core.context.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
;
public
class
ElasticJobExecutorInterceptor
implements
InstanceMethodsAroundInterceptor
{
@Override
public
void
beforeMethod
(
EnhancedInstance
objInst
,
Method
method
,
Object
[]
allArguments
,
Class
<?>[]
argumentsTypes
,
MethodInterceptResult
result
)
throws
Throwable
{
ShardingContexts
shardingContexts
=
(
ShardingContexts
)
allArguments
[
0
];
Integer
item
=
(
Integer
)
allArguments
[
1
];
String
operateName
=
ComponentsDefine
.
ELASTIC_JOB
.
getName
()
+
"/"
+
shardingContexts
.
getJobName
();
AbstractSpan
span
=
ContextManager
.
createEntrySpan
(
operateName
,
new
ContextCarrier
());
span
.
setComponent
(
ComponentsDefine
.
ELASTIC_JOB
);
span
.
tag
(
"item"
,
item
==
null
?
""
:
String
.
valueOf
(
item
));
span
.
tag
(
"shardingTotalCount"
,
Integer
.
toString
(
shardingContexts
.
getShardingTotalCount
()));
span
.
tag
(
"taskId"
,
shardingContexts
.
getTaskId
());
span
.
tag
(
"shardingItemParameters"
,
shardingContexts
.
getShardingItemParameters
()
==
null
?
""
:
shardingContexts
.
getShardingItemParameters
().
toString
());
}
@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/elastic-job-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticjob/define/ElasticJobExecutorInstrumentation.java
0 → 100644
浏览文件 @
69297b9e
/*
* 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.elasticjob.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
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
;
public
class
ElasticJobExecutorInstrumentation
extends
ClassInstanceMethodsEnhancePluginDefine
{
private
static
final
String
ENHANCE_CLASS
=
"org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor"
;
private
static
final
String
JOB_EXECUTOR_INTERCEPTOR_CLASS
=
"org.apache.skywalking.apm.plugin.elasticjob.ElasticJobExecutorInterceptor"
;
@Override
public
ConstructorInterceptPoint
[]
getConstructorsInterceptPoints
()
{
return
new
ConstructorInterceptPoint
[
0
];
}
@Override
public
InstanceMethodsInterceptPoint
[]
getInstanceMethodsInterceptPoints
()
{
return
new
InstanceMethodsInterceptPoint
[]{
new
InstanceMethodsInterceptPoint
()
{
@Override
public
ElementMatcher
<
MethodDescription
>
getMethodsMatcher
()
{
return
named
(
"process"
).
and
(
takesArguments
(
3
))
.
and
(
takesArgument
(
0
,
named
(
"org.apache.shardingsphere.elasticjob.api.listener.ShardingContexts"
)))
.
and
(
takesArgument
(
1
,
int
.
class
))
.
and
(
takesArgument
(
2
,
named
(
"org.apache.shardingsphere.elasticjob.tracing.event.JobExecutionEvent"
)));
}
@Override
public
String
getMethodsInterceptor
()
{
return
JOB_EXECUTOR_INTERCEPTOR_CLASS
;
}
@Override
public
boolean
isOverrideArgs
()
{
return
false
;
}
}
};
}
@Override
protected
ClassMatch
enhanceClass
()
{
return
byName
(
ENHANCE_CLASS
);
}
}
apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/src/main/resources/skywalking-plugin.def
0 → 100644
浏览文件 @
69297b9e
# 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.
elastic-job-3.x=org.apache.skywalking.apm.plugin.elasticjob.define.ElasticJobExecutorInstrumentation
apm-sniffer/apm-sdk-plugin/pom.xml
浏览文件 @
69297b9e
...
...
@@ -60,6 +60,7 @@
<module>
rocketMQ-3.x-plugin
</module>
<module>
rocketMQ-4.x-plugin
</module>
<module>
elastic-job-2.x-plugin
</module>
<module>
elastic-job-3.x-plugin
</module>
<module>
mongodb-2.x-plugin
</module>
<module>
httpasyncclient-4.x-plugin
</module>
<module>
kafka-plugin
</module>
...
...
docs/en/setup/service-agent/java-agent/Supported-list.md
浏览文件 @
69297b9e
...
...
@@ -83,6 +83,7 @@
*
[
Hystrix: Latency and Fault Tolerance for Distributed Systems
](
https://github.com/Netflix/Hystrix
)
1.4.20 -> 1.5.12
*
Scheduler
*
[
Elastic Job
](
https://github.com/elasticjob/elastic-job
)
2.x
*
[
Apache ShardingSphere-Elasticjob
](
https://github.com/apache/shardingsphere-elasticjob
)
3.0.0-alpha
*
OpenTracing community supported
*
[
Canal: Alibaba mysql database binlog incremental subscription & consumer components
](
https://github.com/alibaba/canal
)
1.0.25 -> 1.1.2
*
JSON
...
...
test/plugin/scenarios/elasticjob-3.x-scenario/bin/startup.sh
0 → 100644
浏览文件 @
69297b9e
#!/bin/bash
#
# 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.
home
=
"
$(
cd
"
$(
dirname
$0
)
"
;
pwd
)
"
java
-Dzookeeper
.host
=
${
ZK_ADDRESS
}
-jar
${
agent_opts
}
-Dco
.paralleluniverse.fibers.detectRunawayFibers
=
false
${
home
}
/../libs/elasticjob-3.x-scenario.jar &
\ No newline at end of file
test/plugin/scenarios/elasticjob-3.x-scenario/config/expectedData.yaml
0 → 100644
浏览文件 @
69297b9e
# 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
:
elasticjob-3.x-scenario
segmentSize
:
ge
2
segments
:
-
segmentId
:
not
null
spans
:
-
operationName
:
/elasticjob-3.x-scenario/case/ping
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/elasticjob-3.x-scenario/case/ping'
}
-
operationName
:
ElasticJob/simpleJob
operationId
:
0
parentSpanId
:
-1
spanId
:
0
spanLayer
:
Unknown
startTime
:
not
null
endTime
:
not
null
componentId
:
24
isError
:
false
spanType
:
Entry
peer
:
'
'
skipAnalysis
:
false
tags
:
-
{
key
:
item
,
value
:
'
0'
}
-
{
key
:
shardingTotalCount
,
value
:
'
1'
}
-
{
key
:
taskId
,
value
:
not null
}
-
{
key
:
shardingItemParameters
,
value
:
'
{0=Beijing}'
}
\ No newline at end of file
test/plugin/scenarios/elasticjob-3.x-scenario/configuration.yml
0 → 100644
浏览文件 @
69297b9e
# 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
:
jvm
entryService
:
http://localhost:8080/elasticjob-3.x-scenario/case/healthCheck
healthCheck
:
http://localhost:8080/elasticjob-3.x-scenario/case/healthCheck
startScript
:
./bin/startup.sh
environment
:
-
ZK_ADDRESS=zk-server:2181
depends_on
:
-
zk-server
dependencies
:
zk-server
:
image
:
zookeeper:3.6.0
hostname
:
zk-server
test/plugin/scenarios/elasticjob-3.x-scenario/pom.xml
0 → 100644
浏览文件 @
69297b9e
<?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>
elasticjob-3.x-scenario
</artifactId>
<version>
1.0.0
</version>
<packaging>
jar
</packaging>
<modelVersion>
4.0.0
</modelVersion>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<compiler.version>
1.8
</compiler.version>
<test.framework.version>
3.0.0-alpha
</test.framework.version>
<docker.image.version>
${test.framework.version}
</docker.image.version>
<spring-boot-version>
2.1.6.RELEASE
</spring-boot-version>
<h2-version>
1.4.184
</h2-version>
<okhttp-version>
3.0.0
</okhttp-version>
</properties>
<name>
skywalking-elasticjob-3.x-scenario
</name>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-dependencies
</artifactId>
<version>
${spring-boot-version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<exclusions>
<exclusion>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-logging
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-log4j2
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-jdbc
</artifactId>
<version>
${spring-boot-version}
</version>
</dependency>
<dependency>
<groupId>
com.h2database
</groupId>
<artifactId>
h2
</artifactId>
<version>
${h2-version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.shardingsphere.elasticjob
</groupId>
<artifactId>
elasticjob-lite-spring-boot-starter
</artifactId>
<version>
${test.framework.version}
</version>
</dependency>
<dependency>
<groupId>
com.squareup.okhttp3
</groupId>
<artifactId>
okhttp
</artifactId>
<version>
${okhttp-version}
</version>
</dependency>
</dependencies>
<build>
<finalName>
elasticjob-3.x-scenario
</finalName>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
<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.maven.plugins
</groupId>
<artifactId>
maven-assembly-plugin
</artifactId>
<executions>
<execution>
<id>
assemble
</id>
<phase>
package
</phase>
<goals>
<goal>
single
</goal>
</goals>
<configuration>
<descriptors>
<descriptor>
src/main/assembly/assembly.xml
</descriptor>
</descriptors>
<outputDirectory>
./target/
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
test/plugin/scenarios/elasticjob-3.x-scenario/src/main/assembly/assembly.xml
0 → 100644
浏览文件 @
69297b9e
<?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.
~
-->
<assembly
xmlns=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"
>
<formats>
<format>
zip
</format>
</formats>
<fileSets>
<fileSet>
<directory>
./bin
</directory>
<fileMode>
0775
</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>
${project.build.directory}/elasticjob-3.x-scenario.jar
</source>
<outputDirectory>
./libs
</outputDirectory>
<fileMode>
0775
</fileMode>
</file>
</files>
</assembly>
test/plugin/scenarios/elasticjob-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticjob/Application.java
0 → 100644
浏览文件 @
69297b9e
/*
* 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.elasticjob
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
public
class
Application
{
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
Application
.
class
);
public
static
void
main
(
String
[]
args
)
{
try
{
SpringApplication
.
run
(
Application
.
class
,
args
);
}
catch
(
Exception
ex
)
{
logger
.
error
(
"Application start error"
,
ex
);
throw
ex
;
}
}
}
test/plugin/scenarios/elasticjob-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticjob/controller/CaseController.java
0 → 100644
浏览文件 @
69297b9e
/*
* 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.elasticjob.controller
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@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
()
throws
Exception
{
return
SUCCESS
;
}
@RequestMapping
(
"/ping"
)
@ResponseBody
public
String
ping
()
throws
Exception
{
return
SUCCESS
;
}
}
test/plugin/scenarios/elasticjob-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticjob/job/DemoSimpleJob.java
0 → 100644
浏览文件 @
69297b9e
/*
* 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.elasticjob.job
;
import
okhttp3.OkHttpClient
;
import
okhttp3.Request
;
import
okhttp3.Response
;
import
org.apache.shardingsphere.elasticjob.api.ShardingContext
;
import
org.apache.shardingsphere.elasticjob.simple.job.SimpleJob
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Component
;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
@Component
public
class
DemoSimpleJob
implements
SimpleJob
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
DemoSimpleJob
.
class
);
OkHttpClient
client
=
new
OkHttpClient
.
Builder
().
build
();
@Override
public
void
execute
(
ShardingContext
shardingContext
)
{
logger
.
info
(
"Elastic Job Item: {} | Time: {} | Thread: {} | {}"
,
shardingContext
.
getShardingItem
(),
new
SimpleDateFormat
(
"HH:mm:ss"
).
format
(
new
Date
()),
Thread
.
currentThread
().
getId
(),
"SIMPLE"
);
Request
request
=
new
Request
.
Builder
().
url
(
"http://localhost:8080/elasticjob-3.x-scenario/case/ping"
).
build
();
Response
response
=
null
;
try
{
response
=
client
.
newCall
(
request
).
execute
();
}
catch
(
IOException
e
)
{
}
response
.
body
().
close
();
}
}
test/plugin/scenarios/elasticjob-3.x-scenario/src/main/resources/application.yaml
0 → 100644
浏览文件 @
69297b9e
#
# 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.
#
#
server
:
port
:
8080
servlet
:
context-path
:
/elasticjob-3.x-scenario
logging
:
config
:
classpath:log4j2.xml
elasticjob
:
regCenter
:
serverLists
:
${zookeeper.host}
namespace
:
elasticjob-lite-springboot
jobs
:
simpleJob
:
elasticJobClass
:
org.apache.skywalking.apm.testcase.elasticjob.job.DemoSimpleJob
cron
:
0/5 * * * * ?
shardingTotalCount
:
1
shardingItemParameters
:
0=Beijing
test/plugin/scenarios/elasticjob-3.x-scenario/src/main/resources/log4j2.xml
0 → 100644
浏览文件 @
69297b9e
<?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>
test/plugin/scenarios/elasticjob-3.x-scenario/support-version.list
0 → 100644
浏览文件 @
69297b9e
# 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.0.0-alpha
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录