Upgrade agent plugin for ElasticJob 3.0.0 GA version (#7345)
* Upgrade agent plugin for ElasticJob 3.0.0 GA version. * Remove 3.0.0 alpha support.
This commit is contained in:
parent
383e32b44b
commit
da9426dd6e
|
|
@ -37,6 +37,7 @@ Release Notes.
|
|||
* Fix gateway plugin async finish repeatedly when fallback url configured.
|
||||
* Chore: polish methods naming for `Spring-Kafka` plugins.
|
||||
* Remove plugins for ShardingSphere legacy version.
|
||||
* Update agent plugin for ElasticJob GA version
|
||||
|
||||
#### OAP-Backend
|
||||
|
||||
|
|
|
|||
|
|
@ -24,15 +24,15 @@
|
|||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>apm-elastic-job-3.x-plugin</artifactId>
|
||||
<artifactId>apm-elasticjob-3.x-plugin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>elastic-job-3.x-plugin</name>
|
||||
<name>elasticjob-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>
|
||||
<elasticjob.version>3.0.0</elasticjob.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
|
@ -42,5 +42,11 @@
|
|||
<version>${elasticjob.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.shardingsphere.elasticjob</groupId>
|
||||
<artifactId>elasticjob-infra-common</artifactId>
|
||||
<version>${elasticjob.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
package org.apache.skywalking.apm.plugin.elasticjob;
|
||||
|
||||
import org.apache.shardingsphere.elasticjob.api.listener.ShardingContexts;
|
||||
import org.apache.shardingsphere.elasticjob.infra.listener.ShardingContexts;
|
||||
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;
|
||||
|
|
@ -32,22 +32,23 @@ 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];
|
||||
MethodInterceptResult result) {
|
||||
ShardingContexts shardingContexts = (ShardingContexts) allArguments[1];
|
||||
Integer item = (Integer) allArguments[2];
|
||||
String operateName = ComponentsDefine.ELASTIC_JOB.getName() + "/" + shardingContexts.getJobName();
|
||||
AbstractSpan span = ContextManager.createLocalSpan(operateName);
|
||||
span.setComponent(ComponentsDefine.ELASTIC_JOB);
|
||||
Tags.LOGIC_ENDPOINT.set(span, Tags.VAL_LOCAL_SPAN_AS_LOGIC_ENDPOINT);
|
||||
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());
|
||||
span.tag(Tags.ofKey("item"), item == null ? "" : String.valueOf(item));
|
||||
span.tag(Tags.ofKey("shardingTotalCount"), Integer.toString(shardingContexts.getShardingTotalCount()));
|
||||
span.tag(Tags.ofKey("taskId"), shardingContexts.getTaskId());
|
||||
span.tag(Tags.ofKey("shardingItemParameters"), shardingContexts.getShardingItemParameters() == null ?
|
||||
"" : shardingContexts.getShardingItemParameters().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
|
||||
Object ret) throws Throwable {
|
||||
Object ret) {
|
||||
ContextManager.stopSpan();
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -24,6 +24,7 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterc
|
|||
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 org.apache.skywalking.apm.plugin.elasticjob.ElasticJobExecutorInterceptor;
|
||||
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
||||
|
|
@ -34,8 +35,6 @@ public class ElasticJobExecutorInstrumentation extends ClassInstanceMethodsEnhan
|
|||
|
||||
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];
|
||||
|
|
@ -48,15 +47,16 @@ public class ElasticJobExecutorInstrumentation extends ClassInstanceMethodsEnhan
|
|||
|
||||
@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")));
|
||||
return named("process").and(takesArguments(4))
|
||||
.and(takesArgument(0, named("org.apache.shardingsphere.elasticjob.api.JobConfiguration")))
|
||||
.and(takesArgument(1, named("org.apache.shardingsphere.elasticjob.infra.listener.ShardingContexts")))
|
||||
.and(takesArgument(2, int.class))
|
||||
.and(takesArgument(3, named("org.apache.shardingsphere.elasticjob.tracing.event.JobExecutionEvent")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethodsInterceptor() {
|
||||
return JOB_EXECUTOR_INTERCEPTOR_CLASS;
|
||||
return ElasticJobExecutorInterceptor.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -14,4 +14,4 @@
|
|||
# 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
|
||||
elasticjob-3.x=org.apache.skywalking.apm.plugin.elasticjob.define.ElasticJobExecutorInstrumentation
|
||||
|
|
@ -61,7 +61,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>elasticjob-3.x-plugin</module>
|
||||
<module>mongodb-2.x-plugin</module>
|
||||
<module>httpasyncclient-4.x-plugin</module>
|
||||
<module>kafka-commons</module>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
- dubbo
|
||||
- ehcache-2.x
|
||||
- elastic-job-2.x
|
||||
- elastic-job-3.x
|
||||
- elasticjob-3.x
|
||||
- elasticsearch-5.x
|
||||
- elasticsearch-6.x
|
||||
- elasticsearch-7.x
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ metrics based on the tracing data.
|
|||
* [Sentinel: The Sentinel of Your Microservices](https://github.com/alibaba/Sentinel) 1.7.0 -> 1.8.1
|
||||
* Scheduler
|
||||
* [Elastic Job](https://github.com/elasticjob/elastic-job) 2.x
|
||||
* [Apache ShardingSphere-Elasticjob](https://github.com/apache/shardingsphere-elasticjob) 3.0.0-alpha
|
||||
* [Apache ShardingSphere-Elasticjob](https://github.com/apache/shardingsphere-elasticjob) 3.x
|
||||
* [Spring @Scheduled](https://github.com/spring-projects/spring-framework) 3.1+
|
||||
* [Quartz Scheduler](https://github.com/quartz-scheduler/quartz) 2.x (Optional²)
|
||||
* [XXL Job](https://github.com/xuxueli/xxl-job) 2.x
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<compiler.version>1.8</compiler.version>
|
||||
|
||||
<test.framework.version>3.0.0-alpha</test.framework.version>
|
||||
<test.framework.version>3.0.0</test.framework.version>
|
||||
<docker.image.version>${test.framework.version}</docker.image.version>
|
||||
|
||||
<spring-boot-version>2.1.6.RELEASE</spring-boot-version>
|
||||
|
|
@ -134,4 +134,4 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -14,4 +14,4 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
3.0.0-alpha
|
||||
3.0.0
|
||||
|
|
|
|||
Loading…
Reference in New Issue