use of com.navercorp.pinpoint.profiler.monitor.DefaultAgentStatMonitor 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;
// When
AgentStatMonitor monitor = new DefaultAgentStatMonitor(this.dataSender, "agentId", System.currentTimeMillis(), agentStatCollector, collectionIntervalMs, numCollectionsPerBatch);
monitor.start();
Thread.sleep(totalTestDurationMs);
monitor.stop();
// Then
assertTrue(tBaseRecorder.size() >= minNumBatchToTest);
for (TAgentStatBatch agentStatBatch : tBaseRecorder) {
logger.debug("agentStatBatch:{}", agentStatBatch);
assertTrue(agentStatBatch.getAgentStats().size() <= numCollectionsPerBatch);
}
}
Aggregations