use of com.shulie.instrument.simulator.api.instrument.InstrumentMethod in project LinkAgent by shulieTech.
the class HbasePlugin method onActive.
@Override
public boolean onActive() throws Throwable {
addDdlTracer();
enhanceTemplate.enhance(this, "com.flipkart.hbaseobjectmapper.WrappedHBTable", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
InstrumentMethod instrumentMethod = target.getDeclaredMethod("getName");
instrumentMethod.addInterceptor(Listeners.of(WrappedHBTableGetNameInterceptor.class));
}
});
enhanceTemplate.enhance(this, "org.apache.hadoop.hbase.client.HTable", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
InstrumentMethod getMethod = target.getDeclaredMethod("get", "org.apache.hadoop.hbase.client.Get");
getMethod.addInterceptor(Listeners.of(HbaseInterceptor.class, "HBASE_OP_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod method = target.getDeclaredMethods("append", "increment", "exists", "existsAll", "getScanner", "put", "checkAndPut", "delete", "checkAndDelete", "mutateRow", "checkAndMutate");
method.addInterceptor(Listeners.of(HbaseInterceptor.class, "HBASE_OP_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
}
});
enhanceTemplate.enhance(this, "org.apache.hadoop.hbase.client.AliHBaseUETable", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
InstrumentMethod getMethod = target.getDeclaredMethod("get", "org.apache.hadoop.hbase.client.Get");
getMethod.addInterceptor(Listeners.of(AliHBaseUETableInterceptor.class, "HBASE_OP_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod methods = target.getDeclaredMethods("append", "increment", "exists", "existsAll", "getScanner", "put", "checkAndPut", "delete", "checkAndDelete", "mutateRow", "checkAndMutate");
methods.addInterceptor(Listeners.of(AliHBaseUETableInterceptor.class, "HBASE_OP_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
}
});
enhanceTemplate.enhance(this, "org.apache.hadoop.hbase.client.AliHBaseMultiTable", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
InstrumentMethod getMethod = target.getDeclaredMethod("get", "org.apache.hadoop.hbase.client.Get");
getMethod.addInterceptor(Listeners.of(AliHBaseMultiTableInterceptor.class, "HBASE_OP_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod methods = target.getDeclaredMethods("append", "increment", "exists", "existsAll", "getScanner", "put", "checkAndPut", "delete", "checkAndDelete", "mutateRow", "checkAndMutate");
methods.addInterceptor(Listeners.of(AliHBaseMultiTableInterceptor.class, "HBASE_OP_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
}
});
enhanceTemplate.enhance(this, "org.apache.hadoop.hbase.ipc.AbstractRpcClient", new RpcClientImplTransform());
enhanceTemplate.enhance(this, "org.hbase.async.HBaseClient", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
InstrumentMethod method = target.getDeclaredMethod("sendRpcToRegion", "org.hbase.async.HBaseRpc");
method.addInterceptor(Listeners.of(AsyncHbaseMethodInterceptor.class));
}
});
// 影子表模式
enhanceTemplate.enhance(this, "org.apache.hadoop.hbase.TableName", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
InstrumentMethod valueOfMethod0 = target.getDeclaredMethod("valueOf", "byte[]");
valueOfMethod0.addInterceptor(Listeners.of(HbaseTableInterceptor.class, "HBASE_OP_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod valueOfMethod1 = target.getDeclaredMethod("valueOf", "java.lang.String");
valueOfMethod1.addInterceptor(Listeners.of(HbaseTableInterceptor.class, "HBASE_OP_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod valueOfMethod2 = target.getDeclaredMethod("valueOf", "java.lang.String", "java.lang.String");
valueOfMethod2.addInterceptor(Listeners.of(HbaseTableValueOfInterceptor.class, "HBASE_OP_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod valueOfMethod3 = target.getDeclaredMethod("valueOf", "byte[]", "byte[]");
valueOfMethod3.addInterceptor(Listeners.of(HbaseTableValueOfInterceptor.class, "HBASE_OP_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod valueOfMethod4 = target.getDeclaredMethod("valueOf", "java.nio.ByteBuffer", "java.nio.ByteBuffer");
valueOfMethod4.addInterceptor(Listeners.of(HbaseTableValueOfInterceptor.class, "HBASE_OP_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
}
});
// 影子表模式
enhanceTemplate.enhance(this, "com.alibaba.lindorm.client.core.LindormWideColumnService", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
target.getDeclaredMethod("get", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WGet").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("put", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WPut").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("append", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WAppend").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("increment", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WIncrement").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("delete", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WDelete").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("exists", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WGet").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("addColumn", "java.lang.String", "java.util.List").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("addColumn", "java.lang.String", "com.alibaba.lindorm.client.schema.ColumnSchema", "int").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("addColumn", "java.lang.String", "java.util.List", "int").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("addColumn", "java.lang.String", "com.alibaba.lindorm.client.schema.ColumnSchema").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("existsAsync", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WGet").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("existsAsync", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WGet", "com.alibaba.lindorm.client.AsyncCallback").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("getAsync", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WGet", "com.alibaba.lindorm.client.AsyncCallback").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("getAsync", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WGet").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("batchGet", "java.lang.String", "java.util.List").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("batchGetAsync", "java.lang.String", "java.util.List").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("batchGetAsync", "java.lang.String", "java.util.List", "com.alibaba.lindorm.client.AsyncCallback").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("getScanner", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WScan").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("putAsync", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WPut", "com.alibaba.lindorm.client.AsyncCallback").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("putAsync", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WPut").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("batchPut", "java.lang.String", "java.util.List").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("batchPutAsync", "java.lang.String", "java.util.List").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("batchPutAsync", "java.lang.String", "java.util.List", "com.alibaba.lindorm.client.AsyncCallback").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("checkAndPut", "java.lang.String", "byte[]", "byte[]", "byte[]", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.WPut").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("checkAndPut", "java.lang.String", "byte[]", "byte[]", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.filter.WCompareFilter$CompareOp", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.WPut").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("checkAndPutAsync", "java.lang.String", "byte[]", "byte[]", "byte[]", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.WPut", "com.alibaba.lindorm.client.AsyncCallback").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("checkAndPutAsync", "java.lang.String", "byte[]", "byte[]", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.filter.WCompareFilter$CompareOp", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.WPut", "com.alibaba.lindorm.client.AsyncCallback").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("checkAndPutAsync", "java.lang.String", "byte[]", "byte[]", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.filter.WCompareFilter$CompareOp", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.WPut").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("checkAndPutAsync", "java.lang.String", "byte[]", "byte[]", "byte[]", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.WPut").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("deleteAsync", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WDelete").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("deleteAsync", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WDelete", "com.alibaba.lindorm.client.AsyncCallback").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("batchDelete", "java.lang.String", "java.util.List").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("batchDeleteAsync", "java.lang.String", "java.util.List").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("batchDeleteAsync", "java.lang.String", "java.util.List", "com.alibaba.lindorm.client.AsyncCallback").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("checkAndDelete", "java.lang.String", "byte[]", "byte[]", "byte[]", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.WDelete").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("checkAndDelete", "java.lang.String", "byte[]", "byte[]", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.filter.WCompareFilter$CompareOp", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.WDelete").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("checkAndDeleteAsync", "java.lang.String", "byte[]", "byte[]", "byte[]", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.WDelete", "com.alibaba.lindorm.client.AsyncCallback").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("checkAndDeleteAsync", "java.lang.String", "byte[]", "byte[]", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.filter.WCompareFilter$CompareOp", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.WDelete").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("checkAndDeleteAsync", "java.lang.String", "byte[]", "byte[]", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.filter.WCompareFilter$CompareOp", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.WDelete", "com.alibaba.lindorm.client.AsyncCallback").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("checkAndDeleteAsync", "java.lang.String", "byte[]", "byte[]", "byte[]", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.WDelete").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("checkAndMutate", "java.lang.String", "byte[]", "byte[]", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.filter.WCompareFilter$CompareOp", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.WRowMutations").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("checkAndMutateAsync", "java.lang.String", "byte[]", "byte[]", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.filter.WCompareFilter$CompareOp", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.WRowMutations").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("checkAndMutateAsync", "java.lang.String", "byte[]", "byte[]", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.filter.WCompareFilter$CompareOp", "byte[]", "com.alibaba.lindorm.client.core.widecolumnservice.WRowMutations", "com.alibaba.lindorm.client.AsyncCallback").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("appendAsync", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WAppend").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("appendAsync", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WAppend", "com.alibaba.lindorm.client.AsyncCallback").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("batchAppend", "java.lang.String", "java.util.List").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("batchAppendAsync", "java.lang.String", "java.util.List", "com.alibaba.lindorm.client.AsyncCallback").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("batchAppendAsync", "java.lang.String", "java.util.List").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("incrementAsync", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WIncrement", "com.alibaba.lindorm.client.AsyncCallback").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("incrementAsync", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WIncrement").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("batchIncrement", "java.lang.String", "java.util.List").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("batchIncrementAsync", "java.lang.String", "java.util.List").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("batchIncrementAsync", "java.lang.String", "java.util.List", "com.alibaba.lindorm.client.AsyncCallback").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("scanAsync", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WScan", "com.alibaba.lindorm.client.AsyncCallback").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("scanAsync", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WScan").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("addColumnAsync", "java.lang.String", "com.alibaba.lindorm.client.schema.ColumnSchema").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("addColumnAsync", "java.lang.String", "java.util.List").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("setWriteBufferSize", "java.lang.String", "int").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("getClearBufferOnFailure", "java.lang.String").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("getWriteBufferSize", "java.lang.String").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("setAutoFlush", "java.lang.String", "boolean").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("setAutoFlush", "java.lang.String", "boolean", "boolean").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("getAutoFlush", "java.lang.String").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("flushCommits", "java.lang.String").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("getStartKeys", "java.lang.String").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("getStartEndKeys", "java.lang.String").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("getEndKeys", "java.lang.String").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("addExternalIndex", "java.lang.String", "java.util.List").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("addExternalIndex", "java.lang.String", "java.lang.String", "com.alibaba.lindorm.client.core.meta.ExternalIndexType", "com.alibaba.lindorm.client.core.meta.ExternalIndexRowFormatterType", "com.alibaba.lindorm.client.core.meta.ExternalIndexField[]").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("addExternalIndex", "java.lang.String", "java.lang.String", "com.alibaba.lindorm.client.core.meta.ExternalIndexType", "com.alibaba.lindorm.client.core.meta.ExternalIndexRowFormatterType", "java.util.List").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("addExternalIndex", "java.lang.String", "com.alibaba.lindorm.client.core.meta.ExternalIndexConfig", "java.util.List").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("addExternalIndex", "java.lang.String", "com.alibaba.lindorm.client.core.meta.ExternalIndexConfig", "com.alibaba.lindorm.client.core.meta.ExternalIndexField[]").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("addExternalIndex", "java.lang.String", "com.alibaba.lindorm.client.core.meta.ExternalIndexField[]").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("removeExternalIndex", "java.lang.String", "java.lang.String[]").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("removeExternalIndex", "java.lang.String", "java.util.List").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("buildExternalIndex", "java.lang.String").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("cancelBuildExternalIndex", "java.lang.String").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
target.getDeclaredMethod("scan", "java.lang.String", "com.alibaba.lindorm.client.core.widecolumnservice.WScan").addInterceptor(Listeners.of(LindormWideColumnServiceInterceptor.class));
}
});
enhanceTemplate.enhance(this, "com.flipkart.hbaseobjectmapper.WrappedHBTable", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
InstrumentMethod instrumentMethod = target.getDeclaredMethod("getName");
instrumentMethod.addInterceptor(Listeners.of(WrappedHBTableGetNameInterceptor.class));
}
});
// =============asynchbase
// org.hbase.async.HBaseRpc.HBaseRpc(byte[], byte[])
enhanceTemplate.enhance(this, "org.hbase.async.HBaseRpc", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
InstrumentMethod constructor = target.getConstructor("byte[]", "byte[]");
constructor.addInterceptor(Listeners.of(AsyncHbaseTableInterceptor.class));
}
});
// org.hbase.async.Scanner.Scanner(org.hbase.async.HBaseClient,byte[])
enhanceTemplate.enhance(this, "org.hbase.async.Scanner", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
InstrumentMethod constructor = target.getConstructor("org.hbase.async.HBaseClient", "byte[]");
constructor.addInterceptor(Listeners.of(AsyncHbaseTableInterceptor.class));
}
});
return true;
}
use of com.shulie.instrument.simulator.api.instrument.InstrumentMethod in project LinkAgent by shulieTech.
the class NettyHttpPlugin method onActive.
@Override
public boolean onActive() throws Throwable {
this.enhanceTemplate.enhance(this, "io.netty.channel.DefaultChannelPipeline", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
final InstrumentMethod writeMethod1 = target.getDeclaredMethod("write", "java.lang.Object");
writeMethod1.addInterceptor(Listeners.of(ChannelPipelineWriteInterceptor.class, NettyConstants.SCOPE_WRITE, ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
final InstrumentMethod writeMethod2 = target.getDeclaredMethod("write", "java.lang.Object", "io.netty.channel.ChannelPromise");
writeMethod2.addInterceptor(Listeners.of(ChannelPipelineWriteInterceptor.class, NettyConstants.SCOPE_WRITE, ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
final InstrumentMethod writeAndFlushMethod1 = target.getDeclaredMethod("writeAndFlush", "java.lang.Object");
writeAndFlushMethod1.addInterceptor(Listeners.of(ChannelPipelineWriteInterceptor.class, NettyConstants.SCOPE_WRITE, ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
final InstrumentMethod writeAndFlushMethod2 = target.getDeclaredMethod("writeAndFlush", "java.lang.Object", "io.netty.channel.ChannelPromise");
writeAndFlushMethod2.addInterceptor(Listeners.of(ChannelPipelineWriteInterceptor.class, NettyConstants.SCOPE_WRITE, ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
}
});
this.enhanceTemplate.enhance(this, "io.netty.channel.DefaultChannelPromise", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
final InstrumentMethod addListenerMethod1 = target.getDeclaredMethod("addListener", "io.netty.util.concurrent.GenericFutureListener");
addListenerMethod1.addInterceptor(Listeners.of(ChannelPromiseAddListenerInterceptor.class, NettyConstants.SCOPE, ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
final InstrumentMethod addListenerMethod2 = target.getDeclaredMethod("addListeners", "io.netty.util.concurrent.GenericFutureListener[]");
addListenerMethod2.addInterceptor(Listeners.of(ChannelPromiseAddListenerInterceptor.class, NettyConstants.SCOPE, ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
}
});
this.enhanceTemplate.enhance(this, "io.netty.handler.codec.http.HttpObjectEncoder", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
InstrumentMethod method = target.getDeclaredMethod("encode", "io.netty.channel.ChannelHandlerContext", "java.lang.Object", "java.util.List");
method.addInterceptor(Listeners.of(HttpEncoderInterceptor.class));
}
});
return true;
}
use of com.shulie.instrument.simulator.api.instrument.InstrumentMethod in project LinkAgent by shulieTech.
the class LettucePlugin method addSentinelConfig.
private void addSentinelConfig() {
// io.lettuce.core.masterreplica.MasterReplica
this.enhanceTemplate.enhance(this, "io.lettuce.core.masterreplica.MasterReplica", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
// TODO: 2021/8/25 获取连接信息收集客户端连接信息
InstrumentMethod getConnectionMethod = target.getDeclaredMethods("getConnection", "java.util.concurrent.CompletableFuture", "java.lang.Object");
getConnectionMethod.addInterceptor(Listeners.of(ConnectionInterceptor.class));
}
});
// 哨兵模式映射后的节点不好拿,单独增强一下
// io.lettuce.core.masterslave.SentinelConnector.initializeConnection
this.enhanceTemplate.enhance(this, "io.lettuce.core.masterslave.SentinelConnector", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
InstrumentMethod initializeConnection = target.getDeclaredMethods("initializeConnection");
initializeConnection.addInterceptor(Listeners.of(SentinelConnectorInterceptor.class));
}
});
// io.lettuce.core.masterslave.MasterSlaveTopologyRefresh.getConnections
this.enhanceTemplate.enhance(this, "io.lettuce.core.masterslave.MasterSlaveTopologyRefresh", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
InstrumentMethod getConnectionsMethod = target.getDeclaredMethods("getConnections");
getConnectionsMethod.addInterceptor(Listeners.of(MasterSlaveTopologyRefreshGetconnectionInteceptor.class));
}
});
}
use of com.shulie.instrument.simulator.api.instrument.InstrumentMethod in project LinkAgent by shulieTech.
the class HttpClientPlugin method onActive.
@Override
public boolean onActive() throws Throwable {
// httpclient v3
enhanceTemplate.enhance(this, "org.apache.commons.httpclient.HttpClient", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
InstrumentMethod instrumentMethod = target.getDeclaredMethod("executeMethod", "org.apache.commons.httpclient.HostConfiguration", "org.apache.commons.httpclient.HttpMethod", "org.apache.commons.httpclient.HttpState");
instrumentMethod.addInterceptor(Listeners.of(HttpClientv3MethodInterceptor.class));
}
});
// httpclient v4
enhanceTemplate.enhance(this, "org.apache.http.impl.client.CloseableHttpClient", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
// execute and doExecute, only one method exists!
InstrumentMethod executeMethod0 = target.getDeclaredMethod("execute", "org.apache.http.HttpHost", "org.apache.http.HttpRequest");
executeMethod0.addInterceptor(Listeners.of(HttpClientv4MethodInterceptor.class, "HTTPCLIENT_SYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod1 = target.getDeclaredMethod("execute", "org.apache.http.HttpHost", "org.apache.http.HttpRequest", "org.apache.http.protocol.HttpContext");
executeMethod1.addInterceptor(Listeners.of(HttpClientv4MethodInterceptor.class, "HTTPCLIENT_SYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod2 = target.getDeclaredMethod("execute", "org.apache.http.HttpHost", "org.apache.http.HttpRequest", "org.apache.http.client.ResponseHandler");
executeMethod2.addInterceptor(Listeners.of(HttpClientv4MethodInterceptor.class, "HTTPCLIENT_SYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod3 = target.getDeclaredMethod("execute", "org.apache.http.HttpHost", "org.apache.http.HttpRequest", "org.apache.http.client.ResponseHandler", "org.apache.http.protocol.HttpContext");
executeMethod3.addInterceptor(Listeners.of(HttpClientv4MethodInterceptor.class, "HTTPCLIENT_SYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod4 = target.getDeclaredMethod("execute", "org.apache.http.client.methods.HttpUriRequest");
executeMethod4.addInterceptor(Listeners.of(HttpClientv4MethodInterceptor1.class, "HTTPCLIENT_SYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod5 = target.getDeclaredMethod("execute", "org.apache.http.client.methods.HttpUriRequest", "org.apache.http.protocol.HttpContext");
executeMethod5.addInterceptor(Listeners.of(HttpClientv4MethodInterceptor1.class, "HTTPCLIENT_SYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod6 = target.getDeclaredMethod("execute", "org.apache.http.client.methods.HttpUriRequest", "org.apache.http.client.ResponseHandler");
executeMethod6.addInterceptor(Listeners.of(HttpClientv4MethodInterceptor1.class, "HTTPCLIENT_SYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod7 = target.getDeclaredMethod("execute", "org.apache.http.client.methods.HttpUriRequest", "org.apache.http.client.ResponseHandler", "org.apache.http.protocol.HttpContext");
executeMethod7.addInterceptor(Listeners.of(HttpClientv4MethodInterceptor1.class, "HTTPCLIENT_SYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
}
});
enhanceTemplate.enhance(this, "org.apache.http.impl.nio.client.CloseableHttpAsyncClient", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
InstrumentMethod executeMethod0 = target.getDeclaredMethod("execute", "org.apache.http.HttpHost", "org.apache.http.HttpRequest", "org.apache.http.protocol.HttpContext", "org.apache.http.concurrent.FutureCallback");
executeMethod0.addInterceptor(Listeners.of(AsyncHttpClientv4MethodInterceptor.class, "HTTPCLIENT_ASYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod1 = target.getDeclaredMethod("execute", "org.apache.http.HttpHost", "org.apache.http.HttpRequest", "org.apache.http.concurrent.FutureCallback");
executeMethod1.addInterceptor(Listeners.of(AsyncHttpClientv4MethodInterceptor.class, "HTTPCLIENT_ASYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod2 = target.getDeclaredMethod("execute", "org.apache.http.nio.protocol.HttpAsyncRequestProducer", "org.apache.http.nio.protocol.HttpAsyncResponseConsumer", "org.apache.http.concurrent.FutureCallback");
executeMethod2.addInterceptor(Listeners.of(AsyncHttpClientv4MethodInterceptor2.class, "HTTPCLIENT_ASYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod3 = target.getDeclaredMethod("execute", "org.apache.http.client.methods.HttpUriRequest", "org.apache.http.concurrent.FutureCallback");
executeMethod3.addInterceptor(Listeners.of(AsyncHttpClientv4MethodInterceptor1.class, "HTTPCLIENT_ASYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod4 = target.getDeclaredMethod("execute", "org.apache.http.client.methods.HttpUriRequest", "org.apache.http.protocol.HttpContext", "org.apache.http.concurrent.FutureCallback");
executeMethod4.addInterceptor(Listeners.of(AsyncHttpClientv4MethodInterceptor1.class, "HTTPCLIENT_ASYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
}
});
// httpclient v5
enhanceTemplate.enhance(this, "org.apache.hc.client5.http.impl.classic.CloseableHttpClient", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
// execute and doExecute, only one method exists!
InstrumentMethod executeMethod0 = target.getDeclaredMethod("execute", "org.apache.hc.core5.http.HttpHost", "org.apache.hc.core5.http.ClassicHttpRequest", "org.apache.hc.core5.http.protocol.HttpContext");
executeMethod0.addInterceptor(Listeners.of(HttpClientv5MethodInterceptor.class, "HTTPCLIENT_5_SYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod1 = target.getDeclaredMethod("execute", "org.apache.hc.core5.http.ClassicHttpRequest", "org.apache.hc.core5.http.protocol.HttpContext");
executeMethod1.addInterceptor(Listeners.of(HttpClientv5MethodInterceptor1.class, "HTTPCLIENT_5_SYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod2 = target.getDeclaredMethod("execute", "org.apache.hc.core5.http.ClassicHttpRequest");
executeMethod2.addInterceptor(Listeners.of(HttpClientv5MethodInterceptor1.class, "HTTPCLIENT_5_SYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod3 = target.getDeclaredMethod("execute", "org.apache.hc.core5.http.HttpHost", "org.apache.hc.core5.http.ClassicHttpRequest");
executeMethod3.addInterceptor(Listeners.of(HttpClientv5MethodInterceptor.class, "HTTPCLIENT_5_SYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod4 = target.getDeclaredMethod("execute", "org.apache.hc.core5.http.ClassicHttpRequest", "org.apache.hc.core5.http.io.HttpClientResponseHandler");
executeMethod4.addInterceptor(Listeners.of(HttpClientv5MethodInterceptor1.class, "HTTPCLIENT_5_SYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod5 = target.getDeclaredMethod("execute", "org.apache.hc.core5.http.ClassicHttpRequest", "org.apache.hc.core5.http.protocol.HttpContext", "org.apache.hc.core5.http.io.HttpClientResponseHandler");
executeMethod5.addInterceptor(Listeners.of(HttpClientv5MethodInterceptor1.class, "HTTPCLIENT_5_SYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod6 = target.getDeclaredMethod("execute", "org.apache.hc.core5.http.HttpHost", "org.apache.hc.core5.http.ClassicHttpRequest", "org.apache.hc.core5.http.io.HttpClientResponseHandler");
executeMethod6.addInterceptor(Listeners.of(HttpClientv5MethodInterceptor.class, "HTTPCLIENT_5_SYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod7 = target.getDeclaredMethod("execute", "org.apache.hc.core5.http.HttpHost", "org.apache.hc.core5.http.ClassicHttpRequest", "org.apache.hc.core5.http.protocol.HttpContext", "org.apache.hc.core5.http.io.HttpClientResponseHandler");
executeMethod7.addInterceptor(Listeners.of(HttpClientv5MethodInterceptor.class, "HTTPCLIENT_5_SYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
}
});
enhanceTemplate.enhance(this, "org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass target) {
InstrumentMethod executeMethod0 = target.getDeclaredMethod("execute", "org.apache.hc.core5.http.HttpHost", "org.apache.hc.core5.http.nio.AsyncRequestProducer", "org.apache.hc.core5.http.nio.AsyncResponseConsumer", "org.apache.hc.core5.http.nio.HandlerFactory", "org.apache.hc.core5.http.protocol.HttpContext", "org.apache.hc.core5.concurrent.FutureCallback");
executeMethod0.addInterceptor(Listeners.of(AsyncHttpClientv5MethodInterceptor.class, "HTTPCLIENT_5_ASYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod1 = target.getDeclaredMethod("execute", "org.apache.hc.core5.http.nio.AsyncRequestProducer", "org.apache.hc.core5.http.nio.AsyncResponseConsumer", "org.apache.hc.core5.http.nio.HandlerFactory", "org.apache.hc.core5.http.protocol.HttpContext", "org.apache.hc.core5.concurrent.FutureCallback");
executeMethod1.addInterceptor(Listeners.of(AsyncHttpClientv5MethodInterceptor2.class, "HTTPCLIENT_5_ASYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod2 = target.getDeclaredMethod("execute", "org.apache.hc.core5.http.nio.AsyncRequestProducer", "org.apache.hc.core5.http.nio.AsyncResponseConsumer", "org.apache.hc.core5.http.protocol.HttpContext", "org.apache.hc.core5.concurrent.FutureCallback");
executeMethod2.addInterceptor(Listeners.of(AsyncHttpClientv5MethodInterceptor2.class, "HTTPCLIENT_5_ASYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod3 = target.getDeclaredMethod("execute", "org.apache.hc.core5.http.nio.AsyncRequestProducer", "org.apache.hc.core5.http.nio.AsyncResponseConsumer", "org.apache.hc.core5.concurrent.FutureCallback");
executeMethod3.addInterceptor(Listeners.of(AsyncHttpClientv5MethodInterceptor2.class, "HTTPCLIENT_5_ASYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod4 = target.getDeclaredMethod("execute", "org.apache.hc.client5.http.async.methods.SimpleHttpRequest", "org.apache.hc.core5.http.protocol.HttpContext", "org.apache.hc.core5.concurrent.FutureCallback");
executeMethod4.addInterceptor(Listeners.of(AsyncHttpClientv5MethodInterceptor1.class, "HTTPCLIENT_5_ASYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod executeMethod5 = target.getDeclaredMethod("execute", "org.apache.hc.client5.http.async.methods.SimpleHttpRequest", "org.apache.hc.core5.concurrent.FutureCallback");
executeMethod5.addInterceptor(Listeners.of(AsyncHttpClientv5MethodInterceptor1.class, "HTTPCLIENT_5_ASYNC_EXECUTE_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
}
});
return true;
}
use of com.shulie.instrument.simulator.api.instrument.InstrumentMethod in project LinkAgent by shulieTech.
the class HikariCPPlugin method onActive.
@Override
public boolean onActive() throws Throwable {
// com.zaxxer.hikari.HikariDataSource.getConnection
enhanceTemplate.enhance(this, "com.zaxxer.hikari.HikariDataSource", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass clazz) {
InstrumentMethod method = clazz.getDeclaredMethod("getConnection");
method.addInterceptor(Listeners.of(DataSourceConnectionInterceptor.class, "Hikari_Get_Connection_Scope", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
InstrumentMethod constructor = clazz.getConstructor("com.zaxxer.hikari.HikariConfig");
constructor.addInterceptor(Listeners.of(DataSourceConstructorInterceptor.class));
}
});
enhanceTemplate.enhance(this, "com.zaxxer.hikari.HikariConfig", new EnhanceCallback() {
@Override
public void doEnhance(InstrumentClass clazz) {
InstrumentMethod method = clazz.getDeclaredMethod("validate");
method.addInterceptor(Listeners.of(DataSourceConstructorInterceptor.class));
}
});
return true;
}
Aggregations