Search in sources :

Example 1 with EachUriStatData

use of com.navercorp.pinpoint.profiler.monitor.metric.uri.EachUriStatData in project pinpoint by naver.

the class GrpcUriStatMessageConverter method createPAgentUriStat.

private PAgentUriStat createPAgentUriStat(AgentUriStatData agentUriStatData) {
    long baseTimestamp = agentUriStatData.getBaseTimestamp();
    PAgentUriStat.Builder builder = PAgentUriStat.newBuilder();
    builder.setTimestamp(baseTimestamp);
    builder.setBucketVersion(UriStatHistogramBucket.getBucketVersion());
    Collection<EachUriStatData> allUriStatData = agentUriStatData.getAllUriStatData();
    for (EachUriStatData eachUriStatData : allUriStatData) {
        PEachUriStat pEachUriStat = createPEachUriStat(eachUriStatData);
        builder.addEachUriStat(pEachUriStat);
    }
    return builder.build();
}
Also used : PAgentUriStat(com.navercorp.pinpoint.grpc.trace.PAgentUriStat) PEachUriStat(com.navercorp.pinpoint.grpc.trace.PEachUriStat) EachUriStatData(com.navercorp.pinpoint.profiler.monitor.metric.uri.EachUriStatData)

Example 2 with EachUriStatData

use of com.navercorp.pinpoint.profiler.monitor.metric.uri.EachUriStatData in project pinpoint by naver.

the class AsyncQueueingUriStatStorageTest method storageTest.

@Test
public void storageTest() {
    int collectInterval = 100;
    int storeCount = RANDOM.nextInt(5) + 1;
    AsyncQueueingUriStatStorage storage = null;
    try {
        storage = new AsyncQueueingUriStatStorage(5012, 3, "Test-Executor", collectInterval);
        long sleepTime = System.currentTimeMillis() % collectInterval;
        try {
            Thread.sleep(sleepTime + 2);
        } catch (InterruptedException e) {
        }
        for (int i = 0; i < storeCount; i++) {
            storeRandomValue(storage);
        }
        Assert.assertNull(storage.poll());
        try {
            Thread.sleep(collectInterval);
        } catch (InterruptedException e) {
        }
        storage.pollTimeout(collectInterval);
        AgentUriStatData poll = storage.poll();
        Assert.assertNotNull(poll);
        Collection<EachUriStatData> allUriStatData = poll.getAllUriStatData();
        for (EachUriStatData eachUriStatData : allUriStatData) {
            storeCount -= eachUriStatData.getTotalHistogram().getCount();
        }
        Assert.assertEquals(0, storeCount);
    } finally {
        if (storage != null) {
            storage.close();
        }
    }
}
Also used : AgentUriStatData(com.navercorp.pinpoint.profiler.monitor.metric.uri.AgentUriStatData) EachUriStatData(com.navercorp.pinpoint.profiler.monitor.metric.uri.EachUriStatData) Test(org.junit.Test)

Aggregations

EachUriStatData (com.navercorp.pinpoint.profiler.monitor.metric.uri.EachUriStatData)2 PAgentUriStat (com.navercorp.pinpoint.grpc.trace.PAgentUriStat)1 PEachUriStat (com.navercorp.pinpoint.grpc.trace.PEachUriStat)1 AgentUriStatData (com.navercorp.pinpoint.profiler.monitor.metric.uri.AgentUriStatData)1 Test (org.junit.Test)1