Search in sources :

Example 6 with InterceptorRegistryBinder

use of com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder in project pinpoint by naver.

the class JavassistEngineTest method newJavassistEngine.

private InstrumentEngine newJavassistEngine() {
    Instrumentation instrumentation = mock(Instrumentation.class);
    ObjectBinderFactory objectBinderFactory = mock(ObjectBinderFactory.class);
    Provider<ApiMetaDataService> apiMetaDataService = Providers.of(mock(ApiMetaDataService.class));
    InterceptorRegistryBinder binder = new TestInterceptorRegistryBinder();
    return new JavassistEngine(instrumentation, objectBinderFactory, binder, apiMetaDataService, null);
}
Also used : TestInterceptorRegistryBinder(com.navercorp.pinpoint.profiler.util.TestInterceptorRegistryBinder) InterceptorRegistryBinder(com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder) TestInterceptorRegistryBinder(com.navercorp.pinpoint.profiler.util.TestInterceptorRegistryBinder) Instrumentation(java.lang.instrument.Instrumentation) ObjectBinderFactory(com.navercorp.pinpoint.profiler.objectfactory.ObjectBinderFactory) ApiMetaDataService(com.navercorp.pinpoint.profiler.metadata.ApiMetaDataService)

Example 7 with InterceptorRegistryBinder

use of com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder in project pinpoint by naver.

the class ASMMethodVariablesTest method initInterceptorLocalVariables.

@Test
public void initInterceptorLocalVariables() throws Exception {
    MethodNode methodNode = ASMClassNodeLoader.get("com.navercorp.pinpoint.profiler.instrument.mock.ConstructorChildClass", "<init>");
    ASMMethodVariables variables = new ASMMethodVariables("com/navercorp/pinpoint/profiler/instrument/mock/ConstructorChildClass", methodNode);
    assertNull(variables.getEnterInsnNode());
    assertNull(variables.getEnterInsnNode());
    InterceptorRegistryBinder interceptorRegistryBinder = new DefaultInterceptorRegistryBinder();
    int interceptorId = interceptorRegistryBinder.getInterceptorRegistryAdaptor().addInterceptor(new ArgsArrayInterceptor());
    final InterceptorDefinition interceptorDefinition = new InterceptorDefinitionFactory().createInterceptorDefinition(ArgsArrayInterceptor.class);
    InsnList instructions = new InsnList();
    boolean first = variables.initInterceptorLocalVariables(instructions, interceptorId, interceptorDefinition, -1);
    assertEquals(true, first);
    assertNotNull(variables.getEnterInsnNode());
    assertNotNull(variables.getEnterInsnNode());
}
Also used : InterceptorDefinition(com.navercorp.pinpoint.profiler.instrument.interceptor.InterceptorDefinition) DefaultInterceptorRegistryBinder(com.navercorp.pinpoint.profiler.interceptor.registry.DefaultInterceptorRegistryBinder) InterceptorRegistryBinder(com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder) DefaultInterceptorRegistryBinder(com.navercorp.pinpoint.profiler.interceptor.registry.DefaultInterceptorRegistryBinder) ArgsArrayInterceptor(com.navercorp.pinpoint.profiler.instrument.mock.ArgsArrayInterceptor) InterceptorDefinitionFactory(com.navercorp.pinpoint.profiler.instrument.interceptor.InterceptorDefinitionFactory) Test(org.junit.Test)

Example 8 with InterceptorRegistryBinder

use of com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder in project pinpoint by naver.

the class ASMMethodVariablesTest method hasInterceptor.

@Test
public void hasInterceptor() throws Exception {
    InterceptorRegistryBinder interceptorRegistryBinder = new DefaultInterceptorRegistryBinder();
    int interceptorId = interceptorRegistryBinder.getInterceptorRegistryAdaptor().addInterceptor(new ArgsArrayInterceptor());
    final InterceptorDefinition interceptorDefinition = new InterceptorDefinitionFactory().createInterceptorDefinition(ArgsArrayInterceptor.class);
    final ClassNode classNode = ASMClassNodeLoader.get("com.navercorp.pinpoint.profiler.instrument.mock.ArgsClass");
    List<MethodNode> methodNodes = classNode.methods;
    for (MethodNode methodNode : methodNodes) {
        ASMMethodNodeAdapter methodNodeAdapter = new ASMMethodNodeAdapter(classNode.name, methodNode);
        assertEquals(false, methodNodeAdapter.hasInterceptor());
        methodNodeAdapter.addBeforeInterceptor(interceptorId, interceptorDefinition, -1);
        assertEquals(true, methodNodeAdapter.hasInterceptor());
    }
}
Also used : InterceptorDefinition(com.navercorp.pinpoint.profiler.instrument.interceptor.InterceptorDefinition) DefaultInterceptorRegistryBinder(com.navercorp.pinpoint.profiler.interceptor.registry.DefaultInterceptorRegistryBinder) InterceptorRegistryBinder(com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder) DefaultInterceptorRegistryBinder(com.navercorp.pinpoint.profiler.interceptor.registry.DefaultInterceptorRegistryBinder) ArgsArrayInterceptor(com.navercorp.pinpoint.profiler.instrument.mock.ArgsArrayInterceptor) InterceptorDefinitionFactory(com.navercorp.pinpoint.profiler.instrument.interceptor.InterceptorDefinitionFactory) Test(org.junit.Test)

Example 9 with InterceptorRegistryBinder

use of com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder in project pinpoint by naver.

the class DependencyGraph method newApplicationContext.

private DefaultApplicationContext newApplicationContext() {
    ProfilerConfig profilerConfig = new DefaultProfilerConfig();
    InterceptorRegistryBinder binder = new TestInterceptorRegistryBinder();
    Instrumentation instrumentation = mock(Instrumentation.class);
    AgentOption agentOption = new DefaultAgentOption(instrumentation, "mockAgent", "mockApplicationName", profilerConfig, new URL[0], null, new DefaultServiceTypeRegistryService(), new DefaultAnnotationKeyRegistryService());
    return new DefaultApplicationContext(agentOption, binder);
}
Also used : DefaultApplicationContext(com.navercorp.pinpoint.profiler.context.module.DefaultApplicationContext) TestInterceptorRegistryBinder(com.navercorp.pinpoint.profiler.util.TestInterceptorRegistryBinder) InterceptorRegistryBinder(com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder) DefaultAgentOption(com.navercorp.pinpoint.bootstrap.DefaultAgentOption) ProfilerConfig(com.navercorp.pinpoint.bootstrap.config.ProfilerConfig) DefaultProfilerConfig(com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig) DefaultProfilerConfig(com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig) DefaultServiceTypeRegistryService(com.navercorp.pinpoint.common.service.DefaultServiceTypeRegistryService) TestInterceptorRegistryBinder(com.navercorp.pinpoint.profiler.util.TestInterceptorRegistryBinder) Instrumentation(java.lang.instrument.Instrumentation) DefaultAgentOption(com.navercorp.pinpoint.bootstrap.DefaultAgentOption) AgentOption(com.navercorp.pinpoint.bootstrap.AgentOption) DefaultAnnotationKeyRegistryService(com.navercorp.pinpoint.common.service.DefaultAnnotationKeyRegistryService)

Aggregations

InterceptorRegistryBinder (com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder)9 AgentOption (com.navercorp.pinpoint.bootstrap.AgentOption)6 DefaultAgentOption (com.navercorp.pinpoint.bootstrap.DefaultAgentOption)5 DefaultAnnotationKeyRegistryService (com.navercorp.pinpoint.common.service.DefaultAnnotationKeyRegistryService)5 DefaultServiceTypeRegistryService (com.navercorp.pinpoint.common.service.DefaultServiceTypeRegistryService)5 DefaultProfilerConfig (com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig)4 ProfilerConfig (com.navercorp.pinpoint.bootstrap.config.ProfilerConfig)4 DefaultApplicationContext (com.navercorp.pinpoint.profiler.context.module.DefaultApplicationContext)4 Test (org.junit.Test)4 Module (com.google.inject.Module)3 DefaultInterceptorRegistryBinder (com.navercorp.pinpoint.profiler.interceptor.registry.DefaultInterceptorRegistryBinder)3 TestInterceptorRegistryBinder (com.navercorp.pinpoint.profiler.util.TestInterceptorRegistryBinder)3 Instrumentation (java.lang.instrument.Instrumentation)3 ApplicationContext (com.navercorp.pinpoint.profiler.context.module.ApplicationContext)2 InterceptorDefinition (com.navercorp.pinpoint.profiler.instrument.interceptor.InterceptorDefinition)2 InterceptorDefinitionFactory (com.navercorp.pinpoint.profiler.instrument.interceptor.InterceptorDefinitionFactory)2 ArgsArrayInterceptor (com.navercorp.pinpoint.profiler.instrument.mock.ArgsArrayInterceptor)2 Injector (com.google.inject.Injector)1 AgentInfoSender (com.navercorp.pinpoint.profiler.AgentInfoSender)1 ClassFileTransformerDispatcher (com.navercorp.pinpoint.profiler.ClassFileTransformerDispatcher)1