Search in sources :

Example 1 with SuperClassInternalNameMatcherOperand

use of com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand in project pinpoint by naver.

the class CoroutinesPlugin method addCoroutineDispatcherTransformer.

private void addCoroutineDispatcherTransformer() {
    Matcher dispatcherMatcher = Matchers.newPackageBasedMatcher("kotlinx.coroutines", new SuperClassInternalNameMatcherOperand("kotlinx.coroutines.CoroutineDispatcher", true));
    transformTemplate.transform(dispatcherMatcher, CoroutineDispatcherTransform.class);
}
Also used : Matcher(com.navercorp.pinpoint.bootstrap.instrument.matcher.Matcher) SuperClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand)

Example 2 with SuperClassInternalNameMatcherOperand

use of com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand in project pinpoint by naver.

the class ReactorNettyPlugin method setup.

@Override
public void setup(ProfilerPluginSetupContext context) {
    final ReactorNettyPluginConfig config = new ReactorNettyPluginConfig(context.getConfig());
    if (!config.isEnable()) {
        logger.info("{} disabled", this.getClass().getSimpleName());
        return;
    }
    logger.info("{} version range=[0.8.2.RELEASE, 1.0.4.RELEASE], config:{}", this.getClass().getSimpleName(), config);
    if (ServiceType.UNDEFINED.equals(context.getConfiguredApplicationType())) {
        final ReactorNettyDetector detector = new ReactorNettyDetector(config.getBootstrapMains());
        if (detector.detect()) {
            logger.info("Detected application type : {}", ReactorNettyConstants.REACTOR_NETTY);
            if (!context.registerApplicationType(ReactorNettyConstants.REACTOR_NETTY)) {
                logger.info("Application type [{}] already set, skipping [{}] registration.", context.getApplicationType(), ReactorNettyConstants.REACTOR_NETTY);
            }
        }
    }
    // HTTP server
    transformTemplate.transform("reactor.netty.http.server.HttpServerHandle", HttpServerHandleTransform.class);
    // over reactor-netty-1.0
    transformTemplate.transform("reactor.netty.http.server.HttpServer$HttpServerHandle", HttpServerHandleTransform.class);
    transformTemplate.transform("reactor.netty.channel.ChannelOperations", ChannelOperationsTransform.class);
    transformTemplate.transform("reactor.netty.http.server.HttpServerOperations", HttpServerOperationsTransform.class);
    // HTTP client
    if (Boolean.TRUE == config.isClientEnable()) {
        // over reactor-netty-1.0
        transformTemplate.transform("reactor.netty.http.client.HttpClientConnect", HttpClientConnectTransform.class);
        transformTemplate.transform("reactor.netty.http.client.HttpClientConnect$HttpTcpClient", HttpTcpClientTransform.class);
        transformTemplate.transform("reactor.netty.http.client.HttpClientConnect$HttpClientHandler", HttpClientHandleTransform.class);
        transformTemplate.transform("reactor.netty.http.client.HttpClientOperations", HttpClientOperationsTransform.class);
    }
    // Reactor
    final Matcher monoMatcher = Matchers.newPackageBasedMatcher("reactor.netty", new SuperClassInternalNameMatcherOperand("reactor.core.publisher.Mono", true));
    transformTemplate.transform(monoMatcher, FluxAndMonoTransform.class);
    final Matcher fluxMatcher = Matchers.newPackageBasedMatcher("reactor.netty", new SuperClassInternalNameMatcherOperand("reactor.core.publisher.Flux", true));
    transformTemplate.transform(fluxMatcher, FluxAndMonoTransform.class);
    final Matcher coreSubscriberMatcher = Matchers.newPackageBasedMatcher("reactor.netty", new InterfaceInternalNameMatcherOperand("reactor.core.CoreSubscriber", true));
    transformTemplate.transform(coreSubscriberMatcher, CoreSubscriberTransform.class);
}
Also used : InterfaceInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand) Matcher(com.navercorp.pinpoint.bootstrap.instrument.matcher.Matcher) SuperClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand)

Example 3 with SuperClassInternalNameMatcherOperand

use of com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand 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);
}
Also used : InterfaceInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand) SuperClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand) DefaultInstrumentMatcherCacheConfig(com.navercorp.pinpoint.profiler.instrument.config.DefaultInstrumentMatcherCacheConfig) InstrumentMatcherCacheConfig(com.navercorp.pinpoint.profiler.instrument.config.InstrumentMatcherCacheConfig) DefaultInstrumentMatcherCacheConfig(com.navercorp.pinpoint.profiler.instrument.config.DefaultInstrumentMatcherCacheConfig) InternalClassMetadata(com.navercorp.pinpoint.profiler.instrument.classreading.InternalClassMetadata) AnnotationInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.AnnotationInternalNameMatcherOperand) Test(org.junit.Test)

Example 4 with SuperClassInternalNameMatcherOperand

use of com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand 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());
}
Also used : InterfaceInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand) MatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand) AnnotationInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.AnnotationInternalNameMatcherOperand) SuperClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand) PackageInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.PackageInternalNameMatcherOperand) ClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.ClassInternalNameMatcherOperand) InterfaceInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand) AnnotationInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.AnnotationInternalNameMatcherOperand) PackageInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.PackageInternalNameMatcherOperand) SuperClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand) SuperClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand) ClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.ClassInternalNameMatcherOperand) Test(org.junit.Test)

Example 5 with SuperClassInternalNameMatcherOperand

use of com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand 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);
}
Also used : InterfaceInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand) Matcher(com.navercorp.pinpoint.bootstrap.instrument.matcher.Matcher) SuperClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand)

Aggregations

SuperClassInternalNameMatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand)5 InterfaceInternalNameMatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand)4 Matcher (com.navercorp.pinpoint.bootstrap.instrument.matcher.Matcher)3 AnnotationInternalNameMatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.AnnotationInternalNameMatcherOperand)2 Test (org.junit.Test)2 ClassInternalNameMatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.ClassInternalNameMatcherOperand)1 MatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand)1 PackageInternalNameMatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.PackageInternalNameMatcherOperand)1 InternalClassMetadata (com.navercorp.pinpoint.profiler.instrument.classreading.InternalClassMetadata)1 DefaultInstrumentMatcherCacheConfig (com.navercorp.pinpoint.profiler.instrument.config.DefaultInstrumentMatcherCacheConfig)1 InstrumentMatcherCacheConfig (com.navercorp.pinpoint.profiler.instrument.config.InstrumentMatcherCacheConfig)1