use of com.navercorp.pinpoint.profiler.context.monitor.config.MonitorConfig in project pinpoint by naver.
the class AgentStatMonitorTest method testAgentStatMonitor.
@Test
public void testAgentStatMonitor() throws InterruptedException {
// Given
final long collectionIntervalMs = 1000 * 1;
final int numCollectionsPerBatch = 2;
final int minNumBatchToTest = 2;
final long totalTestDurationMs = collectionIntervalMs + collectionIntervalMs * numCollectionsPerBatch * minNumBatchToTest;
// profilerConfig.getProfileJvmStatCollectIntervalMs(), profilerConfig.getProfileJvmStatBatchSendCount()
MonitorConfig mockProfilerConfig = Mockito.mock(MonitorConfig.class);
Mockito.when(mockProfilerConfig.getProfileJvmStatCollectIntervalMs()).thenReturn((int) collectionIntervalMs);
Mockito.when(mockProfilerConfig.getProfileJvmStatBatchSendCount()).thenReturn(numCollectionsPerBatch);
// When
AgentStatMonitor monitor = new DefaultAgentStatMonitor(this.dataSender, "agentId", System.currentTimeMillis(), agentStatCollector, null, null, mockProfilerConfig);
monitor.start();
Thread.sleep(totalTestDurationMs);
monitor.stop();
// Then
assertTrue(tBaseRecorder.size() >= minNumBatchToTest);
for (AgentStatMetricSnapshotBatch agentStatBatch : tBaseRecorder) {
logger.debug("agentStatBatch:{}", agentStatBatch);
assertTrue(agentStatBatch.getAgentStats().size() <= numCollectionsPerBatch);
}
}
use of com.navercorp.pinpoint.profiler.context.monitor.config.MonitorConfig in project pinpoint by naver.
the class ConfigModule method configure.
@Override
protected void configure() {
logger.info("configure {}", this.getClass().getSimpleName());
binder().requireExplicitBindings();
binder().requireAtInjectOnConstructors();
binder().disableCircularProxies();
ProfilerConfig profilerConfig = agentOption.getProfilerConfig();
bind(ProfilerConfig.class).toInstance(profilerConfig);
Properties properties = profilerConfig.getProperties();
ConfigurationLoader configurationLoader = new ConfigurationLoader(properties);
ContextConfig contextConfig = new DefaultContextConfig();
configurationLoader.load(contextConfig);
logger.info("{}", contextConfig);
bind(ContextConfig.class).toInstance(contextConfig);
bindConstants(contextConfig);
PluginLoadingConfig pluginLoadingConfig = new DefaultPluginLoadingConfig();
configurationLoader.load(pluginLoadingConfig);
logger.info("{}", pluginLoadingConfig);
bind(PluginLoadingConfig.class).toInstance(pluginLoadingConfig);
InstrumentConfig instrumentConfig = new DefaultInstrumentConfig();
configurationLoader.load(instrumentConfig);
logger.info("{}", instrumentConfig);
bind(InstrumentConfig.class).toInstance(instrumentConfig);
InstrumentMatcherCacheConfig instrumentMatcherCacheConfig = new DefaultInstrumentMatcherCacheConfig();
configurationLoader.load(instrumentMatcherCacheConfig);
logger.info("{}", instrumentMatcherCacheConfig);
bind(InstrumentMatcherCacheConfig.class).toInstance(instrumentMatcherCacheConfig);
MonitorConfig monitorConfig = new DefaultMonitorConfig();
configurationLoader.load(monitorConfig);
logger.info("{}", monitorConfig);
bind(MonitorConfig.class).toInstance(monitorConfig);
bind(TransportModule.class).toInstance(profilerConfig.getTransportModule());
bind(Instrumentation.class).toInstance(agentOption.getInstrumentation());
bind(InterceptorRegistryBinder.class).toProvider(InterceptorRegistryBinderProvider.class).in(Scopes.SINGLETON);
TypeLiteral<List<String>> pluginJarFile = new TypeLiteral<List<String>>() {
};
bind(pluginJarFile).annotatedWith(PluginJarPaths.class).toInstance(agentOption.getPluginJars());
TypeLiteral<List<PluginJar>> pluginJars = new TypeLiteral<List<PluginJar>>() {
};
bind(pluginJars).annotatedWith(PluginJars.class).toProvider(PluginJarsProvider.class).in(Scopes.SINGLETON);
bindBootstrapCoreInformation();
bindAgentInformation(agentOption.getAgentId(), agentOption.getAgentName(), agentOption.getApplicationName(), agentOption.isContainer());
bindShutdownHook(contextConfig);
}
Aggregations