use of com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig in project pinpoint by naver.
the class TargetBeanFilterTest method target4.
@Test
public void target4() {
Properties properties = new Properties();
properties.put(SpringBeansConfig.SPRING_BEANS_PREFIX + 1 + SpringBeansConfig.SPRING_BEANS_NAME_PATTERN_POSTFIX, "Target.*");
properties.put(SpringBeansConfig.SPRING_BEANS_PREFIX + 1 + SpringBeansConfig.SPRING_BEANS_CLASS_PATTERN_POSTFIX, "");
properties.put(SpringBeansConfig.SPRING_BEANS_PREFIX + 1 + SpringBeansConfig.SPRING_BEANS_ANNOTATION_POSTFIX, "");
properties.put(SpringBeansConfig.SPRING_BEANS_PREFIX + 2 + SpringBeansConfig.SPRING_BEANS_NAME_PATTERN_POSTFIX, "Target.*");
properties.put(SpringBeansConfig.SPRING_BEANS_PREFIX + 2 + SpringBeansConfig.SPRING_BEANS_CLASS_PATTERN_POSTFIX, "java.lang.String");
properties.put(SpringBeansConfig.SPRING_BEANS_PREFIX + 3 + SpringBeansConfig.SPRING_BEANS_NAME_PATTERN_POSTFIX, "Target.*");
properties.put(SpringBeansConfig.SPRING_BEANS_PREFIX + 3 + SpringBeansConfig.SPRING_BEANS_ANNOTATION_POSTFIX, "org.springframework.stereotype.Controller");
ProfilerConfig config = new DefaultProfilerConfig(properties);
TargetBeanFilter filter = TargetBeanFilter.of(config);
filter.clear();
BeanDefinition beanDefinition = new RootBeanDefinition(String.class);
assertTrue(filter.isTarget(SpringBeansTargetScope.COMPONENT_SCAN, "Target0", beanDefinition));
assertFalse(filter.isTarget(SpringBeansTargetScope.COMPONENT_SCAN, "Foo", beanDefinition));
}
use of com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig in project pinpoint by naver.
the class SpringBeansConfigTest method pattern.
@Test
public void pattern() {
Properties properties = new Properties();
properties.put(SpringBeansConfig.SPRING_BEANS_PREFIX + 1 + SpringBeansConfig.SPRING_BEANS_NAME_PATTERN_POSTFIX, "Target.*");
properties.put(SpringBeansConfig.SPRING_BEANS_PREFIX + 1 + SpringBeansConfig.SPRING_BEANS_ANNOTATION_POSTFIX, "org.springframework.stereotype.Controller");
// normal
properties.put(SpringBeansConfig.SPRING_BEANS_PREFIX + 6 + SpringBeansConfig.SPRING_BEANS_CLASS_PATTERN_POSTFIX, "java.lang.String");
properties.put(SpringBeansConfig.SPRING_BEANS_PREFIX + 6 + SpringBeansConfig.SPRING_BEANS_ANNOTATION_POSTFIX, "org.springframework.stereotype.Service");
// old
properties.put(SpringBeansConfig.SPRING_BEANS_NAME_PATTERN, "com.navercorp.*");
ProfilerConfig config = new DefaultProfilerConfig(properties);
SpringBeansConfig springBeansConfig = new SpringBeansConfig(config);
assertEquals(3, springBeansConfig.getTargets().size());
}
use of com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig in project pinpoint by naver.
the class SpringBeansConfigTest method backwardCompatibility.
@Test
public void backwardCompatibility() {
Properties properties = new Properties();
properties.put(SpringBeansConfig.SPRING_BEANS_NAME_PATTERN, "");
properties.put(SpringBeansConfig.SPRING_BEANS_CLASS_PATTERN, "com.navercorp.*");
properties.put(SpringBeansConfig.SPRING_BEANS_ANNOTATION, "org.springframework.stereotype.Controller, org.springframework.stereotype.Servicem, org.springframework.stereotype.Repository");
properties.put(SpringBeansConfig.SPRING_BEANS_PREFIX + 1 + SpringBeansConfig.SPRING_BEANS_NAME_PATTERN_POSTFIX, "Target.*");
properties.put(SpringBeansConfig.SPRING_BEANS_PREFIX + 1 + SpringBeansConfig.SPRING_BEANS_ANNOTATION_POSTFIX, "org.springframework.stereotype.Controller");
properties.put(SpringBeansConfig.SPRING_BEANS_PREFIX + 2 + SpringBeansConfig.SPRING_BEANS_CLASS_PATTERN_POSTFIX, "java.lang.String");
properties.put(SpringBeansConfig.SPRING_BEANS_PREFIX + 2 + SpringBeansConfig.SPRING_BEANS_ANNOTATION_POSTFIX, "org.springframework.stereotype.Service");
properties.put(SpringBeansConfig.SPRING_BEANS_PREFIX + 3 + SpringBeansConfig.SPRING_BEANS_ANNOTATION_POSTFIX, "org.springframework.stereotype.Repository");
ProfilerConfig config = new DefaultProfilerConfig(properties);
SpringBeansConfig springBeansConfig = new SpringBeansConfig(config);
// backward compatiblity.
assertEquals(5, springBeansConfig.getTargets().size());
}
use of com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig in project pinpoint by naver.
the class VertxHttpServerConfigTest method config.
@Test
public void config() {
Properties properties = new Properties();
properties.setProperty("profiler.vertx.http.server.tracerequestparam", "true");
properties.setProperty("profiler.vertx.http.server.excludeurl", "/l7/check");
properties.setProperty("profiler.vertx.http.server.realipheader", "RealIp");
properties.setProperty("profiler.vertx.http.server.realipemptyvalue", "unknown");
properties.setProperty("profiler.vertx.http.server.excludemethod", "chunk, continue");
ProfilerConfig profilerConfig = new DefaultProfilerConfig(properties);
VertxHttpServerConfig config = new VertxHttpServerConfig(profilerConfig);
assertEquals(true, config.isTraceRequestParam());
assertEquals(true, config.getExcludeUrlFilter().filter("/l7/check"));
assertEquals("RealIp", config.getRealIpHeader());
assertEquals("unknown", config.getRealIpEmptyValue());
assertEquals(true, config.getExcludeProfileMethodFilter().filter("CHUNK"));
properties = new Properties();
properties.setProperty("profiler.vertx.http.server.tracerequestparam", "false");
properties.setProperty("profiler.vertx.http.server.excludeurl", "");
properties.setProperty("profiler.vertx.http.server.realipheader", "");
properties.setProperty("profiler.vertx.http.server.realipemptyvalue", "");
properties.setProperty("profiler.vertx.http.server.excludemethod", "");
profilerConfig = new DefaultProfilerConfig(properties);
config = new VertxHttpServerConfig(profilerConfig);
assertEquals(false, config.isTraceRequestParam());
assertEquals(false, config.getExcludeUrlFilter().filter("/l7/check"));
assertEquals("", config.getRealIpHeader());
assertEquals("", config.getRealIpEmptyValue());
assertEquals(false, config.getExcludeProfileMethodFilter().filter("CHUNK"));
}
use of com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig 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);
}
Aggregations