Search in sources :

Example 1 with ClassFileTransformerDispatcher

use of com.navercorp.pinpoint.profiler.ClassFileTransformerDispatcher in project pinpoint by naver.

the class MockApplicationContextModuleTest method testMockApplicationContext.

@Test
public void testMockApplicationContext() {
    ProfilerConfig profilerConfig = new DefaultProfilerConfig();
    InterceptorRegistryBinder binder = new TestInterceptorRegistryBinder();
    AgentOption agentOption = new DefaultAgentOption(new DummyInstrumentation(), "mockAgent", "mockApplicationName", profilerConfig, new URL[0], null, new DefaultServiceTypeRegistryService(), new DefaultAnnotationKeyRegistryService());
    DefaultApplicationContext applicationContext = new DefaultApplicationContext(agentOption, binder) {

        @Override
        protected Module newApplicationContextModule(AgentOption agentOption, InterceptorRegistryBinder interceptorRegistryBinder) {
            Module module = super.newApplicationContextModule(agentOption, interceptorRegistryBinder);
            PluginApplicationContextModule pluginApplicationContextModule = new PluginApplicationContextModule();
            return Modules.override(module).with(pluginApplicationContextModule);
        }
    };
    Injector injector = applicationContext.getInjector();
    // singleton check
    AgentInfoSender instance1 = injector.getInstance(AgentInfoSender.class);
    AgentInfoSender instance2 = injector.getInstance(AgentInfoSender.class);
    Assert.assertSame(instance1, instance2);
    ClassFileTransformerDispatcher instance4 = injector.getInstance(ClassFileTransformerDispatcher.class);
}
Also used : InterceptorRegistryBinder(com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder) ProfilerConfig(com.navercorp.pinpoint.bootstrap.config.ProfilerConfig) DefaultProfilerConfig(com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig) DefaultProfilerConfig(com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig) AgentInfoSender(com.navercorp.pinpoint.profiler.AgentInfoSender) ClassFileTransformerDispatcher(com.navercorp.pinpoint.profiler.ClassFileTransformerDispatcher) DefaultApplicationContext(com.navercorp.pinpoint.profiler.context.module.DefaultApplicationContext) DefaultAgentOption(com.navercorp.pinpoint.bootstrap.DefaultAgentOption) DefaultServiceTypeRegistryService(com.navercorp.pinpoint.common.service.DefaultServiceTypeRegistryService) Injector(com.google.inject.Injector) DefaultAgentOption(com.navercorp.pinpoint.bootstrap.DefaultAgentOption) AgentOption(com.navercorp.pinpoint.bootstrap.AgentOption) DefaultAnnotationKeyRegistryService(com.navercorp.pinpoint.common.service.DefaultAnnotationKeyRegistryService) Module(com.google.inject.Module) Test(org.junit.Test)

Example 2 with ClassFileTransformerDispatcher

use of com.navercorp.pinpoint.profiler.ClassFileTransformerDispatcher in project pinpoint by naver.

the class ClassFileTransformerWrapProvider method get.

public ClassFileTransformer get() {
    ClassFileTransformerDispatcher classFileTransformerDispatcher = classFileTransformerDispatcherProvider.get();
    final boolean enableBytecodeDump = profilerConfig.readBoolean(ASMBytecodeDumpService.ENABLE_BYTECODE_DUMP, ASMBytecodeDumpService.ENABLE_BYTECODE_DUMP_DEFAULT_VALUE);
    if (enableBytecodeDump) {
        logger.info("wrapBytecodeDumpTransformer");
        return BytecodeDumpTransformer.wrap(classFileTransformerDispatcher, profilerConfig);
    }
    return classFileTransformerDispatcher;
}
Also used : ClassFileTransformerDispatcher(com.navercorp.pinpoint.profiler.ClassFileTransformerDispatcher)

Aggregations

ClassFileTransformerDispatcher (com.navercorp.pinpoint.profiler.ClassFileTransformerDispatcher)2 Injector (com.google.inject.Injector)1 Module (com.google.inject.Module)1 AgentOption (com.navercorp.pinpoint.bootstrap.AgentOption)1 DefaultAgentOption (com.navercorp.pinpoint.bootstrap.DefaultAgentOption)1 DefaultProfilerConfig (com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig)1 ProfilerConfig (com.navercorp.pinpoint.bootstrap.config.ProfilerConfig)1 DefaultAnnotationKeyRegistryService (com.navercorp.pinpoint.common.service.DefaultAnnotationKeyRegistryService)1 DefaultServiceTypeRegistryService (com.navercorp.pinpoint.common.service.DefaultServiceTypeRegistryService)1 AgentInfoSender (com.navercorp.pinpoint.profiler.AgentInfoSender)1 DefaultApplicationContext (com.navercorp.pinpoint.profiler.context.module.DefaultApplicationContext)1 InterceptorRegistryBinder (com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder)1 Test (org.junit.Test)1