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;
}
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);
}
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);
}
}
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();
}
}
}
Aggregations