Search in sources :

Example 1 with AgentUriStatData

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

the class GrpcStatMessageConverter method toMessage.

@Override
public GeneratedMessageV3 toMessage(MetricType message) {
    if (message instanceof AgentStatMetricSnapshotBatch) {
        final AgentStatMetricSnapshotBatch agentStatMetricSnapshotBatch = (AgentStatMetricSnapshotBatch) message;
        final PAgentStatBatch.Builder agentStatBatchBuilder = PAgentStatBatch.newBuilder();
        // Skip agentId, startTimestamp
        for (AgentStatMetricSnapshot agentStatMetricSnapshot : agentStatMetricSnapshotBatch.getAgentStats()) {
            final PAgentStat agentStat = converAgentStat(agentStatMetricSnapshot);
            agentStatBatchBuilder.addAgentStat(agentStat);
        }
        return agentStatBatchBuilder.build();
    } else if (message instanceof AgentStatMetricSnapshot) {
        final AgentStatMetricSnapshot agentStatMetricSnapshot = (AgentStatMetricSnapshot) message;
        final PAgentStat agentStat = converAgentStat(agentStatMetricSnapshot);
        return agentStat;
    } else if (message instanceof AgentCustomMetricSnapshotBatch) {
        final AgentCustomMetricSnapshotBatch agentCustomMetricSnapshotBatch = (AgentCustomMetricSnapshotBatch) message;
        final PCustomMetricMessage pCustomMetricMessage = customMetricMessageConverter.toMessage(agentCustomMetricSnapshotBatch);
        return pCustomMetricMessage;
    } else if (message instanceof AgentUriStatData) {
        final AgentUriStatData agentUriStatData = (AgentUriStatData) message;
        final PAgentUriStat agentUriStat = uriStatMessageConverter.toMessage(agentUriStatData);
        return agentUriStat;
    }
    return null;
}
Also used : AgentStatMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.AgentStatMetricSnapshot) PAgentStatBatch(com.navercorp.pinpoint.grpc.trace.PAgentStatBatch) AgentUriStatData(com.navercorp.pinpoint.profiler.monitor.metric.uri.AgentUriStatData) PAgentStat(com.navercorp.pinpoint.grpc.trace.PAgentStat) PCustomMetricMessage(com.navercorp.pinpoint.grpc.trace.PCustomMetricMessage) PAgentUriStat(com.navercorp.pinpoint.grpc.trace.PAgentUriStat) AgentStatMetricSnapshotBatch(com.navercorp.pinpoint.profiler.monitor.metric.AgentStatMetricSnapshotBatch) AgentCustomMetricSnapshotBatch(com.navercorp.pinpoint.profiler.monitor.metric.AgentCustomMetricSnapshotBatch)

Example 2 with AgentUriStatData

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

the class GrpcUriStatMessageConverterTest method convertTest.

@Test
public void convertTest() {
    long currentTimeMillis = System.currentTimeMillis();
    AgentUriStatData agentUriStatData = new AgentUriStatData(currentTimeMillis);
    List<UriStatInfo> uriStatInfoList = createRandomUriStatInfo(100);
    for (UriStatInfo uriStatInfo : uriStatInfoList) {
        agentUriStatData.add(uriStatInfo);
    }
    GrpcUriStatMessageConverter converter = new GrpcUriStatMessageConverter();
    PAgentUriStat agentUriStat = converter.toMessage(agentUriStatData);
    List<PEachUriStat> eachUriStatList = agentUriStat.getEachUriStatList();
    assertData(uriStatInfoList, eachUriStatList);
}
Also used : AgentUriStatData(com.navercorp.pinpoint.profiler.monitor.metric.uri.AgentUriStatData) PAgentUriStat(com.navercorp.pinpoint.grpc.trace.PAgentUriStat) PEachUriStat(com.navercorp.pinpoint.grpc.trace.PEachUriStat) UriStatInfo(com.navercorp.pinpoint.profiler.monitor.metric.uri.UriStatInfo) Test(org.junit.Test)

Example 3 with AgentUriStatData

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

the class UriStatCollectingJob method run.

@Override
public void run() {
    while (true) {
        AgentUriStatData agentUriStatData = uriStatStorage.poll();
        if (agentUriStatData == null) {
            break;
        }
        dataSender.send(agentUriStatData);
    }
}
Also used : AgentUriStatData(com.navercorp.pinpoint.profiler.monitor.metric.uri.AgentUriStatData)

Example 4 with AgentUriStatData

use of com.navercorp.pinpoint.profiler.monitor.metric.uri.AgentUriStatData 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

AgentUriStatData (com.navercorp.pinpoint.profiler.monitor.metric.uri.AgentUriStatData)4 PAgentUriStat (com.navercorp.pinpoint.grpc.trace.PAgentUriStat)2 Test (org.junit.Test)2 PAgentStat (com.navercorp.pinpoint.grpc.trace.PAgentStat)1 PAgentStatBatch (com.navercorp.pinpoint.grpc.trace.PAgentStatBatch)1 PCustomMetricMessage (com.navercorp.pinpoint.grpc.trace.PCustomMetricMessage)1 PEachUriStat (com.navercorp.pinpoint.grpc.trace.PEachUriStat)1 AgentCustomMetricSnapshotBatch (com.navercorp.pinpoint.profiler.monitor.metric.AgentCustomMetricSnapshotBatch)1 AgentStatMetricSnapshot (com.navercorp.pinpoint.profiler.monitor.metric.AgentStatMetricSnapshot)1 AgentStatMetricSnapshotBatch (com.navercorp.pinpoint.profiler.monitor.metric.AgentStatMetricSnapshotBatch)1 EachUriStatData (com.navercorp.pinpoint.profiler.monitor.metric.uri.EachUriStatData)1 UriStatInfo (com.navercorp.pinpoint.profiler.monitor.metric.uri.UriStatInfo)1