use of com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand 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.operand.InterfaceInternalNameMatcherOperand in project pinpoint by naver.
the class ReactorPlugin method addPublisher.
private void addPublisher() {
final Matcher monoMatcher = Matchers.newPackageBasedMatcher("reactor.core.publisher", new SuperClassInternalNameMatcherOperand("reactor.core.publisher.Mono", true));
transformTemplate.transform(monoMatcher, FluxAndMonoTransform.class);
final Matcher fluxMatcher = Matchers.newPackageBasedMatcher("reactor.core.publisher", new SuperClassInternalNameMatcherOperand("reactor.core.publisher.Flux", true));
transformTemplate.transform(fluxMatcher, FluxAndMonoTransform.class);
final Matcher parallelFluxMatcher = Matchers.newPackageBasedMatcher("reactor.core.publisher", new SuperClassInternalNameMatcherOperand("reactor.core.publisher.ParallelFlux", true));
transformTemplate.transform(parallelFluxMatcher, ParallelFluxTransform.class);
final Matcher coreSubscriberMatcher = Matchers.newPackageBasedMatcher("reactor.core.publisher", new InterfaceInternalNameMatcherOperand("reactor.core.CoreSubscriber", true));
transformTemplate.transform(coreSubscriberMatcher, CoreSubscriberTransform.class);
}
use of com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand in project pinpoint by naver.
the class DefaultTransformerMatcherTest method considerHierarchy.
@Test
public void considerHierarchy() throws Exception {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
InstrumentMatcherCacheConfig config = new DefaultInstrumentMatcherCacheConfig();
TransformerMatcher matcher = new DefaultTransformerMatcher(config);
boolean result = false;
InternalClassMetadata stringClassMetadata = readClassMetadata(classLoader, String.class.getName());
InternalClassMetadata threadClassMetadata = readClassMetadata(classLoader, Thread.class.getName());
InternalClassMetadata extendsThreadClassMetadata = readClassMetadata(classLoader, ExtendsThread.class.getName());
InternalClassMetadata extendsExtendsThreadClassMetadata = readClassMetadata(classLoader, ExtendsExtendsThread.class.getName());
InternalClassMetadata hasMetaAnnotationClassMetadata = readClassMetadata(classLoader, HasMetaAnnotation.class.getName());
InternalClassMetadata hasMetaMetaAnnotationClassMetadata = readClassMetadata(classLoader, HasMetaMetaAnnotation.class.getName());
// interface
InterfaceInternalNameMatcherOperand interfaceMatcherOperand = new InterfaceInternalNameMatcherOperand("java/lang/Runnable", true);
result = matcher.match(classLoader, interfaceMatcherOperand, extendsThreadClassMetadata);
assertTrue(result);
result = matcher.match(classLoader, interfaceMatcherOperand, threadClassMetadata);
assertTrue(result);
result = matcher.match(classLoader, interfaceMatcherOperand, stringClassMetadata);
assertFalse(result);
result = matcher.match(classLoader, interfaceMatcherOperand, extendsExtendsThreadClassMetadata);
assertTrue(result);
// super
SuperClassInternalNameMatcherOperand superMatcherOperand = new SuperClassInternalNameMatcherOperand("java/lang/Thread", true);
result = matcher.match(classLoader, superMatcherOperand, extendsExtendsThreadClassMetadata);
assertTrue(result);
result = matcher.match(classLoader, superMatcherOperand, extendsThreadClassMetadata);
assertTrue(result);
result = matcher.match(classLoader, superMatcherOperand, threadClassMetadata);
assertFalse(result);
result = matcher.match(classLoader, superMatcherOperand, stringClassMetadata);
assertFalse(result);
// annotation
AnnotationInternalNameMatcherOperand annotationMatcherOperand = new AnnotationInternalNameMatcherOperand("javax/annotation/Resource", true);
result = matcher.match(classLoader, annotationMatcherOperand, hasMetaAnnotationClassMetadata);
assertTrue(result);
result = matcher.match(classLoader, annotationMatcherOperand, hasMetaMetaAnnotationClassMetadata);
assertTrue(result);
result = matcher.match(classLoader, annotationMatcherOperand, stringClassMetadata);
assertFalse(result);
result = matcher.match(classLoader, annotationMatcherOperand, threadClassMetadata);
assertFalse(result);
}
use of com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand in project pinpoint by naver.
the class TransformerMatcherExecutionPlannerTest method findIndex.
@Test
public void findIndex() {
TransformerMatcherExecutionPlanner executionPlanner = new TransformerMatcherExecutionPlanner();
// and
MatcherOperand operand = new ClassInternalNameMatcherOperand("java/lang/String");
operand = operand.and(new InterfaceInternalNameMatcherOperand("java/lang/Comparable", false));
operand = operand.and(new AnnotationInternalNameMatcherOperand("java/lang/Override", false));
operand = operand.and(new PackageInternalNameMatcherOperand("java/lang"));
List<MatcherOperand> result = executionPlanner.findIndex(operand);
assertEquals(1, result.size());
// or
operand = new ClassInternalNameMatcherOperand("java/lang/String");
operand = operand.or(new InterfaceInternalNameMatcherOperand("java/lang/Comparable", false));
operand = operand.or(new AnnotationInternalNameMatcherOperand("java/lang/Override", false));
operand = operand.or(new PackageInternalNameMatcherOperand("java/lang"));
result = executionPlanner.findIndex(operand);
assertEquals(2, result.size());
// not
operand = new InterfaceInternalNameMatcherOperand("java/lang/Comparable", false);
operand = operand.or(new AnnotationInternalNameMatcherOperand("java/lang/Override", false));
operand = operand.and(new PackageInternalNameMatcherOperand("javax").not());
result = executionPlanner.findIndex(operand);
assertEquals(0, result.size());
// none
operand = new InterfaceInternalNameMatcherOperand("java/lang/Comparable", false);
operand = operand.or(new AnnotationInternalNameMatcherOperand("java/lang/Override", false));
operand = operand.and(new SuperClassInternalNameMatcherOperand("java/lang/Object", true));
result = executionPlanner.findIndex(operand);
assertEquals(0, result.size());
}
Aggregations