Search in sources :

Example 1 with AgentInfoSender

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

the class AgentInfoSenderProvider method get.

@Override
public AgentInfoSender get() {
    final EnhancedDataSender enhancedDataSender = this.enhancedDataSenderProvider.get();
    final AgentInformation agentInformation = this.agentInformationProvider.get();
    final AgentInfoSender.Builder builder = new AgentInfoSender.Builder(enhancedDataSender, agentInformation, jvmInformation);
    builder.sendInterval(profilerConfig.getAgentInfoSendRetryInterval());
    return builder.build();
}
Also used : EnhancedDataSender(com.navercorp.pinpoint.profiler.sender.EnhancedDataSender) AgentInformation(com.navercorp.pinpoint.profiler.AgentInformation) AgentInfoSender(com.navercorp.pinpoint.profiler.AgentInfoSender)

Example 2 with AgentInfoSender

use of com.navercorp.pinpoint.profiler.AgentInfoSender 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 3 with AgentInfoSender

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

the class ServerMetaDataHolderProvider method get.

@Override
public ServerMetaDataHolder get() {
    AgentInfoSender agentInfoSender = this.agentInfoSender.get();
    List<String> vmArgs = RuntimeMXBeanUtils.getVmArgs();
    ServerMetaDataHolder serverMetaDataHolder = new DefaultServerMetaDataHolder(vmArgs);
    serverMetaDataHolder.addListener(agentInfoSender);
    return serverMetaDataHolder;
}
Also used : DefaultServerMetaDataHolder(com.navercorp.pinpoint.profiler.context.DefaultServerMetaDataHolder) ServerMetaDataHolder(com.navercorp.pinpoint.bootstrap.context.ServerMetaDataHolder) DefaultServerMetaDataHolder(com.navercorp.pinpoint.profiler.context.DefaultServerMetaDataHolder) AgentInfoSender(com.navercorp.pinpoint.profiler.AgentInfoSender)

Example 4 with AgentInfoSender

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

the class DefaultApplicationContextTest method test.

@Test
public void test() {
    DefaultApplicationContext applicationContext = newApplicationContext();
    try {
        Injector injector = applicationContext.getInjector();
        AgentInfoSender instance1 = injector.getInstance(AgentInfoSender.class);
        AgentInfoSender instance2 = injector.getInstance(AgentInfoSender.class);
        Assert.assertSame(instance1, instance2);
    } finally {
        applicationContext.close();
    }
}
Also used : Injector(com.google.inject.Injector) AgentInfoSender(com.navercorp.pinpoint.profiler.AgentInfoSender) Test(org.junit.Test)

Aggregations

AgentInfoSender (com.navercorp.pinpoint.profiler.AgentInfoSender)4 Injector (com.google.inject.Injector)2 Test (org.junit.Test)2 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 ServerMetaDataHolder (com.navercorp.pinpoint.bootstrap.context.ServerMetaDataHolder)1 DefaultAnnotationKeyRegistryService (com.navercorp.pinpoint.common.service.DefaultAnnotationKeyRegistryService)1 DefaultServiceTypeRegistryService (com.navercorp.pinpoint.common.service.DefaultServiceTypeRegistryService)1 AgentInformation (com.navercorp.pinpoint.profiler.AgentInformation)1 ClassFileTransformerDispatcher (com.navercorp.pinpoint.profiler.ClassFileTransformerDispatcher)1 DefaultServerMetaDataHolder (com.navercorp.pinpoint.profiler.context.DefaultServerMetaDataHolder)1 DefaultApplicationContext (com.navercorp.pinpoint.profiler.context.module.DefaultApplicationContext)1 InterceptorRegistryBinder (com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder)1 EnhancedDataSender (com.navercorp.pinpoint.profiler.sender.EnhancedDataSender)1