use of com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch in project pinpoint by naver.
the class TBaseFlatMapperTest method flatMap2Test.
@Test
public void flatMap2Test() throws Exception {
ApplicationCache applicationCache = newMockApplicationCache();
TBaseFlatMapper mapper = new TBaseFlatMapper(new JoinAgentStatBoMapper(), applicationCache, new DefaultTBaseFlatMapperInterceptor());
TFAgentStatBatch tfAgentStatBatch = createTFAgentStatBatch2();
ArrayList<Tuple3<String, JoinStatBo, Long>> dataList = new ArrayList<>();
ListCollector<Tuple3<String, JoinStatBo, Long>> collector = new ListCollector<>(dataList);
RawData rawdata = newRawData(tfAgentStatBatch);
mapper.flatMap(rawdata, collector);
assertEquals(dataList.size(), 2);
Tuple3<String, JoinStatBo, Long> data1 = dataList.get(0);
assertEquals(data1.f0, AGENT_ID);
assertEquals(data1.f2.longValue(), 1491274143454L);
JoinAgentStatBo joinAgentStatBo = (JoinAgentStatBo) data1.f1;
assertEquals(joinAgentStatBo.getId(), AGENT_ID);
assertEquals(joinAgentStatBo.getAgentStartTimestamp(), 1491274142454L);
assertEquals(joinAgentStatBo.getTimestamp(), 1491274143454L);
assertJoinMemoryBo(joinAgentStatBo.getJoinMemoryBoList());
Tuple3<String, JoinStatBo, Long> data2 = dataList.get(1);
assertEquals(data2.f0, APPLICATION_ID);
assertEquals(data2.f2.longValue(), 1491274140000L);
JoinApplicationStatBo joinApplicationStatBo = (JoinApplicationStatBo) data2.f1;
assertEquals(joinApplicationStatBo.getId(), APPLICATION_ID);
assertEquals(joinApplicationStatBo.getTimestamp(), 1491274140000L);
assertEquals(joinApplicationStatBo.getStatType(), StatType.APP_STST);
assertJoinMemoryBo(joinApplicationStatBo.getJoinMemoryBoList());
}
use of com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch in project pinpoint by naver.
the class JoinAgentStatBoMapperTest method mapTest.
@Test
public void mapTest() {
final String agentId = "testAgent";
final JoinAgentStatBoMapper joinAgentStatBoMapper = new JoinAgentStatBoMapper();
final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch();
tFAgentStatBatch.setStartTimestamp(1491274138454L);
tFAgentStatBatch.setAgentId(agentId);
final TFAgentStat tFAgentStat = new TFAgentStat();
tFAgentStat.setAgentId(agentId);
tFAgentStat.setTimestamp(1491274148454L);
final TFCpuLoad tFCpuLoad = new TFCpuLoad();
tFCpuLoad.setJvmCpuLoad(10);
tFCpuLoad.setSystemCpuLoad(30);
tFAgentStat.setCpuLoad(tFCpuLoad);
final TFAgentStat tFAgentStat2 = new TFAgentStat();
tFAgentStat2.setAgentId(agentId);
tFAgentStat2.setTimestamp(1491275148454L);
final TFCpuLoad tFCpuLoad2 = new TFCpuLoad();
tFCpuLoad2.setJvmCpuLoad(20);
tFCpuLoad2.setSystemCpuLoad(50);
tFAgentStat2.setCpuLoad(tFCpuLoad2);
final List<TFAgentStat> tFAgentStatList = new ArrayList<>(2);
tFAgentStatList.add(tFAgentStat);
tFAgentStatList.add(tFAgentStat2);
tFAgentStatBatch.setAgentStats(tFAgentStatList);
JoinAgentStatBo joinAgentStatBo = joinAgentStatBoMapper.map(tFAgentStatBatch);
assertEquals(joinAgentStatBo.getId(), agentId);
assertEquals(joinAgentStatBo.getAgentStartTimestamp(), 1491274138454L);
assertEquals(joinAgentStatBo.getTimestamp(), 1491274148454L);
List<JoinCpuLoadBo> joinCpuLoadBoList = joinAgentStatBo.getJoinCpuLoadBoList();
assertEquals(joinCpuLoadBoList.size(), 2);
JoinCpuLoadBo joinCpuLoadBo = joinCpuLoadBoList.get(0);
assertEquals(joinCpuLoadBo.getId(), agentId);
assertEquals(joinCpuLoadBo.getTimestamp(), 1491274148454L);
JoinDoubleFieldBo jvmCpuLoadJoinValue = joinCpuLoadBo.getJvmCpuLoadJoinValue();
assertEquals(jvmCpuLoadJoinValue.getAvg(), 10, 0);
assertEquals(jvmCpuLoadJoinValue.getMin(), 10, 0);
assertEquals(jvmCpuLoadJoinValue.getMax(), 10, 0);
JoinDoubleFieldBo systemCpuLoadJoinValue = joinCpuLoadBo.getSystemCpuLoadJoinValue();
assertEquals(systemCpuLoadJoinValue.getAvg(), 30, 0);
assertEquals(systemCpuLoadJoinValue.getMin(), 30, 0);
assertEquals(systemCpuLoadJoinValue.getMax(), 30, 0);
joinCpuLoadBo = joinCpuLoadBoList.get(1);
assertEquals(joinCpuLoadBo.getId(), agentId);
assertEquals(joinCpuLoadBo.getTimestamp(), 1491275148454L);
jvmCpuLoadJoinValue = joinCpuLoadBo.getJvmCpuLoadJoinValue();
assertEquals(jvmCpuLoadJoinValue.getAvg(), 20, 0);
assertEquals(jvmCpuLoadJoinValue.getMin(), 20, 0);
assertEquals(jvmCpuLoadJoinValue.getMax(), 20, 0);
systemCpuLoadJoinValue = joinCpuLoadBo.getSystemCpuLoadJoinValue();
assertEquals(systemCpuLoadJoinValue.getAvg(), 50, 0);
assertEquals(systemCpuLoadJoinValue.getMin(), 50, 0);
assertEquals(systemCpuLoadJoinValue.getMax(), 50, 0);
}
Aggregations