Search in sources :

Example 6 with ProfilerConfig

use of com.navercorp.pinpoint.bootstrap.config.ProfilerConfig in project pinpoint by naver.

the class InvokeMethodInterceptorTest method spyTraceContext.

private TraceContext spyTraceContext() {
    ProfilerConfig profilerConfig = new DefaultProfilerConfig();
    TraceContext traceContext = MockTraceContextFactory.newTestTraceContext(profilerConfig);
    return spy(traceContext);
}
Also used : ProfilerConfig(com.navercorp.pinpoint.bootstrap.config.ProfilerConfig) DefaultProfilerConfig(com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig) DefaultProfilerConfig(com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig) TraceContext(com.navercorp.pinpoint.bootstrap.context.TraceContext)

Example 7 with ProfilerConfig

use of com.navercorp.pinpoint.bootstrap.config.ProfilerConfig in project pinpoint by naver.

the class MockApplicationContextModuleTest method test.

@Test
public void test() {
    ProfilerConfig profilerConfig = new DefaultProfilerConfig();
    AgentOption agentOption = new DefaultAgentOption(new DummyInstrumentation(), "mockAgent", "mockApplicationName", profilerConfig, new URL[0], null, new DefaultServiceTypeRegistryService(), new DefaultAnnotationKeyRegistryService());
    final PluginApplicationContextModule pluginApplicationContextModule = new PluginApplicationContextModule();
    PluginTestAgent pluginTestAgent = new PluginTestAgent(agentOption) {

        @Override
        protected ApplicationContext newApplicationContext(AgentOption agentOption, InterceptorRegistryBinder interceptorRegistryBinder) {
            ApplicationContext applicationContext = new DefaultApplicationContext(agentOption, interceptorRegistryBinder) {

                @Override
                protected Module newApplicationContextModule(AgentOption agentOption, InterceptorRegistryBinder interceptorRegistryBinder) {
                    Module applicationContextModule = super.newApplicationContextModule(agentOption, interceptorRegistryBinder);
                    //                        PluginApplicationContextModule pluginApplicationContextModule = new PluginApplicationContextModule();
                    return Modules.override(applicationContextModule).with(pluginApplicationContextModule);
                }
            };
            return applicationContext;
        }
    };
    try {
        pluginTestAgent.start();
    } finally {
        pluginTestAgent.stop(true);
    }
}
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) DefaultApplicationContext(com.navercorp.pinpoint.profiler.context.module.DefaultApplicationContext) ApplicationContext(com.navercorp.pinpoint.profiler.context.module.ApplicationContext) DefaultApplicationContext(com.navercorp.pinpoint.profiler.context.module.DefaultApplicationContext) DefaultAgentOption(com.navercorp.pinpoint.bootstrap.DefaultAgentOption) DefaultServiceTypeRegistryService(com.navercorp.pinpoint.common.service.DefaultServiceTypeRegistryService) 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 8 with ProfilerConfig

use of com.navercorp.pinpoint.bootstrap.config.ProfilerConfig in project pinpoint by naver.

the class MockApplicationContext method of.

public static MockApplicationContext of(String configPath) {
    ProfilerConfig profilerConfig = null;
    try {
        final URL resource = MockApplicationContext.class.getClassLoader().getResource(configPath);
        if (resource == null) {
            throw new FileNotFoundException("pinpoint.config not found. configPath:" + configPath);
        }
        profilerConfig = DefaultProfilerConfig.load(resource.getPath());
        ((DefaultProfilerConfig) profilerConfig).setApplicationServerType(ServiceType.TEST_STAND_ALONE.getName());
    } catch (IOException ex) {
        throw new RuntimeException(ex.getMessage(), ex);
    }
    return of(profilerConfig);
}
Also used : ProfilerConfig(com.navercorp.pinpoint.bootstrap.config.ProfilerConfig) DefaultProfilerConfig(com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig) DefaultProfilerConfig(com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) URL(java.net.URL)

Example 9 with ProfilerConfig

use of com.navercorp.pinpoint.bootstrap.config.ProfilerConfig in project pinpoint by naver.

the class VertxConfigTest method config.

@Test
public void config() {
    Properties properties = new Properties();
    properties.setProperty("profiler.vertx.enable", "true");
    properties.setProperty("profiler.vertx.http.server.enable", "true");
    properties.setProperty("profiler.vertx.http.client.enable", "true");
    properties.setProperty("profiler.vertx.bootstrap.main", "io.vertx.core.Starter");
    ProfilerConfig profilerConfig = new DefaultProfilerConfig(properties);
    VertxConfig config = new VertxConfig(profilerConfig);
    assertEquals(true, config.isEnable());
    assertEquals(true, config.isEnableHttpServer());
    assertEquals(true, config.isEnableHttpClient());
    assertEquals(1, config.getBootstrapMains().size());
    assertEquals("io.vertx.core.Starter", config.getBootstrapMains().get(0));
    properties = new Properties();
    properties.setProperty("profiler.vertx.enable", "false");
    properties.setProperty("profiler.vertx.http.server.enable", "false");
    properties.setProperty("profiler.vertx.http.client.enable", "false");
    properties.setProperty("profiler.vertx.bootstrap.main", "");
    profilerConfig = new DefaultProfilerConfig(properties);
    config = new VertxConfig(profilerConfig);
    assertEquals(false, config.isEnable());
    assertEquals(false, config.isEnableHttpServer());
    assertEquals(false, config.isEnableHttpClient());
    assertEquals(1, config.getBootstrapMains().size());
    assertEquals("", config.getBootstrapMains().get(0));
}
Also used : ProfilerConfig(com.navercorp.pinpoint.bootstrap.config.ProfilerConfig) DefaultProfilerConfig(com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig) DefaultProfilerConfig(com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig) Properties(java.util.Properties) Test(org.junit.Test)

Example 10 with ProfilerConfig

use of com.navercorp.pinpoint.bootstrap.config.ProfilerConfig in project pinpoint by naver.

the class VertxHttpClientConfigTest method config.

@Test
public void config() {
    Properties properties = new Properties();
    properties.setProperty("profiler.vertx.http.client.param", "true");
    properties.setProperty("profiler.vertx.http.client.cookie", "true");
    properties.setProperty("profiler.vertx.http.client.cookie.dumptype", "EXCEPTION");
    properties.setProperty("profiler.vertx.http.client.cookie.sampling.rate", "1");
    properties.setProperty("profiler.vertx.http.client.entity.statuscode", "true");
    ProfilerConfig profilerConfig = new DefaultProfilerConfig(properties);
    VertxHttpClientConfig config = new VertxHttpClientConfig(profilerConfig);
    assertEquals(true, config.isParam());
    assertEquals(true, config.isCookie());
    assertEquals(DumpType.EXCEPTION, config.getCookieDumpType());
    assertEquals(1, config.getCookieSamplingRate());
    assertEquals(true, config.isStatusCode());
    properties = new Properties();
    properties.setProperty("profiler.vertx.http.client.param", "false");
    properties.setProperty("profiler.vertx.http.client.cookie", "false");
    properties.setProperty("profiler.vertx.http.client.cookie.dumptype", "ALWAYS");
    properties.setProperty("profiler.vertx.http.client.cookie.sampling.rate", "99");
    properties.setProperty("profiler.vertx.http.client.entity.statuscode", "false");
    profilerConfig = new DefaultProfilerConfig(properties);
    config = new VertxHttpClientConfig(profilerConfig);
    assertEquals(false, config.isParam());
    assertEquals(false, config.isCookie());
    assertEquals(DumpType.ALWAYS, config.getCookieDumpType());
    assertEquals(99, config.getCookieSamplingRate());
    assertEquals(false, config.isStatusCode());
}
Also used : ProfilerConfig(com.navercorp.pinpoint.bootstrap.config.ProfilerConfig) DefaultProfilerConfig(com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig) DefaultProfilerConfig(com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig) Properties(java.util.Properties) Test(org.junit.Test)

Aggregations

ProfilerConfig (com.navercorp.pinpoint.bootstrap.config.ProfilerConfig)39 DefaultProfilerConfig (com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig)36 Test (org.junit.Test)25 Properties (java.util.Properties)24 BeanDefinition (org.springframework.beans.factory.config.BeanDefinition)12 RootBeanDefinition (org.springframework.beans.factory.support.RootBeanDefinition)12 TraceContext (com.navercorp.pinpoint.bootstrap.context.TraceContext)5 DefaultAnnotationKeyRegistryService (com.navercorp.pinpoint.common.service.DefaultAnnotationKeyRegistryService)5 DefaultServiceTypeRegistryService (com.navercorp.pinpoint.common.service.DefaultServiceTypeRegistryService)5 AgentOption (com.navercorp.pinpoint.bootstrap.AgentOption)4 DefaultAgentOption (com.navercorp.pinpoint.bootstrap.DefaultAgentOption)4 InterceptorRegistryBinder (com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder)4 DefaultApplicationContext (com.navercorp.pinpoint.profiler.context.module.DefaultApplicationContext)3 Module (com.google.inject.Module)2 Trace (com.navercorp.pinpoint.bootstrap.context.Trace)2 InstrumentClass (com.navercorp.pinpoint.bootstrap.instrument.InstrumentClass)2 InstrumentException (com.navercorp.pinpoint.bootstrap.instrument.InstrumentException)2 InstrumentMethod (com.navercorp.pinpoint.bootstrap.instrument.InstrumentMethod)2 Instrumentor (com.navercorp.pinpoint.bootstrap.instrument.Instrumentor)2 TransformCallback (com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformCallback)2