diff --git a/.github/workflows/plugins-test.0.yaml b/.github/workflows/plugins-test.0.yaml index 05d3372b7..8711bc15d 100644 --- a/.github/workflows/plugins-test.0.yaml +++ b/.github/workflows/plugins-test.0.yaml @@ -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: diff --git a/apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/pom.xml new file mode 100644 index 000000000..797d7fa3a --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/pom.xml @@ -0,0 +1,48 @@ + + + + + org.apache.skywalking + apm-sdk-plugin + 8.2.0-SNAPSHOT + + 4.0.0 + + apm-elastic-job-3.x-plugin + jar + + elastic-job-3.x-plugin + http://maven.apache.org + + + UTF-8 + 3.0.0-alpha + + + + + org.apache.shardingsphere.elasticjob + elasticjob-executor-kernel + ${elasticjob.version} + provided + + + diff --git a/apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticjob/ElasticJobExecutorInterceptor.java b/apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticjob/ElasticJobExecutorInterceptor.java new file mode 100644 index 000000000..da0accdca --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticjob/ElasticJobExecutorInterceptor.java @@ -0,0 +1,59 @@ +/* + * 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); + } +} diff --git a/apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticjob/define/ElasticJobExecutorInstrumentation.java b/apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticjob/define/ElasticJobExecutorInstrumentation.java new file mode 100644 index 000000000..eb45bf39f --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/elasticjob/define/ElasticJobExecutorInstrumentation.java @@ -0,0 +1,74 @@ +/* + * 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 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); + } +} diff --git a/apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/src/main/resources/skywalking-plugin.def new file mode 100644 index 000000000..d01c8db51 --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/elastic-job-3.x-plugin/src/main/resources/skywalking-plugin.def @@ -0,0 +1,17 @@ +# 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 diff --git a/apm-sniffer/apm-sdk-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/pom.xml index 4d72b1a19..1efd8d9ca 100644 --- a/apm-sniffer/apm-sdk-plugin/pom.xml +++ b/apm-sniffer/apm-sdk-plugin/pom.xml @@ -60,6 +60,7 @@ rocketMQ-3.x-plugin rocketMQ-4.x-plugin elastic-job-2.x-plugin + elastic-job-3.x-plugin mongodb-2.x-plugin httpasyncclient-4.x-plugin kafka-plugin diff --git a/docs/en/setup/service-agent/java-agent/Supported-list.md b/docs/en/setup/service-agent/java-agent/Supported-list.md index 38dded247..7c668e565 100644 --- a/docs/en/setup/service-agent/java-agent/Supported-list.md +++ b/docs/en/setup/service-agent/java-agent/Supported-list.md @@ -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 diff --git a/test/plugin/scenarios/elasticjob-3.x-scenario/bin/startup.sh b/test/plugin/scenarios/elasticjob-3.x-scenario/bin/startup.sh new file mode 100644 index 000000000..4bdd22750 --- /dev/null +++ b/test/plugin/scenarios/elasticjob-3.x-scenario/bin/startup.sh @@ -0,0 +1,21 @@ +#!/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 diff --git a/test/plugin/scenarios/elasticjob-3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/elasticjob-3.x-scenario/config/expectedData.yaml new file mode 100644 index 000000000..29886337b --- /dev/null +++ b/test/plugin/scenarios/elasticjob-3.x-scenario/config/expectedData.yaml @@ -0,0 +1,53 @@ +# 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 diff --git a/test/plugin/scenarios/elasticjob-3.x-scenario/configuration.yml b/test/plugin/scenarios/elasticjob-3.x-scenario/configuration.yml new file mode 100644 index 000000000..d584e5409 --- /dev/null +++ b/test/plugin/scenarios/elasticjob-3.x-scenario/configuration.yml @@ -0,0 +1,28 @@ +# 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 diff --git a/test/plugin/scenarios/elasticjob-3.x-scenario/pom.xml b/test/plugin/scenarios/elasticjob-3.x-scenario/pom.xml new file mode 100644 index 000000000..1184b2574 --- /dev/null +++ b/test/plugin/scenarios/elasticjob-3.x-scenario/pom.xml @@ -0,0 +1,137 @@ + + + + + org.apache.skywalking.apm.testcase + elasticjob-3.x-scenario + 1.0.0 + jar + + 4.0.0 + + + UTF-8 + 1.8 + + 3.0.0-alpha + ${test.framework.version} + + 2.1.6.RELEASE + 1.4.184 + 3.0.0 + + + skywalking-elasticjob-3.x-scenario + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot-version} + pom + import + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + + + + org.springframework.boot + spring-boot-starter-log4j2 + + + + org.springframework.boot + spring-boot-starter-jdbc + ${spring-boot-version} + + + com.h2database + h2 + ${h2-version} + + + org.apache.shardingsphere.elasticjob + elasticjob-lite-spring-boot-starter + ${test.framework.version} + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + + + elasticjob-3.x-scenario + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + maven-compiler-plugin + + ${compiler.version} + ${compiler.version} + ${project.build.sourceEncoding} + + + + org.apache.maven.plugins + maven-assembly-plugin + + + assemble + package + + single + + + + src/main/assembly/assembly.xml + + ./target/ + + + + + + + \ No newline at end of file diff --git a/test/plugin/scenarios/elasticjob-3.x-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/elasticjob-3.x-scenario/src/main/assembly/assembly.xml new file mode 100644 index 000000000..eb64b1b88 --- /dev/null +++ b/test/plugin/scenarios/elasticjob-3.x-scenario/src/main/assembly/assembly.xml @@ -0,0 +1,41 @@ + + + + + zip + + + + + ./bin + 0775 + + + + + + ${project.build.directory}/elasticjob-3.x-scenario.jar + ./libs + 0775 + + + diff --git a/test/plugin/scenarios/elasticjob-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticjob/Application.java b/test/plugin/scenarios/elasticjob-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticjob/Application.java new file mode 100644 index 000000000..d8d0f9f42 --- /dev/null +++ b/test/plugin/scenarios/elasticjob-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticjob/Application.java @@ -0,0 +1,39 @@ +/* + * 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; + } + } +} diff --git a/test/plugin/scenarios/elasticjob-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticjob/controller/CaseController.java b/test/plugin/scenarios/elasticjob-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticjob/controller/CaseController.java new file mode 100644 index 000000000..929f7d1ba --- /dev/null +++ b/test/plugin/scenarios/elasticjob-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticjob/controller/CaseController.java @@ -0,0 +1,46 @@ +/* + * 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; + } +} diff --git a/test/plugin/scenarios/elasticjob-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticjob/job/DemoSimpleJob.java b/test/plugin/scenarios/elasticjob-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticjob/job/DemoSimpleJob.java new file mode 100644 index 000000000..af883b96e --- /dev/null +++ b/test/plugin/scenarios/elasticjob-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/elasticjob/job/DemoSimpleJob.java @@ -0,0 +1,52 @@ +/* + * 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(); + } +} diff --git a/test/plugin/scenarios/elasticjob-3.x-scenario/src/main/resources/application.yaml b/test/plugin/scenarios/elasticjob-3.x-scenario/src/main/resources/application.yaml new file mode 100644 index 000000000..18123adf2 --- /dev/null +++ b/test/plugin/scenarios/elasticjob-3.x-scenario/src/main/resources/application.yaml @@ -0,0 +1,34 @@ +# +# 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 diff --git a/test/plugin/scenarios/elasticjob-3.x-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/elasticjob-3.x-scenario/src/main/resources/log4j2.xml new file mode 100644 index 000000000..d74f8371e --- /dev/null +++ b/test/plugin/scenarios/elasticjob-3.x-scenario/src/main/resources/log4j2.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + diff --git a/test/plugin/scenarios/elasticjob-3.x-scenario/support-version.list b/test/plugin/scenarios/elasticjob-3.x-scenario/support-version.list new file mode 100644 index 000000000..73f97b18f --- /dev/null +++ b/test/plugin/scenarios/elasticjob-3.x-scenario/support-version.list @@ -0,0 +1,19 @@ +# 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