Set up the bootstrap instrumentation plugin framework (#3152)
* POC: Intercept successfully. * Refactor codes * Build the new core * Setup the new core. * Push the javassist version to 3.23.2-GA, as it is the last version supports JDK 1.6 compile, according to https://github.com/jboss-javassist/javassist/blob/rel_3_23_2_ga/pom.xml#L149-L160 * Finish the all codes. * Document updated for bootstrap instrumentation. * Add a notice to document. * Remove unexpected file. * Set javassist version right. Add judge in core interceptors * Fixe no log bridge implementation
This commit is contained in:
parent
c11b9f102f
commit
c76fb4053e
|
|
@ -16,7 +16,8 @@
|
|||
~
|
||||
-->
|
||||
|
||||
<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">
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
|
|
@ -37,6 +38,10 @@
|
|||
<grpc.version>1.14.0</grpc.version>
|
||||
<guava.version>20.0</guava.version>
|
||||
<bytebuddy.version>1.9.2</bytebuddy.version>
|
||||
<!-- 3.21.0-GA is the last version w/ JDK 6 supported -->
|
||||
<!-- We can't update this, unless JDK 6 agent is not supported. -->
|
||||
<!-- ref discussion, https://github.com/jboss-javassist/javassist/issues/268 -->
|
||||
<javaassist.version>3.21.0-GA</javaassist.version>
|
||||
<disruptor.version>3.3.6</disruptor.version>
|
||||
<wiremock.version>2.6.0</wiremock.version>
|
||||
<netty-tcnative-boringssl-static.version>2.0.7.Final</netty-tcnative-boringssl-static.version>
|
||||
|
|
@ -53,6 +58,8 @@
|
|||
<shade.io.netty.target>${shade.package}.${shade.io.netty.source}</shade.io.netty.target>
|
||||
<shade.io.opencensus.source>io.opencensus</shade.io.opencensus.source>
|
||||
<shade.io.opencensus.target>${shade.package}.${shade.io.opencensus.source}</shade.io.opencensus.target>
|
||||
<shade.javaassist.source>javassist</shade.javaassist.source>
|
||||
<shade.javaassist.target>${shade.package}.${shade.javaassist.source}</shade.javaassist.target>
|
||||
<ststem-rules.version>1.18.0</ststem-rules.version>
|
||||
</properties>
|
||||
|
||||
|
|
@ -97,6 +104,11 @@
|
|||
<artifactId>netty-tcnative-boringssl-static</artifactId>
|
||||
<version>${netty-tcnative-boringssl-static.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.javassist</groupId>
|
||||
<artifactId>javassist</artifactId>
|
||||
<version>${javaassist.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.bytebuddy</groupId>
|
||||
<artifactId>byte-buddy-agent</artifactId>
|
||||
|
|
@ -180,6 +192,10 @@
|
|||
</excludes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>${shade.javaassist.source}</pattern>
|
||||
<shadedPattern>${shade.javaassist.target}</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>${shade.com.lmax.disruptor.source}</pattern>
|
||||
<shadedPattern>${shade.com.lmax.disruptor.target}</shadedPattern>
|
||||
|
|
@ -211,7 +227,8 @@
|
|||
</filter>
|
||||
</filters>
|
||||
<transformers>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
|
||||
<transformer
|
||||
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
|
||||
</transformers>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
@ -227,7 +244,7 @@
|
|||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<delete dir="${project.basedir}/../../packages" />
|
||||
<delete dir="${project.basedir}/../../packages"/>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
@ -236,14 +253,22 @@
|
|||
<phase>package</phase>
|
||||
<configuration>
|
||||
<target>
|
||||
<echo message="unjar" />
|
||||
<unzip src="${project.build.directory}/${project.artifactId}-${project.version}.jar" dest="${project.build.directory}/unpacked/" />
|
||||
<echo message="rename service providers in META-INF/services" />
|
||||
<move file="${project.build.directory}/unpacked/META-INF/native/libnetty_tcnative_osx_x86_64.jnilib" tofile="${project.build.directory}/unpacked/META-INF/native/liborg_apache_skywalking_apm_dependencies_netty_tcnative_osx_x86_64.jnilib" />
|
||||
<move file="${project.build.directory}/unpacked/META-INF/native/libnetty_tcnative_linux_x86_64.so" tofile="${project.build.directory}/unpacked/META-INF/native/liborg_apache_skywalking_apm_dependencies_netty_tcnative_linux_x86_64.so" />
|
||||
<move file="${project.build.directory}/unpacked/META-INF/native/netty_tcnative_windows_x86_64.dll" tofile="${project.build.directory}/unpacked/META-INF/native/org_apache_skywalking_apm_dependencies_netty_tcnative_windows_x86_64.dll" />
|
||||
<echo message="jar back" />
|
||||
<jar destfile="${project.build.directory}/${project.artifactId}-${project.version}.jar" basedir="${project.build.directory}/unpacked" />
|
||||
<echo message="unjar"/>
|
||||
<unzip src="${project.build.directory}/${project.artifactId}-${project.version}.jar"
|
||||
dest="${project.build.directory}/unpacked/"/>
|
||||
<echo message="rename service providers in META-INF/services"/>
|
||||
<move
|
||||
file="${project.build.directory}/unpacked/META-INF/native/libnetty_tcnative_osx_x86_64.jnilib"
|
||||
tofile="${project.build.directory}/unpacked/META-INF/native/liborg_apache_skywalking_apm_dependencies_netty_tcnative_osx_x86_64.jnilib"/>
|
||||
<move
|
||||
file="${project.build.directory}/unpacked/META-INF/native/libnetty_tcnative_linux_x86_64.so"
|
||||
tofile="${project.build.directory}/unpacked/META-INF/native/liborg_apache_skywalking_apm_dependencies_netty_tcnative_linux_x86_64.so"/>
|
||||
<move
|
||||
file="${project.build.directory}/unpacked/META-INF/native/netty_tcnative_windows_x86_64.dll"
|
||||
tofile="${project.build.directory}/unpacked/META-INF/native/org_apache_skywalking_apm_dependencies_netty_tcnative_windows_x86_64.dll"/>
|
||||
<echo message="jar back"/>
|
||||
<jar destfile="${project.build.directory}/${project.artifactId}-${project.version}.jar"
|
||||
basedir="${project.build.directory}/unpacked"/>
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
|
|
|
|||
|
|
@ -25,9 +25,13 @@ import org.apache.skywalking.apm.agent.core.logging.core.EasyLogResolver;
|
|||
* LogManager is the {@link LogResolver} implementation manager. By using {@link LogResolver}, {@link
|
||||
* LogManager#getLogger(Class)} returns a {@link ILog} implementation. This module use this class as the main entrance,
|
||||
* and block the implementation detail about log-component. In different modules, like server or sniffer, it will use
|
||||
* different implementations. <p> If no {@link LogResolver} is registered, return {@link NoopLogger#INSTANCE} to avoid
|
||||
* different implementations.
|
||||
*
|
||||
* <p> If no {@link LogResolver} is registered, return {@link NoopLogger#INSTANCE} to avoid
|
||||
* {@link NullPointerException}. If {@link LogManager#setLogResolver(LogResolver)} is called twice, the second will
|
||||
* override the first without any warning or exception. <p> Created by xin on 2016/11/10.
|
||||
* override the first without any warning or exception.
|
||||
*
|
||||
* <p> Created by xin on 2016/11/10.
|
||||
*/
|
||||
public class LogManager {
|
||||
private static LogResolver RESOLVER = new EasyLogResolver();
|
||||
|
|
@ -42,4 +46,11 @@ public class LogManager {
|
|||
}
|
||||
return LogManager.RESOLVER.getLogger(clazz);
|
||||
}
|
||||
|
||||
public static ILog getLogger(String clazz) {
|
||||
if (RESOLVER == null) {
|
||||
return NoopLogger.INSTANCE;
|
||||
}
|
||||
return LogManager.RESOLVER.getLogger(clazz);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,4 +30,10 @@ public interface LogResolver {
|
|||
* @return {@link ILog} implementation.
|
||||
*/
|
||||
ILog getLogger(Class<?> clazz);
|
||||
|
||||
/**
|
||||
* @param clazz the class is showed in log message.
|
||||
* @return {@link ILog} implementation.
|
||||
*/
|
||||
ILog getLogger(String clazz);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,4 +30,8 @@ public class EasyLogResolver implements LogResolver {
|
|||
public ILog getLogger(Class<?> clazz) {
|
||||
return new EasyLogger(clazz);
|
||||
}
|
||||
|
||||
@Override public ILog getLogger(String clazz) {
|
||||
return new EasyLogger(clazz);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,9 +36,13 @@ import org.apache.skywalking.apm.util.StringUtil;
|
|||
*/
|
||||
public class EasyLogger implements ILog {
|
||||
|
||||
private Class targetClass;
|
||||
private String targetClass;
|
||||
|
||||
public EasyLogger(Class targetClass) {
|
||||
this.targetClass = targetClass.getSimpleName();
|
||||
}
|
||||
|
||||
public EasyLogger(String targetClass) {
|
||||
this.targetClass = targetClass;
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +72,7 @@ public class EasyLogger implements ILog {
|
|||
return StringUtil.join(' ', level.name(),
|
||||
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()),
|
||||
Thread.currentThread().getName(),
|
||||
targetClass.getSimpleName(),
|
||||
targetClass,
|
||||
": ",
|
||||
message,
|
||||
t == null ? "" : format(t)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ import net.bytebuddy.description.type.TypeDescription;
|
|||
import net.bytebuddy.dynamic.DynamicType;
|
||||
import org.apache.skywalking.apm.agent.core.logging.api.ILog;
|
||||
import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
|
||||
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.StaticMethodsInterceptPoint;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassEnhancePluginDefine;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
|
||||
import org.apache.skywalking.apm.util.StringUtil;
|
||||
|
|
@ -104,4 +107,29 @@ public abstract class AbstractClassEnhancePluginDefine {
|
|||
protected String[] witnessClasses() {
|
||||
return new String[] {};
|
||||
}
|
||||
|
||||
public boolean isBootstrapInstrumentation() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor methods intercept point. See {@link ConstructorInterceptPoint}
|
||||
*
|
||||
* @return collections of {@link ConstructorInterceptPoint}
|
||||
*/
|
||||
public abstract ConstructorInterceptPoint[] getConstructorsInterceptPoints();
|
||||
|
||||
/**
|
||||
* Instance methods intercept point. See {@link InstanceMethodsInterceptPoint}
|
||||
*
|
||||
* @return collections of {@link InstanceMethodsInterceptPoint}
|
||||
*/
|
||||
public abstract InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints();
|
||||
|
||||
/**
|
||||
* Static methods intercept point. See {@link StaticMethodsInterceptPoint}
|
||||
*
|
||||
* @return collections of {@link StaticMethodsInterceptPoint}
|
||||
*/
|
||||
public abstract StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package org.apache.skywalking.apm.agent.core.plugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
|
@ -36,14 +37,15 @@ import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
|||
import static net.bytebuddy.matcher.ElementMatchers.not;
|
||||
|
||||
/**
|
||||
* The <code>PluginFinder</code> represents a finder , which assist to find the one
|
||||
* from the given {@link AbstractClassEnhancePluginDefine} list.
|
||||
* The <code>PluginFinder</code> represents a finder , which assist to find the one from the given {@link
|
||||
* AbstractClassEnhancePluginDefine} list.
|
||||
*
|
||||
* @author wusheng
|
||||
*/
|
||||
public class PluginFinder {
|
||||
private final Map<String, LinkedList<AbstractClassEnhancePluginDefine>> nameMatchDefine = new HashMap<String, LinkedList<AbstractClassEnhancePluginDefine>>();
|
||||
private final List<AbstractClassEnhancePluginDefine> signatureMatchDefine = new LinkedList<AbstractClassEnhancePluginDefine>();
|
||||
private final List<AbstractClassEnhancePluginDefine> signatureMatchDefine = new ArrayList<AbstractClassEnhancePluginDefine>();
|
||||
private final List<AbstractClassEnhancePluginDefine> bootstrapClassMatchDefine = new ArrayList<AbstractClassEnhancePluginDefine>();
|
||||
|
||||
public PluginFinder(List<AbstractClassEnhancePluginDefine> plugins) {
|
||||
for (AbstractClassEnhancePluginDefine plugin : plugins) {
|
||||
|
|
@ -64,6 +66,10 @@ public class PluginFinder {
|
|||
} else {
|
||||
signatureMatchDefine.add(plugin);
|
||||
}
|
||||
|
||||
if (plugin.isBootstrapInstrumentation()) {
|
||||
bootstrapClassMatchDefine.add(plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -100,4 +106,8 @@ public class PluginFinder {
|
|||
}
|
||||
return new ProtectiveShieldMatcher(judge);
|
||||
}
|
||||
|
||||
public List<AbstractClassEnhancePluginDefine> getBootstrapClassMatchDefine() {
|
||||
return bootstrapClassMatchDefine;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,221 @@
|
|||
/*
|
||||
* 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.agent.core.plugin.bootstrap;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.instrument.Instrumentation;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javassist.ClassPool;
|
||||
import javassist.CtClass;
|
||||
import javassist.CtField;
|
||||
import net.bytebuddy.agent.builder.AgentBuilder;
|
||||
import net.bytebuddy.dynamic.loading.ClassInjector;
|
||||
import org.apache.skywalking.apm.agent.core.boot.AgentPackageNotFoundException;
|
||||
import org.apache.skywalking.apm.agent.core.boot.AgentPackagePath;
|
||||
import org.apache.skywalking.apm.agent.core.logging.api.ILog;
|
||||
import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.AbstractClassEnhancePluginDefine;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.PluginException;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.PluginFinder;
|
||||
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.StaticMethodsInterceptPoint;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.loader.AgentClassLoader;
|
||||
|
||||
/**
|
||||
* If there is Bootstrap instrumentation plugin declared in plugin list, BootstrapInstrumentBoost inject the necessary
|
||||
* classes into bootstrap class loader, including generated dynamic delegate classes.
|
||||
*
|
||||
* @author wusheng
|
||||
*/
|
||||
public class BootstrapInstrumentBoost {
|
||||
private static final ILog logger = LogManager.getLogger(BootstrapInstrumentBoost.class);
|
||||
private static final String[] HIGH_PRIORITY_CLASSES = {
|
||||
"org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance",
|
||||
"org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.BootstrapInterRuntimeAssist",
|
||||
"org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor",
|
||||
"org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor",
|
||||
"org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult",
|
||||
"org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.OverrideCallable",
|
||||
"org.apache.skywalking.apm.agent.core.plugin.bootstrap.IBootstrapLog"
|
||||
};
|
||||
private static String INSTANCE_METHOD_DELEGATE_TEMPLATE = "org.apache.skywalking.apm.agent.core.plugin.bootstrap.template.InstanceMethodInterTemplate";
|
||||
private static String INSTANCE_METHOD_WITH_OVERRIDE_ARGS_DELEGATE_TEMPLATE = "org.apache.skywalking.apm.agent.core.plugin.bootstrap.template.InstanceMethodInterWithOverrideArgsTemplate";
|
||||
private static String CONSTRUCTOR_DELEGATE_TEMPLATE = "org.apache.skywalking.apm.agent.core.plugin.bootstrap.template.ConstructorInterTemplate";
|
||||
private static String STATIC_METHOD_DELEGATE_TEMPLATE = "org.apache.skywalking.apm.agent.core.plugin.bootstrap.template.StaticMethodInterTemplate";
|
||||
private static String STATIC_METHOD_WITH_OVERRIDE_ARGS_DELEGATE_TEMPLATE = "org.apache.skywalking.apm.agent.core.plugin.bootstrap.template.StaticMethodInterWithOverrideArgsTemplate";
|
||||
|
||||
public static AgentBuilder inject(PluginFinder pluginFinder, AgentBuilder agentBuilder,
|
||||
Instrumentation instrumentation) throws PluginException {
|
||||
|
||||
Map<String, byte[]> classesTypeMap = new HashMap<String, byte[]>();
|
||||
|
||||
if (!prepareJREInstrumentation(pluginFinder, classesTypeMap)) {
|
||||
return agentBuilder;
|
||||
}
|
||||
|
||||
for (String highPriorityClass : HIGH_PRIORITY_CLASSES) {
|
||||
loadHighPriorityClass(classesTypeMap, highPriorityClass);
|
||||
}
|
||||
|
||||
File temp = null;
|
||||
try {
|
||||
temp = new File(AgentPackagePath.getPath(), "bootstrapJarTmp");
|
||||
} catch (AgentPackageNotFoundException e) {
|
||||
logger.error(e, "Bootstrap plugin exist, but SkyWalking agent can't create bootstrapJarTmp folder. Shutting down.");
|
||||
throw new UnsupportedOperationException("Bootstrap plugin exist, but SkyWalking agent can't create bootstrapJarTmp folder. Shutting down.", e);
|
||||
}
|
||||
|
||||
ClassInjector.UsingInstrumentation.of(temp, ClassInjector.UsingInstrumentation.Target.BOOTSTRAP, instrumentation).injectRaw(classesTypeMap);
|
||||
|
||||
agentBuilder = agentBuilder.enableBootstrapInjection(instrumentation, temp);
|
||||
return agentBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the delegate class name.
|
||||
*
|
||||
* @param methodsInterceptor of original interceptor in the plugin
|
||||
* @return generated delegate class name
|
||||
*/
|
||||
public static String internalDelegate(String methodsInterceptor) {
|
||||
return methodsInterceptor + "_internal";
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the delegate class from current class loader, mostly should be AppClassLoader.
|
||||
*
|
||||
* @param methodsInterceptor of original interceptor in the plugin
|
||||
* @return generated delegate class
|
||||
*/
|
||||
public static Class forInternalDelegateClass(String methodsInterceptor) {
|
||||
try {
|
||||
return Class.forName(internalDelegate(methodsInterceptor));
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new PluginException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate dynamic delegate for ByteBuddy
|
||||
*
|
||||
* @param pluginFinder gets the whole plugin list.
|
||||
* @param classesTypeMap hosts the class binary.
|
||||
* @return true if have JRE instrumentation requirement.
|
||||
* @throws PluginException when generate failure.
|
||||
*/
|
||||
private static boolean prepareJREInstrumentation(PluginFinder pluginFinder,
|
||||
Map<String, byte[]> classesTypeMap) throws PluginException {
|
||||
ClassPool classPool = ClassPool.getDefault();
|
||||
List<AbstractClassEnhancePluginDefine> bootstrapClassMatchDefines = pluginFinder.getBootstrapClassMatchDefine();
|
||||
for (AbstractClassEnhancePluginDefine define : bootstrapClassMatchDefines) {
|
||||
for (InstanceMethodsInterceptPoint point : define.getInstanceMethodsInterceptPoints()) {
|
||||
if (point.isOverrideArgs()) {
|
||||
generateDelegator(classesTypeMap, classPool, INSTANCE_METHOD_WITH_OVERRIDE_ARGS_DELEGATE_TEMPLATE, point.getMethodsInterceptor());
|
||||
} else {
|
||||
generateDelegator(classesTypeMap, classPool, INSTANCE_METHOD_DELEGATE_TEMPLATE, point.getMethodsInterceptor());
|
||||
}
|
||||
}
|
||||
|
||||
for (ConstructorInterceptPoint point : define.getConstructorsInterceptPoints()) {
|
||||
generateDelegator(classesTypeMap, classPool, CONSTRUCTOR_DELEGATE_TEMPLATE, point.getConstructorInterceptor());
|
||||
}
|
||||
|
||||
for (StaticMethodsInterceptPoint point : define.getStaticMethodsInterceptPoints()) {
|
||||
if (point.isOverrideArgs()) {
|
||||
generateDelegator(classesTypeMap, classPool, STATIC_METHOD_WITH_OVERRIDE_ARGS_DELEGATE_TEMPLATE, point.getMethodsInterceptor());
|
||||
} else {
|
||||
generateDelegator(classesTypeMap, classPool, STATIC_METHOD_DELEGATE_TEMPLATE, point.getMethodsInterceptor());
|
||||
}
|
||||
}
|
||||
}
|
||||
return bootstrapClassMatchDefines.size() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the delegator class based on given template class. This is preparation stage level code generation.
|
||||
*
|
||||
* One key step to avoid class confliction between AppClassLoader and BootstrapClassLoader
|
||||
*
|
||||
* @param classesTypeMap hosts injected binary of generated class
|
||||
* @param classPool to generate new class
|
||||
* @param templateClassName represents the class as template in this generation process. The templates are
|
||||
* pre-defined in SkyWalking agent core.
|
||||
* @param methodsInterceptor
|
||||
*/
|
||||
private static void generateDelegator(Map<String, byte[]> classesTypeMap, ClassPool classPool,
|
||||
String templateClassName, String methodsInterceptor) {
|
||||
String internalInterceptorName = internalDelegate(methodsInterceptor);
|
||||
try {
|
||||
CtClass interClass = classPool.get(templateClassName);
|
||||
interClass.setName(internalInterceptorName);
|
||||
|
||||
CtField interceptorDefine = interClass.getField("TARGET_INTERCEPTOR");
|
||||
interClass.removeField(interceptorDefine);
|
||||
|
||||
interceptorDefine = CtField.make("private static String TARGET_INTERCEPTOR = \"" + methodsInterceptor + "\";", interClass);
|
||||
interClass.addField(interceptorDefine);
|
||||
|
||||
byte[] bytes = interClass.toBytecode();
|
||||
|
||||
interClass.toClass();
|
||||
|
||||
classesTypeMap.put(internalInterceptorName, bytes);
|
||||
} catch (Exception e) {
|
||||
throw new PluginException("Generate Dynamic plugin failure", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The class loaded by this method means it only should be loaded once in Bootstrap classloader, when bootstrap
|
||||
* instrumentation active by any plugin
|
||||
*
|
||||
* @param loadedTypeMap hosts all injected class
|
||||
* @param className to load
|
||||
*/
|
||||
private static void loadHighPriorityClass(Map<String, byte[]> loadedTypeMap, String className) {
|
||||
byte[] enhancedInstanceClassFile;
|
||||
try {
|
||||
String classResourceName = className.replaceAll("\\.", "/") + ".class";
|
||||
InputStream resourceAsStream = AgentClassLoader.getDefault().getResourceAsStream(classResourceName);
|
||||
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
|
||||
byte[] buffer = new byte[1024];
|
||||
int len;
|
||||
|
||||
// read bytes from the input stream and store them in buffer
|
||||
while ((len = resourceAsStream.read(buffer)) != -1) {
|
||||
// write bytes from the buffer into output stream
|
||||
os.write(buffer, 0, len);
|
||||
}
|
||||
|
||||
enhancedInstanceClassFile = os.toByteArray();
|
||||
} catch (IOException e) {
|
||||
throw new PluginException(e.getMessage(), e);
|
||||
}
|
||||
|
||||
loadedTypeMap.put(className, enhancedInstanceClassFile);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* 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.agent.core.plugin.bootstrap;
|
||||
|
||||
import org.apache.skywalking.apm.agent.core.logging.api.ILog;
|
||||
import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
|
||||
|
||||
/**
|
||||
* The log bridge makes the ILog accessible inside bootstrap classloader, especially for internal interceptor.
|
||||
*
|
||||
* @author wusheng
|
||||
*/
|
||||
public class BootstrapPluginLogBridge implements IBootstrapLog {
|
||||
public static IBootstrapLog getLogger(String clazz) {
|
||||
return new BootstrapPluginLogBridge(clazz);
|
||||
}
|
||||
|
||||
private final ILog logger;
|
||||
|
||||
private BootstrapPluginLogBridge(String clazz) {
|
||||
logger = LogManager.getLogger(clazz);
|
||||
}
|
||||
|
||||
@Override public void info(String format) {
|
||||
logger.info(format);
|
||||
}
|
||||
|
||||
@Override public void info(String format, Object... arguments) {
|
||||
logger.info(format, arguments);
|
||||
}
|
||||
|
||||
@Override public void warn(String format, Object... arguments) {
|
||||
logger.warn(format, arguments);
|
||||
}
|
||||
|
||||
@Override public void warn(Throwable e, String format, Object... arguments) {
|
||||
logger.warn(e, format, arguments);
|
||||
}
|
||||
|
||||
@Override public void error(String format, Throwable e) {
|
||||
logger.error(format, e);
|
||||
}
|
||||
|
||||
@Override public void error(Throwable e, String format, Object... arguments) {
|
||||
logger.error(e, format, arguments);
|
||||
}
|
||||
|
||||
@Override public boolean isDebugEnable() {
|
||||
return logger.isDebugEnable();
|
||||
}
|
||||
|
||||
@Override public boolean isInfoEnable() {
|
||||
return logger.isInfoEnable();
|
||||
}
|
||||
|
||||
@Override public boolean isWarnEnable() {
|
||||
return logger.isWarnEnable();
|
||||
}
|
||||
|
||||
@Override public boolean isErrorEnable() {
|
||||
return logger.isErrorEnable();
|
||||
}
|
||||
|
||||
@Override public void debug(String format) {
|
||||
logger.debug(format);
|
||||
}
|
||||
|
||||
@Override public void debug(String format, Object... arguments) {
|
||||
logger.debug(format, arguments);
|
||||
}
|
||||
|
||||
@Override public void error(String format) {
|
||||
logger.error(format);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* 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.agent.core.plugin.bootstrap;
|
||||
|
||||
/**
|
||||
* The log interface used in bootstrap internal interceptors.
|
||||
*
|
||||
* Never used in any plugin or tracing core.
|
||||
*
|
||||
* @author wusheng
|
||||
*/
|
||||
public interface IBootstrapLog {
|
||||
void info(String format);
|
||||
|
||||
void info(String format, Object... arguments);
|
||||
|
||||
void warn(String format, Object... arguments);
|
||||
|
||||
void warn(Throwable e, String format, Object... arguments);
|
||||
|
||||
void error(String format, Throwable e);
|
||||
|
||||
void error(Throwable e, String format, Object... arguments);
|
||||
|
||||
boolean isDebugEnable();
|
||||
|
||||
boolean isInfoEnable();
|
||||
|
||||
boolean isWarnEnable();
|
||||
|
||||
boolean isErrorEnable();
|
||||
|
||||
void debug(String format);
|
||||
|
||||
void debug(String format, Object... arguments);
|
||||
|
||||
void error(String format);
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* 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.agent.core.plugin.bootstrap.template;
|
||||
|
||||
import net.bytebuddy.implementation.bind.annotation.AllArguments;
|
||||
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
|
||||
import net.bytebuddy.implementation.bind.annotation.This;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.bootstrap.IBootstrapLog;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.BootstrapInterRuntimeAssist;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor;
|
||||
|
||||
/**
|
||||
* --------CLASS TEMPLATE---------
|
||||
* <p>Author, Wu Sheng </p>
|
||||
* <p>Comment, don't change this unless you are 100% sure the agent core mechanism for bootstrap class
|
||||
* instrumentation.</p>
|
||||
* <p>Date, 24th July 2019</p>
|
||||
* -------------------------------
|
||||
*
|
||||
* This class wouldn't be loaded in real env. This is a class template for dynamic class generation.
|
||||
*
|
||||
* @author wusheng
|
||||
*/
|
||||
public class ConstructorInterTemplate {
|
||||
/**
|
||||
* This field is never set in the template, but has value in the runtime.
|
||||
*/
|
||||
private static String TARGET_INTERCEPTOR;
|
||||
|
||||
private static InstanceConstructorInterceptor INTERCEPTOR;
|
||||
private static IBootstrapLog LOGGER;
|
||||
|
||||
/**
|
||||
* Intercept the target constructor.
|
||||
*
|
||||
* @param obj target class instance.
|
||||
* @param allArguments all constructor arguments
|
||||
*/
|
||||
@RuntimeType
|
||||
public static void intercept(@This Object obj,
|
||||
@AllArguments Object[] allArguments) {
|
||||
try {
|
||||
prepare();
|
||||
|
||||
EnhancedInstance targetObject = (EnhancedInstance)obj;
|
||||
|
||||
if (INTERCEPTOR == null) {
|
||||
return;
|
||||
}
|
||||
INTERCEPTOR.onConstruct(targetObject, allArguments);
|
||||
} catch (Throwable t) {
|
||||
LOGGER.error("ConstructorInter failure.", t);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the context. Link to the agent core in AppClassLoader.
|
||||
*/
|
||||
private static void prepare() {
|
||||
if (INTERCEPTOR == null) {
|
||||
ClassLoader loader = BootstrapInterRuntimeAssist.getAgentClassLoader();
|
||||
|
||||
if (loader != null) {
|
||||
IBootstrapLog logger = BootstrapInterRuntimeAssist.getLogger(loader, TARGET_INTERCEPTOR);
|
||||
if (logger != null) {
|
||||
LOGGER = logger;
|
||||
|
||||
INTERCEPTOR = BootstrapInterRuntimeAssist.createInterceptor(loader, TARGET_INTERCEPTOR, LOGGER);
|
||||
}
|
||||
} else {
|
||||
LOGGER.error("Runtime ClassLoader not found when create {}." + TARGET_INTERCEPTOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
/*
|
||||
* 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.agent.core.plugin.bootstrap.template;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.concurrent.Callable;
|
||||
import net.bytebuddy.implementation.bind.annotation.AllArguments;
|
||||
import net.bytebuddy.implementation.bind.annotation.Origin;
|
||||
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
|
||||
import net.bytebuddy.implementation.bind.annotation.SuperCall;
|
||||
import net.bytebuddy.implementation.bind.annotation.This;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.bootstrap.IBootstrapLog;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.BootstrapInterRuntimeAssist;
|
||||
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;
|
||||
|
||||
/**
|
||||
* --------CLASS TEMPLATE---------
|
||||
* <p>Author, Wu Sheng </p>
|
||||
* <p>Comment, don't change this unless you are 100% sure the agent core mechanism for bootstrap class
|
||||
* instrumentation.</p>
|
||||
* <p>Date, 24th July 2019</p>
|
||||
* -------------------------------
|
||||
*
|
||||
* This class wouldn't be loaded in real env. This is a class template for dynamic class generation.
|
||||
*
|
||||
* @author wusheng
|
||||
*/
|
||||
public class InstanceMethodInterTemplate {
|
||||
/**
|
||||
* This field is never set in the template, but has value in the runtime.
|
||||
*/
|
||||
private static String TARGET_INTERCEPTOR;
|
||||
|
||||
private static InstanceMethodsAroundInterceptor INTERCEPTOR;
|
||||
private static IBootstrapLog LOGGER;
|
||||
|
||||
/**
|
||||
* Intercept the target instance method.
|
||||
*
|
||||
* @param obj target class instance.
|
||||
* @param allArguments all method arguments
|
||||
* @param method method description.
|
||||
* @param zuper the origin call ref.
|
||||
* @return the return value of target instance method.
|
||||
* @throws Exception only throw exception because of zuper.call() or unexpected exception in sky-walking ( This is a
|
||||
* bug, if anything triggers this condition ).
|
||||
*/
|
||||
@RuntimeType
|
||||
public static Object intercept(@This Object obj,
|
||||
@AllArguments Object[] allArguments,
|
||||
@SuperCall Callable<?> zuper,
|
||||
@Origin Method method
|
||||
) throws Throwable {
|
||||
EnhancedInstance targetObject = (EnhancedInstance)obj;
|
||||
|
||||
prepare();
|
||||
|
||||
MethodInterceptResult result = new MethodInterceptResult();
|
||||
try {
|
||||
if (INTERCEPTOR != null) {
|
||||
INTERCEPTOR.beforeMethod(targetObject, method, allArguments, method.getParameterTypes(),
|
||||
result);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
if (LOGGER != null) {
|
||||
LOGGER.error(t, "class[{}] before method[{}] intercept failure", obj.getClass(), method.getName());
|
||||
}
|
||||
}
|
||||
|
||||
Object ret = null;
|
||||
try {
|
||||
if (!result.isContinue()) {
|
||||
ret = result._ret();
|
||||
} else {
|
||||
ret = zuper.call();
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
try {
|
||||
if (INTERCEPTOR != null) {
|
||||
INTERCEPTOR.handleMethodException(targetObject, method, allArguments, method.getParameterTypes(),
|
||||
t);
|
||||
}
|
||||
} catch (Throwable t2) {
|
||||
if (LOGGER != null) {
|
||||
LOGGER.error(t2, "class[{}] handle method[{}] exception failure", obj.getClass(), method.getName());
|
||||
}
|
||||
}
|
||||
throw t;
|
||||
} finally {
|
||||
try {
|
||||
if (INTERCEPTOR != null) {
|
||||
ret = INTERCEPTOR.afterMethod(targetObject, method, allArguments, method.getParameterTypes(),
|
||||
ret);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
if (LOGGER != null) {
|
||||
LOGGER.error(t, "class[{}] after method[{}] intercept failure", obj.getClass(), method.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the context. Link to the agent core in AppClassLoader.
|
||||
*/
|
||||
private static void prepare() {
|
||||
if (INTERCEPTOR == null) {
|
||||
ClassLoader loader = BootstrapInterRuntimeAssist.getAgentClassLoader();
|
||||
|
||||
if (loader != null) {
|
||||
IBootstrapLog logger = BootstrapInterRuntimeAssist.getLogger(loader, TARGET_INTERCEPTOR);
|
||||
if (logger != null) {
|
||||
LOGGER = logger;
|
||||
|
||||
INTERCEPTOR = BootstrapInterRuntimeAssist.createInterceptor(loader, TARGET_INTERCEPTOR, LOGGER);
|
||||
}
|
||||
} else {
|
||||
LOGGER.error("Runtime ClassLoader not found when create {}." + TARGET_INTERCEPTOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
/*
|
||||
* 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.agent.core.plugin.bootstrap.template;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import net.bytebuddy.implementation.bind.annotation.AllArguments;
|
||||
import net.bytebuddy.implementation.bind.annotation.Morph;
|
||||
import net.bytebuddy.implementation.bind.annotation.Origin;
|
||||
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
|
||||
import net.bytebuddy.implementation.bind.annotation.This;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.bootstrap.IBootstrapLog;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.BootstrapInterRuntimeAssist;
|
||||
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.agent.core.plugin.interceptor.enhance.OverrideCallable;
|
||||
|
||||
/**
|
||||
* --------CLASS TEMPLATE---------
|
||||
* <p>Author, Wu Sheng </p>
|
||||
* <p>Comment, don't change this unless you are 100% sure the agent core mechanism for bootstrap class
|
||||
* instrumentation.</p>
|
||||
* <p>Date, 24th July 2019</p>
|
||||
* -------------------------------
|
||||
*
|
||||
* This class wouldn't be loaded in real env. This is a class template for dynamic class generation.
|
||||
*
|
||||
* @author wusheng
|
||||
*/
|
||||
public class InstanceMethodInterWithOverrideArgsTemplate {
|
||||
/**
|
||||
* This field is never set in the template, but has value in the runtime.
|
||||
*/
|
||||
private static String TARGET_INTERCEPTOR;
|
||||
|
||||
private static InstanceMethodsAroundInterceptor INTERCEPTOR;
|
||||
private static IBootstrapLog LOGGER;
|
||||
|
||||
/**
|
||||
* Intercept the target instance method.
|
||||
*
|
||||
* @param obj target class instance.
|
||||
* @param allArguments all method arguments
|
||||
* @param method method description.
|
||||
* @param zuper the origin call ref.
|
||||
* @return the return value of target instance method.
|
||||
* @throws Exception only throw exception because of zuper.call() or unexpected exception in sky-walking ( This is a
|
||||
* bug, if anything triggers this condition ).
|
||||
*/
|
||||
@RuntimeType
|
||||
public static Object intercept(@This Object obj,
|
||||
@AllArguments Object[] allArguments,
|
||||
@Morph OverrideCallable zuper,
|
||||
@Origin Method method
|
||||
) throws Throwable {
|
||||
EnhancedInstance targetObject = (EnhancedInstance)obj;
|
||||
|
||||
prepare();
|
||||
|
||||
MethodInterceptResult result = new MethodInterceptResult();
|
||||
try {
|
||||
if (INTERCEPTOR != null) {
|
||||
INTERCEPTOR.beforeMethod(targetObject, method, allArguments, method.getParameterTypes(),
|
||||
result);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
if (LOGGER != null) {
|
||||
LOGGER.error(t, "class[{}] before method[{}] intercept failure", obj.getClass(), method.getName());
|
||||
}
|
||||
}
|
||||
|
||||
Object ret = null;
|
||||
try {
|
||||
if (!result.isContinue()) {
|
||||
ret = result._ret();
|
||||
} else {
|
||||
ret = zuper.call(allArguments);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
try {
|
||||
if (INTERCEPTOR != null) {
|
||||
INTERCEPTOR.handleMethodException(targetObject, method, allArguments, method.getParameterTypes(),
|
||||
t);
|
||||
}
|
||||
} catch (Throwable t2) {
|
||||
if (LOGGER != null) {
|
||||
LOGGER.error(t2, "class[{}] handle method[{}] exception failure", obj.getClass(), method.getName());
|
||||
}
|
||||
}
|
||||
throw t;
|
||||
} finally {
|
||||
try {
|
||||
if (INTERCEPTOR != null) {
|
||||
ret = INTERCEPTOR.afterMethod(targetObject, method, allArguments, method.getParameterTypes(),
|
||||
ret);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
if (LOGGER != null) {
|
||||
LOGGER.error(t, "class[{}] after method[{}] intercept failure", obj.getClass(), method.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the context. Link to the agent core in AppClassLoader.
|
||||
*/
|
||||
private static void prepare() {
|
||||
if (INTERCEPTOR == null) {
|
||||
ClassLoader loader = BootstrapInterRuntimeAssist.getAgentClassLoader();
|
||||
|
||||
if (loader != null) {
|
||||
IBootstrapLog logger = BootstrapInterRuntimeAssist.getLogger(loader, TARGET_INTERCEPTOR);
|
||||
if (logger != null) {
|
||||
LOGGER = logger;
|
||||
|
||||
INTERCEPTOR = BootstrapInterRuntimeAssist.createInterceptor(loader, TARGET_INTERCEPTOR, LOGGER);
|
||||
}
|
||||
} else {
|
||||
LOGGER.error("Runtime ClassLoader not found when create {}." + TARGET_INTERCEPTOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* 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.agent.core.plugin.bootstrap.template;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.concurrent.Callable;
|
||||
import net.bytebuddy.implementation.bind.annotation.AllArguments;
|
||||
import net.bytebuddy.implementation.bind.annotation.Origin;
|
||||
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
|
||||
import net.bytebuddy.implementation.bind.annotation.SuperCall;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.bootstrap.IBootstrapLog;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.BootstrapInterRuntimeAssist;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
|
||||
|
||||
/**
|
||||
* --------CLASS TEMPLATE---------
|
||||
* <p>Author, Wu Sheng </p>
|
||||
* <p>Comment, don't change this unless you are 100% sure the agent core mechanism for bootstrap class
|
||||
* instrumentation.</p>
|
||||
* <p>Date, 24th July 2019</p>
|
||||
* -------------------------------
|
||||
*
|
||||
* This class wouldn't be loaded in real env. This is a class template for dynamic class generation.
|
||||
*
|
||||
* @author wusheng
|
||||
*/
|
||||
public class StaticMethodInterTemplate {
|
||||
/**
|
||||
* This field is never set in the template, but has value in the runtime.
|
||||
*/
|
||||
private static String TARGET_INTERCEPTOR;
|
||||
|
||||
private static StaticMethodsAroundInterceptor INTERCEPTOR;
|
||||
private static IBootstrapLog LOGGER;
|
||||
|
||||
/**
|
||||
* Intercept the target static method.
|
||||
*
|
||||
* @param clazz target class
|
||||
* @param allArguments all method arguments
|
||||
* @param method method description.
|
||||
* @param zuper the origin call ref.
|
||||
* @return the return value of target static method.
|
||||
* @throws Exception only throw exception because of zuper.call() or unexpected exception in sky-walking ( This is a
|
||||
* bug, if anything triggers this condition ).
|
||||
*/
|
||||
@RuntimeType
|
||||
public static Object intercept(@Origin Class<?> clazz, @AllArguments Object[] allArguments, @Origin Method method,
|
||||
@SuperCall Callable<?> zuper) throws Throwable {
|
||||
prepare();
|
||||
|
||||
MethodInterceptResult result = new MethodInterceptResult();
|
||||
try {
|
||||
if (INTERCEPTOR != null) {
|
||||
INTERCEPTOR.beforeMethod(clazz, method, allArguments, method.getParameterTypes(), result);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
LOGGER.error(t, "class[{}] before static method[{}] intercept failure", clazz, method.getName());
|
||||
}
|
||||
|
||||
Object ret = null;
|
||||
try {
|
||||
if (!result.isContinue()) {
|
||||
ret = result._ret();
|
||||
} else {
|
||||
ret = zuper.call();
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
try {
|
||||
if (INTERCEPTOR != null) {
|
||||
INTERCEPTOR.handleMethodException(clazz, method, allArguments, method.getParameterTypes(), t);
|
||||
}
|
||||
} catch (Throwable t2) {
|
||||
LOGGER.error(t2, "class[{}] handle static method[{}] exception failure", clazz, method.getName(), t2.getMessage());
|
||||
}
|
||||
throw t;
|
||||
} finally {
|
||||
try {
|
||||
if (INTERCEPTOR != null) {
|
||||
ret = INTERCEPTOR.afterMethod(clazz, method, allArguments, method.getParameterTypes(), ret);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
LOGGER.error(t, "class[{}] after static method[{}] intercept failure:{}", clazz, method.getName(), t.getMessage());
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the context. Link to the agent core in AppClassLoader.
|
||||
*/
|
||||
private static void prepare() {
|
||||
if (INTERCEPTOR == null) {
|
||||
ClassLoader loader = BootstrapInterRuntimeAssist.getAgentClassLoader();
|
||||
|
||||
if (loader != null) {
|
||||
IBootstrapLog logger = BootstrapInterRuntimeAssist.getLogger(loader, TARGET_INTERCEPTOR);
|
||||
if (logger != null) {
|
||||
LOGGER = logger;
|
||||
|
||||
INTERCEPTOR = BootstrapInterRuntimeAssist.createInterceptor(loader, TARGET_INTERCEPTOR, LOGGER);
|
||||
}
|
||||
} else {
|
||||
LOGGER.error("Runtime ClassLoader not found when create {}." + TARGET_INTERCEPTOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* 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.agent.core.plugin.bootstrap.template;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import net.bytebuddy.implementation.bind.annotation.AllArguments;
|
||||
import net.bytebuddy.implementation.bind.annotation.Morph;
|
||||
import net.bytebuddy.implementation.bind.annotation.Origin;
|
||||
import net.bytebuddy.implementation.bind.annotation.RuntimeType;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.bootstrap.IBootstrapLog;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.BootstrapInterRuntimeAssist;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.OverrideCallable;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
|
||||
|
||||
/**
|
||||
* --------CLASS TEMPLATE---------
|
||||
* <p>Author, Wu Sheng </p>
|
||||
* <p>Comment, don't change this unless you are 100% sure the agent core mechanism for bootstrap class
|
||||
* instrumentation.</p>
|
||||
* <p>Date, 24th July 2019</p>
|
||||
* -------------------------------
|
||||
*
|
||||
* This class wouldn't be loaded in real env. This is a class template for dynamic class generation.
|
||||
*
|
||||
* @author wusheng
|
||||
*/
|
||||
public class StaticMethodInterWithOverrideArgsTemplate {
|
||||
/**
|
||||
* This field is never set in the template, but has value in the runtime.
|
||||
*/
|
||||
private static String TARGET_INTERCEPTOR;
|
||||
|
||||
private static StaticMethodsAroundInterceptor INTERCEPTOR;
|
||||
private static IBootstrapLog LOGGER;
|
||||
|
||||
/**
|
||||
* Intercept the target static method.
|
||||
*
|
||||
* @param clazz target class
|
||||
* @param allArguments all method arguments
|
||||
* @param method method description.
|
||||
* @param zuper the origin call ref.
|
||||
* @return the return value of target static method.
|
||||
* @throws Exception only throw exception because of zuper.call() or unexpected exception in sky-walking ( This is a
|
||||
* bug, if anything triggers this condition ).
|
||||
*/
|
||||
@RuntimeType
|
||||
public static Object intercept(@Origin Class<?> clazz, @AllArguments Object[] allArguments, @Origin Method method,
|
||||
@Morph OverrideCallable zuper) throws Throwable {
|
||||
prepare();
|
||||
|
||||
MethodInterceptResult result = new MethodInterceptResult();
|
||||
try {
|
||||
if (INTERCEPTOR != null) {
|
||||
INTERCEPTOR.beforeMethod(clazz, method, allArguments, method.getParameterTypes(), result);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
LOGGER.error(t, "class[{}] before static method[{}] intercept failure", clazz, method.getName());
|
||||
}
|
||||
|
||||
Object ret = null;
|
||||
try {
|
||||
if (!result.isContinue()) {
|
||||
ret = result._ret();
|
||||
} else {
|
||||
ret = zuper.call(allArguments);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
try {
|
||||
if (INTERCEPTOR != null) {
|
||||
INTERCEPTOR.handleMethodException(clazz, method, allArguments, method.getParameterTypes(), t);
|
||||
}
|
||||
} catch (Throwable t2) {
|
||||
LOGGER.error(t2, "class[{}] handle static method[{}] exception failure", clazz, method.getName(), t2.getMessage());
|
||||
}
|
||||
throw t;
|
||||
} finally {
|
||||
try {
|
||||
if (INTERCEPTOR != null) {
|
||||
ret = INTERCEPTOR.afterMethod(clazz, method, allArguments, method.getParameterTypes(), ret);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
LOGGER.error(t, "class[{}] after static method[{}] intercept failure:{}", clazz, method.getName(), t.getMessage());
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the context. Link to the agent core in AppClassLoader.
|
||||
*/
|
||||
private static void prepare() {
|
||||
if (INTERCEPTOR == null) {
|
||||
ClassLoader loader = BootstrapInterRuntimeAssist.getAgentClassLoader();
|
||||
|
||||
if (loader != null) {
|
||||
IBootstrapLog logger = BootstrapInterRuntimeAssist.getLogger(loader, TARGET_INTERCEPTOR);
|
||||
if (logger != null) {
|
||||
LOGGER = logger;
|
||||
|
||||
INTERCEPTOR = BootstrapInterRuntimeAssist.createInterceptor(loader, TARGET_INTERCEPTOR, LOGGER);
|
||||
}
|
||||
} else {
|
||||
LOGGER.error("Runtime ClassLoader not found when create {}." + TARGET_INTERCEPTOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* 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.agent.core.plugin.interceptor.enhance;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.bootstrap.IBootstrapLog;
|
||||
|
||||
/**
|
||||
* This assist help all bootstrap class core interceptor.
|
||||
*
|
||||
* @author wusheng
|
||||
*/
|
||||
public class BootstrapInterRuntimeAssist {
|
||||
private static final String AGENT_CLASSLOADER_DEFAULT = "org.apache.skywalking.apm.agent.core.plugin.loader.AgentClassLoader";
|
||||
private static final String DEFAULT_AGENT_CLASSLOADER_INSTANCE = "DEFAULT_LOADER";
|
||||
private static final String LOG_MANAGER_CLASS = "org.apache.skywalking.apm.agent.core.plugin.bootstrap.BootstrapPluginLogBridge";
|
||||
private static final String LOG_MANAGER_GET_LOGGER_METHOD = "getLogger";
|
||||
private static final PrintStream OUT = System.out;
|
||||
|
||||
public static ClassLoader getAgentClassLoader() {
|
||||
try {
|
||||
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||
if (loader == null) {
|
||||
return null;
|
||||
}
|
||||
Class<?> agentClassLoaderClass = Class.forName(AGENT_CLASSLOADER_DEFAULT, true, loader);
|
||||
Field defaultLoaderField = agentClassLoaderClass.getDeclaredField(DEFAULT_AGENT_CLASSLOADER_INSTANCE);
|
||||
defaultLoaderField.setAccessible(true);
|
||||
ClassLoader defaultAgentClassLoader = (ClassLoader)defaultLoaderField.get(null);
|
||||
|
||||
return defaultAgentClassLoader;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(OUT);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static IBootstrapLog getLogger(ClassLoader defaultAgentClassLoader, String interceptor) {
|
||||
try {
|
||||
Class<?> logManagerClass = Class.forName(LOG_MANAGER_CLASS, true, defaultAgentClassLoader);
|
||||
Method getLogger = logManagerClass.getMethod(LOG_MANAGER_GET_LOGGER_METHOD, String.class);
|
||||
return (IBootstrapLog)getLogger.invoke(null, interceptor + "_internal");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(OUT);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T createInterceptor(ClassLoader defaultAgentClassLoader,
|
||||
String className, IBootstrapLog log) {
|
||||
try {
|
||||
Class<?> interceptor = Class.forName(className, true, defaultAgentClassLoader);
|
||||
return (T)interceptor.newInstance();
|
||||
} catch (Exception e) {
|
||||
log.error(e, "Interceptor[{}] not found", className);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -33,7 +33,12 @@ import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
|
|||
import org.apache.skywalking.apm.agent.core.plugin.AbstractClassEnhancePluginDefine;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.EnhanceContext;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.PluginException;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.*;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.bootstrap.BootstrapInstrumentBoost;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.DeclaredInstanceMethodsInterceptPoint;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.EnhanceException;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.StaticMethodsInterceptPoint;
|
||||
import org.apache.skywalking.apm.util.StringUtil;
|
||||
|
||||
import static net.bytebuddy.jar.asm.Opcodes.ACC_PRIVATE;
|
||||
|
|
@ -45,8 +50,7 @@ import static net.bytebuddy.matcher.ElementMatchers.not;
|
|||
* This class controls all enhance operations, including enhance constructors, instance methods and static methods. All
|
||||
* the enhances base on three types interceptor point: {@link ConstructorInterceptPoint}, {@link
|
||||
* InstanceMethodsInterceptPoint} and {@link StaticMethodsInterceptPoint} If plugin is going to enhance constructors,
|
||||
* instance methods, or both, {@link ClassEnhancePluginDefine} will add a field of {@link
|
||||
* Object} type.
|
||||
* instance methods, or both, {@link ClassEnhancePluginDefine} will add a field of {@link Object} type.
|
||||
*
|
||||
* @author wusheng
|
||||
*/
|
||||
|
|
@ -59,8 +63,7 @@ public abstract class ClassEnhancePluginDefine extends AbstractClassEnhancePlugi
|
|||
public static final String CONTEXT_ATTR_NAME = "_$EnhancedClassField_ws";
|
||||
|
||||
/**
|
||||
* Begin to define how to enhance class.
|
||||
* After invoke this method, only means definition is finished.
|
||||
* Begin to define how to enhance class. After invoke this method, only means definition is finished.
|
||||
*
|
||||
* @param typeDescription target class description
|
||||
* @param newClassBuilder byte-buddy's builder to manipulate class bytecode.
|
||||
|
|
@ -68,8 +71,8 @@ public abstract class ClassEnhancePluginDefine extends AbstractClassEnhancePlugi
|
|||
*/
|
||||
@Override
|
||||
protected DynamicType.Builder<?> enhance(TypeDescription typeDescription,
|
||||
DynamicType.Builder<?> newClassBuilder, ClassLoader classLoader,
|
||||
EnhanceContext context) throws PluginException {
|
||||
DynamicType.Builder<?> newClassBuilder, ClassLoader classLoader,
|
||||
EnhanceContext context) throws PluginException {
|
||||
newClassBuilder = this.enhanceClass(typeDescription, newClassBuilder, classLoader);
|
||||
|
||||
newClassBuilder = this.enhanceInstance(typeDescription, newClassBuilder, classLoader, context);
|
||||
|
|
@ -128,11 +131,19 @@ public abstract class ClassEnhancePluginDefine extends AbstractClassEnhancePlugi
|
|||
*/
|
||||
if (existedConstructorInterceptPoint) {
|
||||
for (ConstructorInterceptPoint constructorInterceptPoint : constructorInterceptPoints) {
|
||||
newClassBuilder = newClassBuilder.constructor(constructorInterceptPoint.getConstructorMatcher()).intercept(SuperMethodCall.INSTANCE
|
||||
.andThen(MethodDelegation.withDefaultConfiguration()
|
||||
.to(new ConstructorInter(constructorInterceptPoint.getConstructorInterceptor(), classLoader))
|
||||
)
|
||||
);
|
||||
if (isBootstrapInstrumentation()) {
|
||||
newClassBuilder = newClassBuilder.constructor(constructorInterceptPoint.getConstructorMatcher()).intercept(SuperMethodCall.INSTANCE
|
||||
.andThen(MethodDelegation.withDefaultConfiguration()
|
||||
.to(BootstrapInstrumentBoost.forInternalDelegateClass(constructorInterceptPoint.getConstructorInterceptor()))
|
||||
)
|
||||
);
|
||||
} else {
|
||||
newClassBuilder = newClassBuilder.constructor(constructorInterceptPoint.getConstructorMatcher()).intercept(SuperMethodCall.INSTANCE
|
||||
.andThen(MethodDelegation.withDefaultConfiguration()
|
||||
.to(new ConstructorInter(constructorInterceptPoint.getConstructorInterceptor(), classLoader))
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -150,22 +161,43 @@ public abstract class ClassEnhancePluginDefine extends AbstractClassEnhancePlugi
|
|||
junction = junction.and(ElementMatchers.<MethodDescription>isDeclaredBy(typeDescription));
|
||||
}
|
||||
if (instanceMethodsInterceptPoint.isOverrideArgs()) {
|
||||
newClassBuilder =
|
||||
newClassBuilder.method(junction)
|
||||
.intercept(
|
||||
MethodDelegation.withDefaultConfiguration()
|
||||
.withBinders(
|
||||
Morph.Binder.install(OverrideCallable.class)
|
||||
)
|
||||
.to(new InstMethodsInterWithOverrideArgs(interceptor, classLoader))
|
||||
);
|
||||
if (isBootstrapInstrumentation()) {
|
||||
newClassBuilder =
|
||||
newClassBuilder.method(junction)
|
||||
.intercept(
|
||||
MethodDelegation.withDefaultConfiguration()
|
||||
.withBinders(
|
||||
Morph.Binder.install(OverrideCallable.class)
|
||||
)
|
||||
.to(BootstrapInstrumentBoost.forInternalDelegateClass(interceptor))
|
||||
);
|
||||
} else {
|
||||
newClassBuilder =
|
||||
newClassBuilder.method(junction)
|
||||
.intercept(
|
||||
MethodDelegation.withDefaultConfiguration()
|
||||
.withBinders(
|
||||
Morph.Binder.install(OverrideCallable.class)
|
||||
)
|
||||
.to(new InstMethodsInterWithOverrideArgs(interceptor, classLoader))
|
||||
);
|
||||
}
|
||||
} else {
|
||||
newClassBuilder =
|
||||
newClassBuilder.method(junction)
|
||||
.intercept(
|
||||
MethodDelegation.withDefaultConfiguration()
|
||||
.to(new InstMethodsInter(interceptor, classLoader))
|
||||
);
|
||||
if (isBootstrapInstrumentation()) {
|
||||
newClassBuilder =
|
||||
newClassBuilder.method(junction)
|
||||
.intercept(
|
||||
MethodDelegation.withDefaultConfiguration()
|
||||
.to(BootstrapInstrumentBoost.forInternalDelegateClass(interceptor))
|
||||
);
|
||||
} else {
|
||||
newClassBuilder =
|
||||
newClassBuilder.method(junction)
|
||||
.intercept(
|
||||
MethodDelegation.withDefaultConfiguration()
|
||||
.to(new InstMethodsInter(interceptor, classLoader))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -173,20 +205,6 @@ public abstract class ClassEnhancePluginDefine extends AbstractClassEnhancePlugi
|
|||
return newClassBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor methods intercept point. See {@link ConstructorInterceptPoint}
|
||||
*
|
||||
* @return collections of {@link ConstructorInterceptPoint}
|
||||
*/
|
||||
protected abstract ConstructorInterceptPoint[] getConstructorsInterceptPoints();
|
||||
|
||||
/**
|
||||
* Instance methods intercept point. See {@link InstanceMethodsInterceptPoint}
|
||||
*
|
||||
* @return collections of {@link InstanceMethodsInterceptPoint}
|
||||
*/
|
||||
protected abstract InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints();
|
||||
|
||||
/**
|
||||
* Enhance a class to intercept class static methods.
|
||||
*
|
||||
|
|
@ -209,31 +227,43 @@ public abstract class ClassEnhancePluginDefine extends AbstractClassEnhancePlugi
|
|||
}
|
||||
|
||||
if (staticMethodsInterceptPoint.isOverrideArgs()) {
|
||||
newClassBuilder = newClassBuilder.method(isStatic().and(staticMethodsInterceptPoint.getMethodsMatcher()))
|
||||
.intercept(
|
||||
MethodDelegation.withDefaultConfiguration()
|
||||
.withBinders(
|
||||
Morph.Binder.install(OverrideCallable.class)
|
||||
)
|
||||
.to(new StaticMethodsInterWithOverrideArgs(interceptor))
|
||||
);
|
||||
if (isBootstrapInstrumentation()) {
|
||||
newClassBuilder = newClassBuilder.method(isStatic().and(staticMethodsInterceptPoint.getMethodsMatcher()))
|
||||
.intercept(
|
||||
MethodDelegation.withDefaultConfiguration()
|
||||
.withBinders(
|
||||
Morph.Binder.install(OverrideCallable.class)
|
||||
)
|
||||
.to(BootstrapInstrumentBoost.forInternalDelegateClass(interceptor))
|
||||
);
|
||||
} else {
|
||||
newClassBuilder = newClassBuilder.method(isStatic().and(staticMethodsInterceptPoint.getMethodsMatcher()))
|
||||
.intercept(
|
||||
MethodDelegation.withDefaultConfiguration()
|
||||
.withBinders(
|
||||
Morph.Binder.install(OverrideCallable.class)
|
||||
)
|
||||
.to(new StaticMethodsInterWithOverrideArgs(interceptor))
|
||||
);
|
||||
}
|
||||
} else {
|
||||
newClassBuilder = newClassBuilder.method(isStatic().and(staticMethodsInterceptPoint.getMethodsMatcher()))
|
||||
.intercept(
|
||||
MethodDelegation.withDefaultConfiguration()
|
||||
.to(new StaticMethodsInter(interceptor))
|
||||
);
|
||||
if (isBootstrapInstrumentation()) {
|
||||
newClassBuilder = newClassBuilder.method(isStatic().and(staticMethodsInterceptPoint.getMethodsMatcher()))
|
||||
.intercept(
|
||||
MethodDelegation.withDefaultConfiguration()
|
||||
.to(BootstrapInstrumentBoost.forInternalDelegateClass(interceptor))
|
||||
);
|
||||
} else {
|
||||
newClassBuilder = newClassBuilder.method(isStatic().and(staticMethodsInterceptPoint.getMethodsMatcher()))
|
||||
.intercept(
|
||||
MethodDelegation.withDefaultConfiguration()
|
||||
.to(new StaticMethodsInter(interceptor))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return newClassBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static methods intercept point. See {@link StaticMethodsInterceptPoint}
|
||||
*
|
||||
* @return collections of {@link StaticMethodsInterceptPoint}
|
||||
*/
|
||||
protected abstract StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public abstract class ClassInstanceMethodsEnhancePluginDefine extends ClassEnhan
|
|||
* @return null, means enhance no static methods.
|
||||
*/
|
||||
@Override
|
||||
protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public abstract class ClassStaticMethodsEnhancePluginDefine extends ClassEnhance
|
|||
* @return null, means enhance no constructors.
|
||||
*/
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ public abstract class ClassStaticMethodsEnhancePluginDefine extends ClassEnhance
|
|||
* @return null, means enhance no instance methods.
|
||||
*/
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class MethodInterceptResult {
|
|||
/**
|
||||
* @return the new return value.
|
||||
*/
|
||||
Object _ret() {
|
||||
public Object _ret() {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@
|
|||
~
|
||||
-->
|
||||
|
||||
<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">
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
|
|
@ -64,7 +65,8 @@
|
|||
<createSourcesJar>true</createSourcesJar>
|
||||
<shadeSourcesContent>true</shadeSourcesContent>
|
||||
<transformers>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<transformer
|
||||
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<manifestEntries>
|
||||
<Premain-Class>${premain.class}</Premain-Class>
|
||||
</manifestEntries>
|
||||
|
|
@ -79,6 +81,7 @@
|
|||
<exclude>io.opencensus:*</exclude>
|
||||
<exclude>com.google.*:*</exclude>
|
||||
<exclude>com.google.guava:guava</exclude>
|
||||
<exclude>org.javassist:*</exclude>
|
||||
</excludes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
|
|
@ -110,7 +113,7 @@
|
|||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<delete dir="${project.basedir}/../../skywalking-agent" />
|
||||
<delete dir="${project.basedir}/../../skywalking-agent"/>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
@ -122,11 +125,15 @@
|
|||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<mkdir dir="${project.basedir}/../../skywalking-agent" />
|
||||
<copy file="${project.build.directory}/skywalking-agent.jar" tofile="${project.basedir}/../../skywalking-agent/skywalking-agent.jar" overwrite="true" />
|
||||
<mkdir dir="${project.basedir}/../../skywalking-agent/config" />
|
||||
<mkdir dir="${project.basedir}/../../skywalking-agent/logs" />
|
||||
<copydir src="${project.basedir}/../config" dest="${project.basedir}/../../skywalking-agent/config" forceoverwrite="true" />
|
||||
<mkdir dir="${project.basedir}/../../skywalking-agent"/>
|
||||
<copy file="${project.build.directory}/skywalking-agent.jar"
|
||||
tofile="${project.basedir}/../../skywalking-agent/skywalking-agent.jar"
|
||||
overwrite="true"/>
|
||||
<mkdir dir="${project.basedir}/../../skywalking-agent/config"/>
|
||||
<mkdir dir="${project.basedir}/../../skywalking-agent/logs"/>
|
||||
<copydir src="${project.basedir}/../config"
|
||||
dest="${project.basedir}/../../skywalking-agent/config" forceoverwrite="true"/>
|
||||
<mkdir dir="${project.basedir}/../../skywalking-agent/bootstrapJarTmp"/>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
package org.apache.skywalking.apm.agent;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.instrument.Instrumentation;
|
||||
import java.util.List;
|
||||
import net.bytebuddy.ByteBuddy;
|
||||
|
|
@ -41,6 +42,7 @@ import org.apache.skywalking.apm.agent.core.plugin.EnhanceContext;
|
|||
import org.apache.skywalking.apm.agent.core.plugin.PluginBootstrap;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.PluginException;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.PluginFinder;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.bootstrap.BootstrapInstrumentBoost;
|
||||
|
||||
import static net.bytebuddy.matcher.ElementMatchers.nameContains;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.nameStartsWith;
|
||||
|
|
@ -61,7 +63,7 @@ public class SkyWalkingAgent {
|
|||
* @param instrumentation
|
||||
* @throws PluginException
|
||||
*/
|
||||
public static void premain(String agentArgs, Instrumentation instrumentation) throws PluginException {
|
||||
public static void premain(String agentArgs, Instrumentation instrumentation) throws PluginException, IOException {
|
||||
final PluginFinder pluginFinder;
|
||||
try {
|
||||
SnifferConfigInitializer.initialize(agentArgs);
|
||||
|
|
@ -69,20 +71,20 @@ public class SkyWalkingAgent {
|
|||
pluginFinder = new PluginFinder(new PluginBootstrap().loadPlugins());
|
||||
|
||||
} catch (ConfigNotFoundException ce) {
|
||||
logger.error(ce, "Skywalking agent could not find config. Shutting down.");
|
||||
logger.error(ce, "SkyWalking agent could not find config. Shutting down.");
|
||||
return;
|
||||
} catch (AgentPackageNotFoundException ape) {
|
||||
logger.error(ape, "Locate agent.jar failure. Shutting down.");
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
logger.error(e, "Skywalking agent initialized failure. Shutting down.");
|
||||
logger.error(e, "SkyWalking agent initialized failure. Shutting down.");
|
||||
return;
|
||||
}
|
||||
|
||||
final ByteBuddy byteBuddy = new ByteBuddy()
|
||||
.with(TypeValidation.of(Config.Agent.IS_OPEN_DEBUGGING_CLASS));
|
||||
|
||||
new AgentBuilder.Default(byteBuddy)
|
||||
AgentBuilder agentBuilder = new AgentBuilder.Default(byteBuddy)
|
||||
.ignore(
|
||||
nameStartsWith("net.bytebuddy.")
|
||||
.or(nameStartsWith("org.slf4j."))
|
||||
|
|
@ -92,7 +94,16 @@ public class SkyWalkingAgent {
|
|||
.or(nameContains(".asm."))
|
||||
.or(nameStartsWith("sun.reflect"))
|
||||
.or(allSkyWalkingAgentExcludeToolkit())
|
||||
.or(ElementMatchers.<TypeDescription>isSynthetic()))
|
||||
.or(ElementMatchers.<TypeDescription>isSynthetic()));
|
||||
|
||||
try {
|
||||
agentBuilder = BootstrapInstrumentBoost.inject(pluginFinder, agentBuilder, instrumentation);
|
||||
} catch (Exception e) {
|
||||
logger.error(e, "SkyWalking agent inject boostrap instrumentation failure. Shutting down.");
|
||||
return;
|
||||
}
|
||||
|
||||
agentBuilder
|
||||
.type(pluginFinder.buildMatch())
|
||||
.transform(new Transformer(pluginFinder))
|
||||
.with(new Listener())
|
||||
|
|
@ -132,7 +143,7 @@ public class SkyWalkingAgent {
|
|||
}
|
||||
}
|
||||
if (context.isEnhanced()) {
|
||||
logger.debug("Finish the prepare stage for {}.", typeDescription.getName());
|
||||
logger.debug("Finish the loadHighPriorityClass stage for {}.", typeDescription.getName());
|
||||
}
|
||||
|
||||
return newBuilder;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class ActiveMQConsumerInstrumentation extends ClassInstanceMethodsEnhance
|
|||
public static final String ENHANCE_METHOD_DISPATCH = "dispatch";
|
||||
public static final String CONSTRUCTOR_INTERCEPT_TYPE = "org.apache.activemq.ActiveMQSession";
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getConstructorMatcher() {
|
||||
|
|
@ -57,7 +57,7 @@ public class ActiveMQConsumerInstrumentation extends ClassInstanceMethodsEnhance
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class ActiveMQProducerInstrumentation extends ClassInstanceMethodsEnhance
|
|||
public static final String ENHANCE_METHOD = "send";
|
||||
public static final String CONSTRUCTOR_INTERCEPT_TYPE = "org.apache.activemq.ActiveMQSession";
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getConstructorMatcher() {
|
||||
|
|
@ -57,7 +57,7 @@ public class ActiveMQProducerInstrumentation extends ClassInstanceMethodsEnhance
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class CanalInstrumentation extends ClassInstanceMethodsEnhancePluginDefin
|
|||
public static final String ENHANCE_METHOD_DISPATCH = "getWithoutAck";
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getConstructorMatcher() {
|
||||
|
|
@ -55,7 +55,7 @@ public class CanalInstrumentation extends ClassInstanceMethodsEnhancePluginDefin
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class ClusterNodeInstrumentation extends ClassInstanceMethodsEnhancePlugi
|
|||
public static final String CONSTRUCTOR_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.canal.ClusterNodeConstructInterceptor";
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getConstructorMatcher() {
|
||||
|
|
@ -52,7 +52,7 @@ public class ClusterNodeInstrumentation extends ClassInstanceMethodsEnhancePlugi
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[0];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName
|
|||
* methods to ensure the correct compilation of the code.
|
||||
*/
|
||||
public class WrapperInstrumentation extends ClassStaticMethodsEnhancePluginDefine {
|
||||
@Override protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
@Override public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
return new StaticMethodsInterceptPoint[] {
|
||||
new StaticMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -40,12 +40,12 @@ public class DubboInstrumentation extends ClassInstanceMethodsEnhancePluginDefin
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName
|
|||
* @author Zhang Xin
|
||||
*/
|
||||
public class WrapperInstrumentation extends ClassStaticMethodsEnhancePluginDefine {
|
||||
@Override protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
@Override public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
return new StaticMethodsInterceptPoint[] {
|
||||
new StaticMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -39,12 +39,12 @@ public class DubboInstrumentation extends ClassInstanceMethodsEnhancePluginDefin
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -40,11 +40,11 @@ public class JobExecutorInstrumentation extends ClassInstanceMethodsEnhancePlugi
|
|||
|
||||
private static final String JOB_EXECUTOR_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.esjob.JobExecutorInterceptor";
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[]{
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import static net.bytebuddy.matcher.ElementMatchers.any;
|
|||
import static org.apache.skywalking.apm.agent.core.plugin.match.HierarchyMatch.byHierarchyMatch;
|
||||
|
||||
public class GenericActionInstrumentation extends ClassEnhancePluginDefine {
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getConstructorMatcher() {
|
||||
|
|
@ -43,11 +43,11 @@ public class GenericActionInstrumentation extends ClassEnhancePluginDefine {
|
|||
};
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
@Override public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
return new StaticMethodsInterceptPoint[0];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,12 +35,12 @@ import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName
|
|||
public class PlainListenableActionFutureInstrumentation extends ClassEnhancePluginDefine {
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[]{
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
@ -62,7 +62,7 @@ public class PlainListenableActionFutureInstrumentation extends ClassEnhancePlug
|
|||
}
|
||||
|
||||
@Override
|
||||
protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
return new StaticMethodsInterceptPoint[0];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class TransportActionNodeProxyInstrumentation extends ClassEnhancePluginD
|
|||
public static final String ENHANC_CLASS = "org.elasticsearch.action.TransportActionNodeProxy";
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[]{
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getConstructorMatcher() {
|
||||
|
|
@ -54,7 +54,7 @@ public class TransportActionNodeProxyInstrumentation extends ClassEnhancePluginD
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[]{
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
@ -76,7 +76,7 @@ public class TransportActionNodeProxyInstrumentation extends ClassEnhancePluginD
|
|||
}
|
||||
|
||||
@Override
|
||||
protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
return new StaticMethodsInterceptPoint[0];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,11 +33,11 @@ public class TransportClientNodesServiceInstrumentation extends ClassInstanceMet
|
|||
public static final String REMOVE_TRANSPORT_ADDRESS_INTERCEPTOR = "org.apache.skywalking.apm.plugin.elasticsearch.v5.RemoveTransportAddressInterceptor";
|
||||
public static final String ENHANCE_CLASS = "org.elasticsearch.client.transport.TransportClientNodesService";
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[]{
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class TransportProxyClientInstrumentation extends ClassInstanceMethodsEnh
|
|||
private static final String ENHANCE_CLASS = "org.apache.skywalking.apm.plugin.elasticsearch.v5.TransportProxyClientInterceptor";
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override
|
||||
|
|
@ -54,12 +54,12 @@ public class TransportProxyClientInstrumentation extends ClassInstanceMethodsEnh
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
return new StaticMethodsInterceptPoint[0];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,11 +44,11 @@ public class DefaultHttpClientInstrumentation extends ClassInstanceMethodsEnhanc
|
|||
return byName(ENHANCE_CLASS);
|
||||
}
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -36,11 +36,11 @@ public class AbstractServerImplBuilderInstrumentation extends ClassInstanceMetho
|
|||
public static final String INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.grpc.v1.AbstractServerImplBuilderInterceptor";
|
||||
public static final String ARGUMENT_TYPE = "io.grpc.ServerServiceDefinition";
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class AbstractStubInstrumentation extends ClassInstanceMethodsEnhancePlug
|
|||
public static final String ENHANCE_CLASS = "io.grpc.stub.AbstractStub";
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getConstructorMatcher() {
|
||||
|
|
@ -50,7 +50,7 @@ public class AbstractStubInstrumentation extends ClassInstanceMethodsEnhancePlug
|
|||
};
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class ClientCallsInstrumentation extends ClassStaticMethodsEnhancePluginD
|
|||
private static final String INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.grpc.v1.BlockingCallInterceptor";
|
||||
private static final String FUTURE_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.grpc.v1.AsyncUnaryRequestCallCallInterceptor";
|
||||
|
||||
@Override protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
@Override public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
return new StaticMethodsInterceptPoint[] {
|
||||
new StaticMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -42,11 +42,11 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
|
|||
*/
|
||||
public abstract class AbstractConnectionInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class JdbcXAConnectionInstrumentation extends AbstractConnectionInstrumen
|
|||
public static final String ENHANCE_CLASS = "org.h2.jdbcx.JdbcXAConnection";
|
||||
public static final String CONSTRUCTOR_INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.jdbc.jdbc.JdbcXAConnectionConstructorInterceptor";
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getConstructorMatcher() {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class PooledJdbcConnectionInstrumentation extends AbstractConnectionInstr
|
|||
public static final String CONSTRUCTOR_INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.jdbc.h2.PooledJdbcConnectionConstructorInterceptor";
|
||||
public static final String ENHANCE_CLASS = "org.h2.jdbcx.JdbcXAConnection$PooledJdbcConnection";
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getConstructorMatcher() {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class AbstractHttpClientInstrumentation extends HttpClientInstrumentation
|
|||
* public final HttpResponse execute(HttpHost target, HttpRequest request, HttpContext context)
|
||||
*/
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class DefaultRequestDirectorInstrumentation extends HttpClientInstrumenta
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public abstract class HttpClientInstrumentation extends ClassInstanceMethodsEnha
|
|||
private static final String INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.httpClient.v4.HttpClientExecuteInterceptor";
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class InternalHttpClientInstrumentation extends HttpClientInstrumentation
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class MinimalHttpClientInstrumentation extends HttpClientInstrumentation
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -43,12 +43,12 @@ public class HttpAsyncClientInstrumentation extends ClassInstanceMethodsEnhanceP
|
|||
private static final String FIRST_ARG_TYPE = "org.apache.http.nio.protocol.HttpAsyncRequestProducer";
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[]{new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -39,12 +39,12 @@ public class HttpAsyncRequestExecutorInstrumentation extends ClassInstanceMethod
|
|||
private static final String INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.httpasyncclient.v4.HttpAsyncRequestExecutorInterceptor";
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[]{new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class SessionRequestInstrumentation extends ClassInstanceMethodsEnhancePl
|
|||
private static final String ENHANCE_CLASS = "org.apache.http.impl.nio.reactor.SessionRequestImpl";
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[]{new ConstructorInterceptPoint() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> getConstructorMatcher() {
|
||||
|
|
@ -62,7 +62,7 @@ public class SessionRequestInstrumentation extends ClassInstanceMethodsEnhancePl
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[]{new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class HystrixCommandInstrumentation extends ClassInstanceMethodsEnhancePl
|
|||
public static final String INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.hystrix.v1.HystrixCommandConstructorInterceptor";
|
||||
public static final String ENHANCE_CLASS = "com.netflix.hystrix.HystrixCommand";
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getConstructorMatcher() {
|
||||
|
|
@ -48,7 +48,7 @@ public class HystrixCommandInstrumentation extends ClassInstanceMethodsEnhancePl
|
|||
};
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -37,12 +37,12 @@ public class HystrixPluginsInstrumentation extends ClassInstanceMethodsEnhancePl
|
|||
public static final String ENHANCE_CLASS = "com.netflix.hystrix.strategy.HystrixPlugins";
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@ public abstract class AbstractDriverInstrumentation extends ClassInstanceMethods
|
|||
private static final String DRIVER_INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.jdbc.JDBCDriverInterceptor";
|
||||
|
||||
@Override
|
||||
protected final ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public final ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class JedisClusterInstrumentation extends ClassInstanceMethodsEnhancePlug
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override
|
||||
|
|
@ -73,7 +73,7 @@ public class JedisClusterInstrumentation extends ClassInstanceMethodsEnhancePlug
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class JedisInstrumentation extends ClassInstanceMethodsEnhancePluginDefin
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override
|
||||
|
|
@ -98,7 +98,7 @@ public class JedisInstrumentation extends ClassInstanceMethodsEnhancePluginDefin
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@ public class HttpRequestInstrumentation extends ClassInstanceMethodsEnhancePlugi
|
|||
private static final String ENHANCE_CLASS_NAME = "send";
|
||||
public static final String SYNC_SEND_INTERCEPTOR = "org.apache.skywalking.apm.plugin.jetty.v90.client.SyncHttpRequestSendV90Interceptor";
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
//sync call interceptor point
|
||||
|
|
|
|||
|
|
@ -44,11 +44,11 @@ public class HttpRequestInstrumentation extends ClassInstanceMethodsEnhancePlugi
|
|||
private static final String ENHANCE_CLASS_NAME = "send";
|
||||
public static final String SYNC_SEND_INTERCEPTOR = "org.apache.skywalking.apm.plugin.jetty.v9.client.SyncHttpRequestSendInterceptor";
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
//sync call interceptor point
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class DispatcherInstrumentation extends ClassInstanceMethodsEnhancePlugin
|
|||
private static final String ENHANCE_CLASS = "org.eclipse.jetty.server.Dispatcher";
|
||||
public static final String INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.jetty.v9.server.ForwardInterceptor";
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getConstructorMatcher() {
|
||||
|
|
@ -49,7 +49,7 @@ public class DispatcherInstrumentation extends ClassInstanceMethodsEnhancePlugin
|
|||
};
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -40,11 +40,11 @@ public class JettyInstrumentation extends ClassInstanceMethodsEnhancePluginDefin
|
|||
private static final String ENHANCE_METHOD = "handle";
|
||||
private static final String INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.jetty.v9.server.HandleInterceptor";
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -33,11 +33,11 @@ public class CallbackInstrumentation extends AbstractKafkaInstrumentation {
|
|||
public static final String ENHANCE_METHOD = "onCompletion";
|
||||
public static final String INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.kafka.v1.CallbackInterceptor";
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class KafkaConsumerInstrumentation extends AbstractKafkaInstrumentation {
|
|||
public static final String SUBSCRIBE_INTERCEPT_TYPE = "org.apache.kafka.clients.consumer.ConsumerRebalanceListener";
|
||||
public static final String SUBSCRIBE_INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.kafka.v1.SubscribeMethodInterceptor";
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getConstructorMatcher() {
|
||||
|
|
@ -65,7 +65,7 @@ public class KafkaConsumerInstrumentation extends AbstractKafkaInstrumentation {
|
|||
};
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class KafkaProducerInstrumentation extends AbstractKafkaInstrumentation {
|
|||
public static final String CONSTRUCTOR_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.kafka.v1.ProducerConstructorInterceptor";
|
||||
public static final String CONSTRUCTOR_INTERCEPTOR_FLAG = "org.apache.kafka.clients.producer.ProducerConfig";
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getConstructorMatcher() {
|
||||
|
|
@ -62,7 +62,7 @@ public class KafkaProducerInstrumentation extends AbstractKafkaInstrumentation {
|
|||
};
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class ProducerRecordInstrumentation extends AbstractKafkaInstrumentation
|
|||
public static final String CONSTRUCTOR_INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.kafka.v1.ProducerRecordConstructorInterceptor";
|
||||
public static final String ENHANCE_CLASS = "org.apache.kafka.clients.producer.ProducerRecord";
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getConstructorMatcher() {
|
||||
|
|
@ -46,7 +46,7 @@ public class ProducerRecordInstrumentation extends AbstractKafkaInstrumentation
|
|||
};
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[0];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class MongoDBCollectionImplInstrumentation extends ClassInstanceMethodsEn
|
|||
private static final String MONGDB_METHOD_INTERCET_CLASS = "org.apache.skywalking.apm.plugin.mongodb.v2.MongoDBCollectionMethodInterceptor";
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override
|
||||
|
|
@ -68,7 +68,7 @@ public class MongoDBCollectionImplInstrumentation extends ClassInstanceMethodsEn
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
|
||||
new InterceptPoint() {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class MongoDBCollectionInstrumentation extends ClassInstanceMethodsEnhanc
|
|||
private static final String MONGDB_METHOD_INTERCET_CLASS = "org.apache.skywalking.apm.plugin.mongodb.v2.MongoDBCollectionMethodInterceptor";
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override
|
||||
|
|
@ -71,7 +71,7 @@ public class MongoDBCollectionInstrumentation extends ClassInstanceMethodsEnhanc
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
|
||||
new InterceptPoint() {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class MongoDBInstrumentation extends ClassInstanceMethodsEnhancePluginDef
|
|||
private static final String MONGDB_METHOD_INTERCET_CLASS = "org.apache.skywalking.apm.plugin.mongodb.v3.MongoDBMethodInterceptor";
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override
|
||||
|
|
@ -54,7 +54,7 @@ public class MongoDBInstrumentation extends ClassInstanceMethodsEnhancePluginDef
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class MotanConsumerInstrumentation extends ClassInstanceMethodsEnhancePlu
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override
|
||||
|
|
@ -67,7 +67,7 @@ public class MotanConsumerInstrumentation extends ClassInstanceMethodsEnhancePlu
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -40,12 +40,12 @@ public class MotanProviderInstrumentation extends ClassInstanceMethodsEnhancePlu
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -42,11 +42,11 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
|
|||
*/
|
||||
public abstract class AbstractConnectionInstrumentation extends AbstractMysqlInstrumentation {
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -28,16 +28,16 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassEnha
|
|||
*/
|
||||
public abstract class AbstractMysqlInstrumentation extends ClassEnhancePluginDefine {
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,12 +39,12 @@ public class CacheIpsInstrumentation extends AbstractMysqlInstrumentation {
|
|||
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@ public class CallableInstrumentation extends AbstractMysqlInstrumentation {
|
|||
private static final String ENHANCE_CLASS = "com.mysql.jdbc.CallableStatement";
|
||||
private static final String SERVICE_METHOD_INTERCEPTOR = org.apache.skywalking.apm.plugin.jdbc.mysql.Constants.PREPARED_STATEMENT_EXECUTE_METHODS_INTERCEPTOR;
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class ConnectionImplCreateInstrumentation extends AbstractMysqlInstrument
|
|||
|
||||
private static final String CONNECT_METHOD = "getInstance";
|
||||
@Override
|
||||
protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
return new StaticMethodsInterceptPoint[] {
|
||||
new StaticMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import org.apache.skywalking.apm.plugin.jdbc.PSSetterDefinitionOfJDBCInstrumenta
|
|||
*/
|
||||
public class PreparedStatementIgnoredSetterInstrumentation extends PreparedStatementInstrumentation {
|
||||
@Override
|
||||
protected final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new PSSetterDefinitionOfJDBCInstrumentation(true)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@ public class PreparedStatementInstrumentation extends AbstractMysqlInstrumentati
|
|||
public static final String MYSQL_PREPARED_STATEMENT_CLASS_NAME = "com.mysql.jdbc.PreparedStatement";
|
||||
public static final String JDBC42_PREPARED_STATEMENT_CLASS_NAME = "com.mysql.jdbc.JDBC42PreparedStatement";
|
||||
|
||||
@Override protected final ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public final ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import org.apache.skywalking.apm.plugin.jdbc.JDBCPreparedStatementNullSetterInst
|
|||
public class PreparedStatementNullSetterInstrumentation extends PreparedStatementInstrumentation {
|
||||
|
||||
@Override
|
||||
protected final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new JDBCPreparedStatementNullSetterInstanceMethodsInterceptPoint()
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import org.apache.skywalking.apm.plugin.jdbc.PSSetterDefinitionOfJDBCInstrumenta
|
|||
public class PreparedStatementSetterInstrumentation extends PreparedStatementInstrumentation {
|
||||
|
||||
@Override
|
||||
protected final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new PSSetterDefinitionOfJDBCInstrumentation(false)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@ public class StatementInstrumentation extends AbstractMysqlInstrumentation {
|
|||
private static final String SERVICE_METHOD_INTERCEPTOR = org.apache.skywalking.apm.plugin.jdbc.mysql.Constants.STATEMENT_EXECUTE_METHODS_INTERCEPTOR;
|
||||
public static final String MYSQL_STATEMENT_CLASS_NAME = "com.mysql.jdbc.StatementImpl";
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -28,16 +28,16 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassEnha
|
|||
*/
|
||||
public abstract class AbstractMysqlInstrumentation extends ClassEnhancePluginDefine {
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,12 +37,12 @@ public class CacheIpsInstrumentation extends AbstractMysqlInstrumentation {
|
|||
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[]{new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@ public class CallableInstrumentation extends AbstractMysqlInstrumentation {
|
|||
private static final String ENHANCE_CLASS = "com.mysql.jdbc.cj.CallableStatement";
|
||||
private static final String SERVICE_METHOD_INTERCEPTOR = org.apache.skywalking.apm.plugin.jdbc.mysql.Constants.PREPARED_STATEMENT_EXECUTE_METHODS_INTERCEPTOR;
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class ConnectionImplCreateInstrumentation extends AbstractMysqlInstrument
|
|||
|
||||
|
||||
@Override
|
||||
protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
return new StaticMethodsInterceptPoint[]{
|
||||
new StaticMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ public class ConnectionInstrumentation extends AbstractMysqlInstrumentation {
|
|||
return byName(ENHANCE_CLASS);
|
||||
}
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import org.apache.skywalking.apm.plugin.jdbc.PSSetterDefinitionOfJDBCInstrumenta
|
|||
public class PreparedStatementIgnoredSetterInstrumentation extends PreparedStatementInstrumentation {
|
||||
|
||||
@Override
|
||||
protected final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new PSSetterDefinitionOfJDBCInstrumentation(true)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ public class PreparedStatementInstrumentation extends AbstractMysqlInstrumentati
|
|||
private static final String SERVICE_METHOD_INTERCEPTOR = org.apache.skywalking.apm.plugin.jdbc.mysql.Constants.PREPARED_STATEMENT_EXECUTE_METHODS_INTERCEPTOR;
|
||||
public static final String MYSQL6_PREPARED_STATEMENT_CLASS_NAME = "com.mysql.cj.jdbc.PreparedStatement";
|
||||
|
||||
@Override protected final ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public final ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import org.apache.skywalking.apm.plugin.jdbc.JDBCPreparedStatementNullSetterInst
|
|||
public class PreparedStatementNullSetterInstrumentation extends PreparedStatementInstrumentation {
|
||||
|
||||
@Override
|
||||
protected final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new JDBCPreparedStatementNullSetterInstanceMethodsInterceptPoint()
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import org.apache.skywalking.apm.plugin.jdbc.PSSetterDefinitionOfJDBCInstrumenta
|
|||
public class PreparedStatementSetterInstrumentation extends PreparedStatementInstrumentation {
|
||||
|
||||
@Override
|
||||
protected final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new PSSetterDefinitionOfJDBCInstrumentation(false)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@ public class StatementInstrumentation extends AbstractMysqlInstrumentation {
|
|||
private static final String SERVICE_METHOD_INTERCEPTOR = org.apache.skywalking.apm.plugin.jdbc.mysql.Constants.STATEMENT_EXECUTE_METHODS_INTERCEPTOR;
|
||||
public static final String MYSQL6_STATEMENT_CLASS_NAME = "com.mysql.cj.jdbc.StatementImpl";
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -29,16 +29,16 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassEnha
|
|||
public abstract class AbstractMysqlInstrumentation extends ClassEnhancePluginDefine {
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ public class CallableInstrumentation extends AbstractMysqlInstrumentation {
|
|||
private static final String ENHANCE_CLASS = "com.mysql.cj.jdbc.CallableStatement";
|
||||
private static final String SERVICE_METHOD_INTERCEPTOR = org.apache.skywalking.apm.plugin.jdbc.mysql.Constants.PREPARED_STATEMENT_EXECUTE_METHODS_INTERCEPTOR;
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class ConnectionImplCreateInstrumentation extends AbstractMysqlInstrument
|
|||
|
||||
|
||||
@Override
|
||||
protected StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
return new StaticMethodsInterceptPoint[] {
|
||||
new StaticMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@ import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName
|
|||
|
||||
public class ConnectionInstrumentation extends AbstractMysqlInstrumentation {
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import org.apache.skywalking.apm.plugin.jdbc.PSSetterDefinitionOfJDBCInstrumenta
|
|||
public class PreparedStatementIgnoredSetterInstrumentation extends PreparedStatementInstrumentation {
|
||||
|
||||
@Override
|
||||
protected final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new PSSetterDefinitionOfJDBCInstrumentation(true)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -36,11 +36,11 @@ public class PreparedStatementInstrumentation extends AbstractMysqlInstrumentati
|
|||
|
||||
private static final String SERVICE_METHOD_INTERCEPTOR = Constants.PREPARED_STATEMENT_EXECUTE_METHODS_INTERCEPTOR;
|
||||
|
||||
@Override protected final ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public final ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import org.apache.skywalking.apm.plugin.jdbc.JDBCPreparedStatementNullSetterInst
|
|||
public class PreparedStatementNullSetterInstrumentation extends PreparedStatementInstrumentation {
|
||||
|
||||
@Override
|
||||
protected final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new JDBCPreparedStatementNullSetterInstanceMethodsInterceptPoint()
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import org.apache.skywalking.apm.plugin.jdbc.PSSetterDefinitionOfJDBCInstrumenta
|
|||
public class PreparedStatementSetterInstrumentation extends PreparedStatementInstrumentation {
|
||||
|
||||
@Override
|
||||
protected final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public final InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new PSSetterDefinitionOfJDBCInstrumentation(false)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@ public class StatementInstrumentation extends AbstractMysqlInstrumentation {
|
|||
private static final String SERVICE_METHOD_INTERCEPTOR = org.apache.skywalking.apm.plugin.jdbc.mysql.Constants.STATEMENT_EXECUTE_METHODS_INTERCEPTOR;
|
||||
public static final String MYSQL8_STATEMENT_CLASS_NAME = "com.mysql.cj.jdbc.StatementImpl";
|
||||
|
||||
@Override protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
@Override public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[0];
|
||||
}
|
||||
|
||||
@Override protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
@Override public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public abstract class AbstractNutzHttpInstrumentation extends ClassInstanceMetho
|
|||
private static final String DO_CONSTRUCTOR_INTERCEPTOR = "org.apache.skywalking.apm.plugin.nutz.http.sync.SenderConstructorInterceptor";
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override
|
||||
|
|
@ -53,7 +53,7 @@ public abstract class AbstractNutzHttpInstrumentation extends ClassInstanceMetho
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class ActionInstrumentation extends ClassInstanceMethodsEnhancePluginDefi
|
|||
public static final String ENHANCE_ANNOTATION = "org.nutz.mvc.annotation.At";
|
||||
|
||||
@Override
|
||||
protected ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
|
||||
return new ConstructorInterceptPoint[] {
|
||||
new ConstructorInterceptPoint() {
|
||||
@Override
|
||||
|
|
@ -53,7 +53,7 @@ public class ActionInstrumentation extends ClassInstanceMethodsEnhancePluginDefi
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
|
||||
return new InstanceMethodsInterceptPoint[] {
|
||||
new InstanceMethodsInterceptPoint() {
|
||||
@Override
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue