Search in sources :

Example 1 with PluginInstrumentContext

use of com.navercorp.pinpoint.profiler.plugin.PluginInstrumentContext in project pinpoint by naver.

the class JavassistEngine method getContextClassPool.

private ClassPool getContextClassPool(InstrumentContext instrumentContext, NamedClassPool parent, String jvmInternalClassName, byte[] classfileBuffer) throws NotFoundException {
    final ClassPool contextCassPool = new ClassPool(parent);
    contextCassPool.childFirstLookup = true;
    final String javaName = JavaAssistUtils.jvmNameToJavaName(jvmInternalClassName);
    if (isDebug) {
        logger.debug("getContextClassPool() className={}", javaName);
    }
    final ClassPath byteArrayClassPath = new ByteArrayClassPath(javaName, classfileBuffer);
    contextCassPool.insertClassPath(byteArrayClassPath);
    // plugin class not found in jboss classLoader
    if (instrumentContext instanceof PluginInstrumentContext) {
        final PluginConfig pluginConfig = ((PluginInstrumentContext) instrumentContext).getPluginConfig();
        if (pluginConfig != null) {
            String jarPath = pluginConfig.getPluginJar().getPath();
            contextCassPool.appendClassPath(jarPath);
        }
    }
    return contextCassPool;
}
Also used : PluginConfig(com.navercorp.pinpoint.profiler.plugin.PluginConfig) PluginInstrumentContext(com.navercorp.pinpoint.profiler.plugin.PluginInstrumentContext) NamedClassPool(com.navercorp.pinpoint.profiler.instrument.classpool.NamedClassPool) IsolateMultipleClassPool(com.navercorp.pinpoint.profiler.instrument.classpool.IsolateMultipleClassPool) MultipleClassPool(com.navercorp.pinpoint.profiler.instrument.classpool.MultipleClassPool)

Example 2 with PluginInstrumentContext

use of com.navercorp.pinpoint.profiler.plugin.PluginInstrumentContext in project pinpoint by naver.

the class MockPluginSetup method setupPlugin.

@Override
public SetupResult setupPlugin(ProfilerPlugin plugin, ClassInjector classInjector) {
    final DefaultProfilerPluginSetupContext pluginSetupContext = new DefaultProfilerPluginSetupContext(profilerConfig);
    final GuardProfilerPluginContext guardPluginSetupContext = new GuardProfilerPluginContext(pluginSetupContext);
    ClassFileTransformerLoader classFileTransformerLoader = new ClassFileTransformerLoader(profilerConfig, dynamicTransformTrigger);
    InstrumentContext instrumentContext = new PluginInstrumentContext(profilerConfig, instrumentEngine, dynamicTransformTrigger, classInjector, classFileTransformerLoader);
    try {
        preparePlugin(plugin, instrumentContext);
        plugin.setup(guardPluginSetupContext);
    } finally {
        guardPluginSetupContext.close();
    }
    SetupResult setup = new SetupResult(pluginSetupContext, classFileTransformerLoader);
    return setup;
}
Also used : SetupResult(com.navercorp.pinpoint.profiler.plugin.SetupResult) PluginInstrumentContext(com.navercorp.pinpoint.profiler.plugin.PluginInstrumentContext) InstrumentContext(com.navercorp.pinpoint.bootstrap.instrument.InstrumentContext) PluginInstrumentContext(com.navercorp.pinpoint.profiler.plugin.PluginInstrumentContext) DefaultProfilerPluginSetupContext(com.navercorp.pinpoint.profiler.plugin.DefaultProfilerPluginSetupContext) GuardProfilerPluginContext(com.navercorp.pinpoint.profiler.plugin.GuardProfilerPluginContext) ClassFileTransformerLoader(com.navercorp.pinpoint.profiler.plugin.ClassFileTransformerLoader)

Example 3 with PluginInstrumentContext

use of com.navercorp.pinpoint.profiler.plugin.PluginInstrumentContext in project pinpoint by naver.

the class DebugTransformerRegistry method newDebugTransformer.

private DebugTransformer newDebugTransformer(ProfilerConfig profilerConfig, InstrumentEngine instrumentEngine, DynamicTransformTrigger dynamicTransformTrigger) {
    ClassInjector classInjector = newClassInjector(profilerConfig);
    ClassFileTransformerLoader transformerRegistry = new ClassFileTransformerLoader(profilerConfig, dynamicTransformTrigger);
    InstrumentContext debugContext = new PluginInstrumentContext(profilerConfig, instrumentEngine, dynamicTransformTrigger, classInjector, transformerRegistry);
    return new DebugTransformer(instrumentEngine, debugContext);
}
Also used : PluginInstrumentContext(com.navercorp.pinpoint.profiler.plugin.PluginInstrumentContext) InstrumentContext(com.navercorp.pinpoint.bootstrap.instrument.InstrumentContext) PluginInstrumentContext(com.navercorp.pinpoint.profiler.plugin.PluginInstrumentContext) ClassFileTransformerLoader(com.navercorp.pinpoint.profiler.plugin.ClassFileTransformerLoader) LegacyProfilerPluginClassInjector(com.navercorp.pinpoint.profiler.instrument.classloading.LegacyProfilerPluginClassInjector) ClassInjector(com.navercorp.pinpoint.profiler.instrument.classloading.ClassInjector) DebugTransformerClassInjector(com.navercorp.pinpoint.profiler.instrument.classloading.DebugTransformerClassInjector)

Aggregations

PluginInstrumentContext (com.navercorp.pinpoint.profiler.plugin.PluginInstrumentContext)3 InstrumentContext (com.navercorp.pinpoint.bootstrap.instrument.InstrumentContext)2 ClassFileTransformerLoader (com.navercorp.pinpoint.profiler.plugin.ClassFileTransformerLoader)2 ClassInjector (com.navercorp.pinpoint.profiler.instrument.classloading.ClassInjector)1 DebugTransformerClassInjector (com.navercorp.pinpoint.profiler.instrument.classloading.DebugTransformerClassInjector)1 LegacyProfilerPluginClassInjector (com.navercorp.pinpoint.profiler.instrument.classloading.LegacyProfilerPluginClassInjector)1 IsolateMultipleClassPool (com.navercorp.pinpoint.profiler.instrument.classpool.IsolateMultipleClassPool)1 MultipleClassPool (com.navercorp.pinpoint.profiler.instrument.classpool.MultipleClassPool)1 NamedClassPool (com.navercorp.pinpoint.profiler.instrument.classpool.NamedClassPool)1 DefaultProfilerPluginSetupContext (com.navercorp.pinpoint.profiler.plugin.DefaultProfilerPluginSetupContext)1 GuardProfilerPluginContext (com.navercorp.pinpoint.profiler.plugin.GuardProfilerPluginContext)1 PluginConfig (com.navercorp.pinpoint.profiler.plugin.PluginConfig)1 SetupResult (com.navercorp.pinpoint.profiler.plugin.SetupResult)1