新增针对方法修饰符和方法参数的埋点方法

This commit is contained in:
ascrutae 2016-06-08 15:13:58 +08:00
parent 6ad8cb4aa7
commit f548b014d8
24 changed files with 415 additions and 198 deletions

View File

@ -116,11 +116,11 @@ public class EnhanceClazz4Interceptor {
FieldGetter.class,
FieldSetter.class))));
MethodNameMatcher[] methodMatchers = define.getBeInterceptedMethodsMatchers();
MethodMatcher[] methodMatchers = define.getBeInterceptedMethodsMatchers();
ClassMethodInterceptor classMethodInterceptor = new ClassMethodInterceptor(
interceptor);
for (MethodNameMatcher methodMatcher : methodMatchers) {
for (MethodMatcher methodMatcher : methodMatchers) {
logger.debug("prepare to enhance class {} method [{}] ",
enhanceOriginClassName, methodMatcher.getMethodMatchDescribe());
newClassBuilder = newClassBuilder.method(

View File

@ -13,7 +13,7 @@ public interface InterceptorDefine {
*
* @return
*/
public MethodNameMatcher[] getBeInterceptedMethodsMatchers();
public MethodMatcher[] getBeInterceptedMethodsMatchers();
/**
* 返回增强拦截器的实现<br/>

View File

@ -0,0 +1,93 @@
package com.ai.cloud.skywalking.plugin.interceptor;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import static net.bytebuddy.matcher.ElementMatchers.*;
public abstract class MethodMatcher {
private String methodMatchDescribe;
private int argNum = -1;
private Class<?>[] argTypeArray;
private Modifier modifier;
public MethodMatcher(String methodMatchDescribe) {
this(null, methodMatchDescribe);
}
public MethodMatcher(Modifier modifier, String methodMatchDescribe) {
this.methodMatchDescribe = methodMatchDescribe;
this.modifier = modifier;
}
public MethodMatcher(String methodMatchDescribe, int argNum) {
this(null, methodMatchDescribe, argNum);
}
public MethodMatcher(Modifier modifier, String methodMatchDescribe, int argNum) {
this.methodMatchDescribe = methodMatchDescribe;
this.argNum = argNum;
this.modifier = modifier;
}
public MethodMatcher(String methodMatchDescribe, Class<?>[] argTypeArray) {
this(null, methodMatchDescribe, argTypeArray);
}
public MethodMatcher(Modifier modifier, String methodMatchDescribe, Class<?>[] argTypeArray) {
this.argTypeArray = argTypeArray;
this.methodMatchDescribe = methodMatchDescribe;
this.modifier = modifier;
}
public abstract ElementMatcher.Junction<MethodDescription> builderMatcher();
protected String getMethodMatchDescribe() {
return methodMatchDescribe;
}
protected ElementMatcher.Junction<MethodDescription> mergeArgumentsIfNecessary(ElementMatcher.Junction<MethodDescription> matcher) {
if (argTypeArray != null) {
matcher = matcher.and(takesArguments(argTypeArray));
}
if (argNum > -1) {
matcher = matcher.and(takesArguments(argNum));
}
if (modifier != null) {
matcher = matcher.and(modifier.elementMatcher());
}
return matcher;
}
public enum Modifier {
Public, Default, Private, Protected;
private ElementMatcher elementMatcher() {
switch (this) {
case Private: {
return isPrivate();
}
case Default: {
return isPackagePrivate();
}
case Public: {
return isPublic();
}
case Protected: {
return isProtected();
}
default:
return isPublic();
}
}
}
}

View File

@ -1,41 +0,0 @@
package com.ai.cloud.skywalking.plugin.interceptor;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
public abstract class MethodNameMatcher {
private String methodMatchDescribe;
private int argNum = -1;
private Class<?>[] argTypeArray;
public MethodNameMatcher(String methodMatchDescribe) {
this.methodMatchDescribe = methodMatchDescribe;
}
public MethodNameMatcher(String methodMatchDescribe, int argNum) {
this.methodMatchDescribe = methodMatchDescribe;
this.argNum = argNum;
}
public MethodNameMatcher(String methodMatchDescribe, Class<?>[] argTypeArray) {
this.argTypeArray = argTypeArray;
this.methodMatchDescribe = methodMatchDescribe;
}
public abstract ElementMatcher<MethodDescription> builderMatcher();
protected String getMethodMatchDescribe() {
return methodMatchDescribe;
}
protected int getArgNum() {
return argNum;
}
protected Class<?>[] getArgTypeArray() {
return argTypeArray;
}
}

View File

@ -1,19 +1,19 @@
package com.ai.cloud.skywalking.plugin.interceptor.matcher;
import static net.bytebuddy.matcher.ElementMatchers.any;
import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
import static net.bytebuddy.matcher.ElementMatchers.any;
public class AnyMethodMatcher extends MethodNameMatcher {
public class AnyMethodMatcher extends MethodMatcher {
public AnyMethodMatcher() {
super("*");
}
@Override
public ElementMatcher<MethodDescription> builderMatcher() {
public ElementMatcher.Junction<MethodDescription> builderMatcher() {
return any();
}
}

View File

@ -1,39 +0,0 @@
package com.ai.cloud.skywalking.plugin.interceptor.matcher;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.not;
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
public class ExclusionNameMatcher extends MethodNameMatcher {
public ExclusionNameMatcher(String methodMatchDescribe) {
super(methodMatchDescribe);
}
public ExclusionNameMatcher(String methodMatchDescribe, int argNum) {
super(methodMatchDescribe, argNum);
}
public ExclusionNameMatcher(String methodMatchDescribe, Class<?>[] argTypeArray) {
super(methodMatchDescribe, argTypeArray);
}
@Override
public ElementMatcher<MethodDescription> builderMatcher() {
ElementMatcher.Junction<MethodDescription> matcher = not(named(getMethodMatchDescribe()));
if (getArgTypeArray() != null) {
matcher.and(takesArguments(getArgTypeArray()));
}
if (getArgNum() > -1) {
matcher.and(takesArguments(getArgNum()));
}
return matcher;
}
}

View File

@ -1,38 +0,0 @@
package com.ai.cloud.skywalking.plugin.interceptor.matcher;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
public class FullNameMatcher extends MethodNameMatcher {
public FullNameMatcher(String methodName) {
super(methodName);
}
public FullNameMatcher(String methodName, int argNum) {
super(methodName, argNum);
}
public FullNameMatcher(String methodName, Class<?>... args) {
super(methodName, args);
}
@Override
public ElementMatcher<MethodDescription> builderMatcher() {
ElementMatcher.Junction<MethodDescription> matcher = named(getMethodMatchDescribe());
if (getArgTypeArray() != null) {
matcher.and(takesArguments(getArgTypeArray()));
}
if (getArgNum() > -1) {
matcher.and(takesArguments(getArgNum()));
}
return matcher;
}
}

View File

@ -0,0 +1,41 @@
package com.ai.cloud.skywalking.plugin.interceptor.matcher;
import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.not;
public class MethodExclusiveMatcher extends MethodMatcher {
public MethodExclusiveMatcher(String methodMatchDescribe) {
super(methodMatchDescribe);
}
public MethodExclusiveMatcher(String methodMatchDescribe, int argNum) {
super(methodMatchDescribe, argNum);
}
public MethodExclusiveMatcher(String methodMatchDescribe, Class<?>[] argTypeArray) {
super(methodMatchDescribe, argTypeArray);
}
public MethodExclusiveMatcher(Modifier modifier, String methodMatchDescribe) {
super(modifier, methodMatchDescribe);
}
public MethodExclusiveMatcher(Modifier modifier, String methodMatchDescribe, int argNum) {
super(modifier, methodMatchDescribe, argNum);
}
public MethodExclusiveMatcher(Modifier modifier, String methodMatchDescribe, Class<?>[] argTypeArray) {
super(modifier, methodMatchDescribe, argTypeArray);
}
@Override
public ElementMatcher.Junction<MethodDescription> builderMatcher() {
ElementMatcher.Junction<MethodDescription> matcher = named(getMethodMatchDescribe());
return not(mergeArgumentsIfNecessary(matcher));
}
}

View File

@ -0,0 +1,41 @@
package com.ai.cloud.skywalking.plugin.interceptor.matcher;
import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import static net.bytebuddy.matcher.ElementMatchers.nameMatches;
public class MethodRegexMatcher extends MethodMatcher {
public MethodRegexMatcher(String methodMatchDescribe) {
super(methodMatchDescribe);
}
public MethodRegexMatcher(String methodMatchDescribe, int argNum) {
super(methodMatchDescribe, argNum);
}
public MethodRegexMatcher(String methodMatchDescribe, Class<?>[] argTypeArray) {
super(methodMatchDescribe, argTypeArray);
}
public MethodRegexMatcher(Modifier modifier, String methodMatchDescribe) {
super(modifier, methodMatchDescribe);
}
public MethodRegexMatcher(Modifier modifier, String methodMatchDescribe, int argNum) {
super(modifier, methodMatchDescribe, argNum);
}
public MethodRegexMatcher(Modifier modifier, String methodMatchDescribe, Class<?>[] argTypeArray) {
super(modifier, methodMatchDescribe, argTypeArray);
}
@Override
public ElementMatcher.Junction<MethodDescription> builderMatcher() {
ElementMatcher.Junction<MethodDescription> matcher = nameMatches(getMethodMatchDescribe());
return mergeArgumentsIfNecessary(matcher);
}
}

View File

@ -0,0 +1,49 @@
package com.ai.cloud.skywalking.plugin.interceptor.matcher;
import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static net.bytebuddy.matcher.ElementMatchers.not;
/**
* Created by xin on 16-6-8.
*/
public class MethodsExclusiveMatcher extends MethodMatcher {
private List<MethodMatcher> matchers = new ArrayList<MethodMatcher>();
public MethodsExclusiveMatcher(String... methodNames) {
super("Exclusive method name: " + methodNames.toString());
for (String methodName : methodNames) {
matchers.add(new SimpleMethodMatcher(methodName));
}
}
public MethodsExclusiveMatcher(MethodMatcher... matchers) {
super("Exclusive methods description :" + matchers.toString());
this.matchers.addAll(Arrays.asList(matchers));
}
@Override
public ElementMatcher.Junction<MethodDescription> builderMatcher() {
ElementMatcher.Junction<MethodDescription> result = null;
for (MethodMatcher matcher : matchers) {
if (result == null) {
result = matcher.builderMatcher();
continue;
}
result = result.or(matcher.builderMatcher());
}
return not(result);
}
}

View File

@ -1,38 +0,0 @@
package com.ai.cloud.skywalking.plugin.interceptor.matcher;
import static net.bytebuddy.matcher.ElementMatchers.nameMatches;
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
public class RegexNameMatcher extends MethodNameMatcher {
public RegexNameMatcher(String methodMatchDescribe) {
super(methodMatchDescribe);
}
public RegexNameMatcher(String methodMatchDescribe, int argNum) {
super(methodMatchDescribe, argNum);
}
public RegexNameMatcher(String methodMatchDescribe, Class<?>[] argTypeArray) {
super(methodMatchDescribe, argTypeArray);
}
@Override
public ElementMatcher<MethodDescription> builderMatcher() {
ElementMatcher.Junction<MethodDescription> matcher = nameMatches(getMethodMatchDescribe());
if (getArgTypeArray() != null) {
matcher.and(takesArguments(getArgTypeArray()));
}
if (getArgNum() > -1) {
matcher.and(takesArguments(getArgNum()));
}
return matcher;
}
}

View File

@ -0,0 +1,41 @@
package com.ai.cloud.skywalking.plugin.interceptor.matcher;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
import static net.bytebuddy.matcher.ElementMatchers.named;
public class SimpleMethodMatcher extends com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher {
public SimpleMethodMatcher(String methodName) {
super(methodName);
}
public SimpleMethodMatcher(String methodName, int argNum) {
super(methodName, argNum);
}
public SimpleMethodMatcher(String methodName, Class<?>... args) {
super(methodName, args);
}
public SimpleMethodMatcher(Modifier modifier, String methodMatchDescribe) {
super(modifier, methodMatchDescribe);
}
public SimpleMethodMatcher(Modifier modifier, String methodMatchDescribe, int argNum) {
super(modifier, methodMatchDescribe, argNum);
}
public SimpleMethodMatcher(Modifier modifier, String methodMatchDescribe, Class<?>[] argTypeArray) {
super(modifier, methodMatchDescribe, argTypeArray);
}
@Override
public ElementMatcher.Junction<MethodDescription> builderMatcher() {
ElementMatcher.Junction<MethodDescription> matcher = named(getMethodMatchDescribe());
return mergeArgumentsIfNecessary(matcher);
}
}

View File

@ -0,0 +1,18 @@
package test.ai.cloud.matcher;
import com.ai.cloud.skywalking.plugin.PluginBootstrap;
public class ExclusionMatcherTest {
public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
new PluginBootstrap().start();
TestMatcherClass testMatcherClass = (TestMatcherClass) Class.forName("test.ai.cloud.matcher.TestMatcherClass").newInstance();
testMatcherClass.set();
testMatcherClass.seta("a");
testMatcherClass.get("a");
testMatcherClass.find();
}
}

View File

@ -0,0 +1,32 @@
package test.ai.cloud.matcher;
import com.ai.cloud.skywalking.plugin.interceptor.ConstructorInvokeContext;
import com.ai.cloud.skywalking.plugin.interceptor.EnhancedClassInstanceContext;
import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor;
import com.ai.cloud.skywalking.plugin.interceptor.MethodInvokeContext;
/**
* Created by xin on 16-6-8.
*/
public class TestAroundInterceptor implements IAroundInterceptor {
@Override
public void onConstruct(EnhancedClassInstanceContext context, ConstructorInvokeContext interceptorContext) {
}
@Override
public void beforeMethod(EnhancedClassInstanceContext context, MethodInvokeContext interceptorContext) {
System.out.println("before method");
}
@Override
public Object afterMethod(EnhancedClassInstanceContext context, MethodInvokeContext interceptorContext, Object ret) {
System.out.println("after method");
return ret;
}
@Override
public void handleMethodException(Throwable t, EnhancedClassInstanceContext context, MethodInvokeContext interceptorContext, Object ret) {
}
}

View File

@ -0,0 +1,28 @@
package test.ai.cloud.matcher;
/**
* Created by xin on 16-6-8.
*/
public class TestMatcherClass {
public void set() {
System.out.println("set()");
}
public void seta(String a) {
set(a);
}
private void set(String a) {
System.out.println("set(String a)");
}
public void get(String a) {
System.out.println("get(String a)");
}
public void find() {
System.out.println("find()");
}
}

View File

@ -0,0 +1,30 @@
package test.ai.cloud.matcher;
import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor;
import com.ai.cloud.skywalking.plugin.interceptor.InterceptorDefine;
import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.matcher.MethodsExclusiveMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher;
/**
* Created by xin on 16-6-8.
*/
public class TestMatcherDefine implements InterceptorDefine {
@Override
public String getBeInterceptedClassName() {
return "test.ai.cloud.matcher.TestMatcherClass";
}
@Override
public MethodMatcher[] getBeInterceptedMethodsMatchers() {
return new MethodMatcher[]{
new MethodsExclusiveMatcher("set", "get"),
new SimpleMethodMatcher(MethodMatcher.Modifier.Private, "set")
};
}
@Override
public IAroundInterceptor instance() {
return new TestAroundInterceptor();
}
}

View File

@ -2,8 +2,8 @@ package test.ai.cloud.plugin;
import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor;
import com.ai.cloud.skywalking.plugin.interceptor.InterceptorDefine;
import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.matcher.FullNameMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher;
public class TestInterceptorDefine implements InterceptorDefine {
@ -13,8 +13,8 @@ public class TestInterceptorDefine implements InterceptorDefine {
}
@Override
public MethodNameMatcher[] getBeInterceptedMethodsMatchers() {
return new MethodNameMatcher[] { new FullNameMatcher("printabc") };
public MethodMatcher[] getBeInterceptedMethodsMatchers() {
return new MethodMatcher[] { new SimpleMethodMatcher("printabc") };
}
@Override

View File

@ -4,7 +4,7 @@ import org.skywalking.httpClient.v4.plugin.HttpClientExecuteInterceptor;
import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor;
import com.ai.cloud.skywalking.plugin.interceptor.InterceptorDefine;
import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
public class DubboxRestHeadSetterAttachment implements InterceptorDefine {
@ -20,7 +20,7 @@ public class DubboxRestHeadSetterAttachment implements InterceptorDefine {
}
@Override
public MethodNameMatcher[] getBeInterceptedMethodsMatchers() {
public MethodMatcher[] getBeInterceptedMethodsMatchers() {
return null;
}

View File

@ -1,7 +1,7 @@
package org.skywalking.httpClient.v4.plugin.define;
import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.matcher.FullNameMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher;
public class AbstractHttpClientPluginDefine extends HttpClientPluginDefine {
@ -17,8 +17,8 @@ public class AbstractHttpClientPluginDefine extends HttpClientPluginDefine {
*
*/
@Override
public MethodNameMatcher[] getBeInterceptedMethodsMatchers() {
return new MethodNameMatcher[] {
new FullNameMatcher("doExecute")};
public MethodMatcher[] getBeInterceptedMethodsMatchers() {
return new MethodMatcher[] {
new SimpleMethodMatcher("doExecute")};
}
}

View File

@ -1,7 +1,7 @@
package org.skywalking.httpClient.v4.plugin.define;
import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.matcher.FullNameMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher;
public class DefaultRequestDirectorPluginDefine extends HttpClientPluginDefine {
/**
@ -15,9 +15,9 @@ public class DefaultRequestDirectorPluginDefine extends HttpClientPluginDefine {
}
@Override
public MethodNameMatcher[] getBeInterceptedMethodsMatchers() {
return new MethodNameMatcher[] {
new FullNameMatcher("execute")};
public MethodMatcher[] getBeInterceptedMethodsMatchers() {
return new MethodMatcher[] {
new SimpleMethodMatcher("execute")};
}
}

View File

@ -1,12 +1,12 @@
package org.skywalking.httpClient.v4.plugin.define;
import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.matcher.FullNameMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher;
public class InternalHttpClientPluginDefine extends HttpClientPluginDefine {
@Override
public MethodNameMatcher[] getBeInterceptedMethodsMatchers() {
return new MethodNameMatcher[]{new FullNameMatcher("doExecute")};
public MethodMatcher[] getBeInterceptedMethodsMatchers() {
return new MethodMatcher[]{new SimpleMethodMatcher("doExecute")};
}
@Override

View File

@ -1,12 +1,12 @@
package org.skywalking.httpClient.v4.plugin.define;
import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.matcher.FullNameMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher;
public class MinimalHttpClientPluginDefine extends HttpClientPluginDefine {
@Override
public MethodNameMatcher[] getBeInterceptedMethodsMatchers() {
return new MethodNameMatcher[]{new FullNameMatcher("doExecute")};
public MethodMatcher[] getBeInterceptedMethodsMatchers() {
return new MethodMatcher[]{new SimpleMethodMatcher("doExecute")};
}
@Override

View File

@ -4,7 +4,7 @@ import org.skywalking.jedis.v2.plugin.JedisInterceptor;
import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor;
import com.ai.cloud.skywalking.plugin.interceptor.InterceptorDefine;
import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.matcher.AnyMethodMatcher;
public class JedisPluginDefine implements InterceptorDefine {
@ -15,8 +15,8 @@ public class JedisPluginDefine implements InterceptorDefine {
}
@Override
public MethodNameMatcher[] getBeInterceptedMethodsMatchers() {
return new MethodNameMatcher[] { new AnyMethodMatcher() };
public MethodMatcher[] getBeInterceptedMethodsMatchers() {
return new MethodMatcher[] { new AnyMethodMatcher() };
}
@Override

View File

@ -2,8 +2,8 @@ package com.ai.cloud.skywalking.plugin.mysql;
import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor;
import com.ai.cloud.skywalking.plugin.interceptor.InterceptorDefine;
import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.matcher.FullNameMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher;
public class ConnectionPluginDefine implements InterceptorDefine {
@ -13,12 +13,12 @@ public class ConnectionPluginDefine implements InterceptorDefine {
}
@Override
public MethodNameMatcher[] getBeInterceptedMethodsMatchers() {
return new MethodNameMatcher[] { new FullNameMatcher("createStatement", 2),
new FullNameMatcher("prepareStatement", 3),
new FullNameMatcher("prepareCall", 3),
new FullNameMatcher("commit"), new FullNameMatcher("rollback"),
new FullNameMatcher("close") };
public MethodMatcher[] getBeInterceptedMethodsMatchers() {
return new MethodMatcher[] { new SimpleMethodMatcher("createStatement", 2),
new SimpleMethodMatcher("prepareStatement", 3),
new SimpleMethodMatcher("prepareCall", 3),
new SimpleMethodMatcher("commit"), new SimpleMethodMatcher("rollback"),
new SimpleMethodMatcher("close") };
}
@Override