Search in sources :

Example 1 with Matcher

use of com.navercorp.pinpoint.bootstrap.instrument.matcher.Matcher 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 2 with Matcher

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) {
    Objects.requireNonNull(className, "className");
    Objects.requireNonNull(transformCallbackClass, "transformCallbackClass");
    final Matcher matcher = Matchers.newClassNameMatcher(className);
    TransformCallbackChecker.validate(transformCallbackClass);
    // release class reference
    final String transformCallbackName = transformCallbackClass.getName();
    this.instrumentContext.addClassFileTransformer(matcher, transformCallbackName);
}
Also used : Matcher(com.navercorp.pinpoint.bootstrap.instrument.matcher.Matcher)

Example 3 with Matcher

use of com.navercorp.pinpoint.bootstrap.instrument.matcher.Matcher 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 4 with Matcher

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

the class JavassistTranslator method addTransformer.

public void addTransformer(MatchableClassFileTransformer transformer) {
    // TODO extract matcher process
    final Matcher matcher = transformer.getMatcher();
    if (matcher instanceof ClassNameMatcher) {
        ClassNameMatcher classNameMatcher = (ClassNameMatcher) matcher;
        String className = classNameMatcher.getClassName();
        addTransformer0(transformer, className);
    } else if (matcher instanceof MultiClassNameMatcher) {
        final MultiClassNameMatcher classNameMatcher = (MultiClassNameMatcher) matcher;
        List<String> classNameList = classNameMatcher.getClassNames();
        for (String className : classNameList) {
            addTransformer0(transformer, className);
        }
    } else {
        throw new IllegalArgumentException("unsupported Matcher " + matcher);
    }
}
Also used : ClassNameMatcher(com.navercorp.pinpoint.bootstrap.instrument.matcher.ClassNameMatcher) MultiClassNameMatcher(com.navercorp.pinpoint.bootstrap.instrument.matcher.MultiClassNameMatcher) Matcher(com.navercorp.pinpoint.bootstrap.instrument.matcher.Matcher) List(java.util.List) ClassNameMatcher(com.navercorp.pinpoint.bootstrap.instrument.matcher.ClassNameMatcher) MultiClassNameMatcher(com.navercorp.pinpoint.bootstrap.instrument.matcher.MultiClassNameMatcher) MultiClassNameMatcher(com.navercorp.pinpoint.bootstrap.instrument.matcher.MultiClassNameMatcher)

Example 5 with Matcher

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

the class ClassFileTransformerLoader method addClassFileTransformer.

public void addClassFileTransformer(InstrumentContext instrumentContext, final String targetClassName, final TransformCallback transformCallback) {
    if (targetClassName == null) {
        throw new NullPointerException("targetClassName must not be null");
    }
    if (transformCallback == null) {
        throw new NullPointerException("transformCallback must not be null");
    }
    final Matcher matcher = Matchers.newClassNameMatcher(JavaAssistUtils.javaNameToJvmName(targetClassName));
    final MatchableClassFileTransformerGuardDelegate guard = new MatchableClassFileTransformerGuardDelegate(profilerConfig, instrumentContext, matcher, transformCallback);
    classTransformers.add(guard);
}
Also used : Matcher(com.navercorp.pinpoint.bootstrap.instrument.matcher.Matcher)

Aggregations

Matcher (com.navercorp.pinpoint.bootstrap.instrument.matcher.Matcher)13 InterfaceInternalNameMatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand)5 SuperClassInternalNameMatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand)3 ClassNameMatcher (com.navercorp.pinpoint.bootstrap.instrument.matcher.ClassNameMatcher)2 MultiClassNameMatcher (com.navercorp.pinpoint.bootstrap.instrument.matcher.MultiClassNameMatcher)2 List (java.util.List)2 AsyncContextAccessor (com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor)1 InstrumentClass (com.navercorp.pinpoint.bootstrap.instrument.InstrumentClass)1 InstrumentException (com.navercorp.pinpoint.bootstrap.instrument.InstrumentException)1 InstrumentMethod (com.navercorp.pinpoint.bootstrap.instrument.InstrumentMethod)1 Instrumentor (com.navercorp.pinpoint.bootstrap.instrument.Instrumentor)1 TransformCallback (com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformCallback)1 HandlerInterceptor (com.navercorp.pinpoint.plugin.vertx.interceptor.HandlerInterceptor)1 InstanceTransformCallbackProvider (com.navercorp.pinpoint.profiler.plugin.InstanceTransformCallbackProvider)1 MatchableClassFileTransformerDelegate (com.navercorp.pinpoint.profiler.plugin.MatchableClassFileTransformerDelegate)1 TransformCallbackProvider (com.navercorp.pinpoint.profiler.plugin.TransformCallbackProvider)1 ProtectionDomain (java.security.ProtectionDomain)1 ArrayList (java.util.ArrayList)1