use of com.navercorp.pinpoint.bootstrap.instrument.matcher.Matcher in project pinpoint by naver.
the class TransformTemplate method transform.
// @Override
// public void transform(String className, Class<? extends TransformCallback> transformCallbackClass, Object[] parameters) {
// Objects.requireNonNull(className, "className");
// Objects.requireNonNull(transformCallbackClass, "transformCallbackClass");
//
// // if (ParameterUtils.hasNull(parameters)) {
// // throw new IllegalArgumentException("null parameter not supported");
// // }
//
// final Class<?>[] parameterType = ParameterUtils.toClass(parameters);
// // commons-lang
// // ConstructorUtils.getMatchingAccessibleConstructor()
//
// transform(className, transformCallbackClass, parameters, parameterType);
// }
@Override
public void transform(String className, Class<? extends TransformCallback> transformCallbackClass, Object[] parameters, Class<?>[] parameterTypes) {
Objects.requireNonNull(className, "className");
Objects.requireNonNull(transformCallbackClass, "transformCallbackClass");
TransformCallbackChecker.validate(transformCallbackClass, parameterTypes);
if (ParameterUtils.hasNull(parameterTypes)) {
throw new IllegalArgumentException("null parameterType not supported");
}
ParameterUtils.checkParameterType(parameterTypes);
final Matcher matcher = Matchers.newClassNameMatcher(className);
// release class reference
final String transformCallbackName = transformCallbackClass.getName();
this.instrumentContext.addClassFileTransformer(matcher, transformCallbackName, parameters, parameterTypes);
}
use of com.navercorp.pinpoint.bootstrap.instrument.matcher.Matcher in project pinpoint by naver.
the class TransformTemplate method transform.
/**
* @deprecated Since 1.9.0 Use {@link #transform(String, Class)}
*/
@Deprecated
@Override
public void transform(String className, TransformCallback transformCallback) {
Objects.requireNonNull(className, "className");
Objects.requireNonNull(transformCallback, "transformCallback");
final Matcher matcher = Matchers.newClassNameMatcher(className);
this.instrumentContext.addClassFileTransformer(matcher, transformCallback);
}
use of com.navercorp.pinpoint.bootstrap.instrument.matcher.Matcher in project pinpoint by naver.
the class ThreadPlugin method addInterceptor.
private void addInterceptor(String threadMatchPackage, String className, Class<? extends TransformCallback> transformCallback) {
Matcher matcher = Matchers.newPackageBasedMatcher(threadMatchPackage, new InterfaceInternalNameMatcherOperand(className, true));
transformTemplate.transform(matcher, transformCallback);
}
use of com.navercorp.pinpoint.bootstrap.instrument.matcher.Matcher in project pinpoint by naver.
the class RocketMQPlugin method setup.
@Override
public void setup(ProfilerPluginSetupContext context) {
final RocketMQConfig config = new RocketMQConfig(context.getConfig());
logger.info("{} config:{}", this.getClass().getSimpleName(), config);
final List<String> basePackageNames = new ArrayList<>();
// rocketmq spring boot support
basePackageNames.add("org.apache.rocketmq.spring.support");
// rocketmq spring cloud stream support
basePackageNames.add("com.alibaba.cloud.stream.binder.rocketmq");
final List<String> basePackages = config.getBasePackages();
if (!basePackages.isEmpty()) {
basePackageNames.addAll(basePackages);
}
if (config.isProducerEnable()) {
transformTemplate.transform("org.apache.rocketmq.client.impl.MQClientAPIImpl", MQClientAPIImplTransform.class);
final Matcher matcher = Matchers.newPackageBasedMatcher(basePackageNames, new InterfaceInternalNameMatcherOperand("org.apache.rocketmq.client.producer.SendCallback", true));
transformTemplate.transform(matcher, SendCallbackTransform.class);
}
if (config.isConsumerEnable()) {
transformTemplate.transform("org.apache.rocketmq.client.impl.consumer.DefaultMQPushConsumerImpl", ConsumerTransform.class);
transformTemplate.transform("org.apache.rocketmq.remoting.netty.NettyRemotingClient", RemotingTransform.class);
transformTemplate.transform("org.apache.rocketmq.remoting.netty.NettyRemotingClient$ChannelWrapper", ChannelWrapperTransform.class);
final Matcher matcher = Matchers.newPackageBasedMatcher(basePackageNames, new InterfaceInternalNameMatcherOperand("org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently", true));
transformTemplate.transform(matcher, MessageListenerConcurrentlyTransform.class);
final Matcher orderlyMatcher = Matchers.newPackageBasedMatcher(basePackageNames, new InterfaceInternalNameMatcherOperand("org.apache.rocketmq.client.consumer.listener.MessageListenerOrderly", true));
transformTemplate.transform(orderlyMatcher, MessageListenerOrderlyTransform.class);
}
}
use of com.navercorp.pinpoint.bootstrap.instrument.matcher.Matcher in project pinpoint by naver.
the class TestClassLoader method addTransformer.
public void addTransformer(final String targetClassName, final TransformCallback transformer) {
if (logger.isLoggable(Level.FINE)) {
logger.fine("addTransformer targetClassName:{}" + targetClassName + " callback:{}" + transformer);
}
final Matcher matcher = Matchers.newClassNameMatcher(targetClassName);
final TransformCallbackProvider transformCallbackProvider = new InstanceTransformCallbackProvider(transformer);
final MatchableClassFileTransformerDelegate guard = new MatchableClassFileTransformerDelegate(applicationContext.getProfilerConfig(), instrumentContext, matcher, transformCallbackProvider);
this.instrumentTranslator.addTransformer(guard);
}
Aggregations