Search in sources :

Example 1 with GuardInstrumentContext

use of com.navercorp.pinpoint.profiler.instrument.GuardInstrumentContext in project pinpoint by naver.

the class DefaultPluginSetup method preparePlugin.

private GuardInstrumentContext preparePlugin(ProfilerPlugin plugin, InstrumentContext instrumentContext) {
    final GuardInstrumentContext guardInstrumentContext = new GuardInstrumentContext(instrumentContext);
    if (plugin instanceof TransformTemplateAware) {
        if (logger.isDebugEnabled()) {
            logger.debug("{}.setTransformTemplate", plugin.getClass().getName());
        }
        final TransformTemplate transformTemplate = new TransformTemplate(guardInstrumentContext);
        ((TransformTemplateAware) plugin).setTransformTemplate(transformTemplate);
    }
    return guardInstrumentContext;
}
Also used : TransformTemplateAware(com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformTemplateAware) TransformTemplate(com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformTemplate) GuardInstrumentContext(com.navercorp.pinpoint.profiler.instrument.GuardInstrumentContext)

Example 2 with GuardInstrumentContext

use of com.navercorp.pinpoint.profiler.instrument.GuardInstrumentContext in project pinpoint by naver.

the class DefaultPluginSetup method setupPlugin.

@Override
public SetupResult setupPlugin(ProfilerPlugin profilerPlugin, ClassInjector classInjector) {
    final ClassFileTransformerLoader transformerRegistry = new ClassFileTransformerLoader(profilerConfig, dynamicTransformTrigger);
    final DefaultProfilerPluginSetupContext setupContext = new DefaultProfilerPluginSetupContext(profilerConfig);
    final GuardProfilerPluginContext guardSetupContext = new GuardProfilerPluginContext(setupContext);
    final InstrumentContext instrumentContext = new PluginInstrumentContext(profilerConfig, instrumentEngine, dynamicTransformTrigger, classInjector, transformerRegistry);
    final GuardInstrumentContext guardInstrumentContext = preparePlugin(profilerPlugin, instrumentContext);
    try {
        // WARN external plugin api
        if (logger.isInfoEnabled()) {
            logger.info("{} Plugin setup", profilerPlugin.getClass().getName());
        }
        profilerPlugin.setup(guardSetupContext);
    } finally {
        guardSetupContext.close();
        guardInstrumentContext.close();
    }
    SetupResult setupResult = new SetupResult(setupContext, transformerRegistry);
    return setupResult;
}
Also used : GuardInstrumentContext(com.navercorp.pinpoint.profiler.instrument.GuardInstrumentContext) InstrumentContext(com.navercorp.pinpoint.bootstrap.instrument.InstrumentContext) GuardInstrumentContext(com.navercorp.pinpoint.profiler.instrument.GuardInstrumentContext)

Aggregations

GuardInstrumentContext (com.navercorp.pinpoint.profiler.instrument.GuardInstrumentContext)2 InstrumentContext (com.navercorp.pinpoint.bootstrap.instrument.InstrumentContext)1 TransformTemplate (com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformTemplate)1 TransformTemplateAware (com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformTemplateAware)1