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);
}
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);
}
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);
}
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);
}
}
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);
}
Aggregations