Search in sources :

Example 1 with DefaultAgentStatMonitor

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);
    }
}
Also used : DefaultAgentStatMonitor(com.navercorp.pinpoint.profiler.monitor.DefaultAgentStatMonitor) TAgentStatBatch(com.navercorp.pinpoint.thrift.dto.TAgentStatBatch) DefaultAgentStatMonitor(com.navercorp.pinpoint.profiler.monitor.DefaultAgentStatMonitor) AgentStatMonitor(com.navercorp.pinpoint.profiler.monitor.AgentStatMonitor) Test(org.junit.Test)

Aggregations

AgentStatMonitor (com.navercorp.pinpoint.profiler.monitor.AgentStatMonitor)1 DefaultAgentStatMonitor (com.navercorp.pinpoint.profiler.monitor.DefaultAgentStatMonitor)1 TAgentStatBatch (com.navercorp.pinpoint.thrift.dto.TAgentStatBatch)1 Test (org.junit.Test)1