use of com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch in project pinpoint by naver.
the class JoinAgentStatBoMapperTest method map2Test.
@Test
public void map2Test() {
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 TFJvmGc tFJvmGc = new TFJvmGc();
tFJvmGc.setJvmMemoryHeapUsed(1000);
tFJvmGc.setJvmMemoryNonHeapUsed(300);
tFAgentStat.setGc(tFJvmGc);
final TFAgentStat tFAgentStat2 = new TFAgentStat();
tFAgentStat2.setAgentId(agentId);
tFAgentStat2.setTimestamp(1491275148454L);
final TFJvmGc tFJvmGc2 = new TFJvmGc();
tFJvmGc2.setJvmMemoryHeapUsed(2000);
tFJvmGc2.setJvmMemoryNonHeapUsed(500);
tFAgentStat2.setGc(tFJvmGc2);
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<JoinMemoryBo> joinMemoryBoList = joinAgentStatBo.getJoinMemoryBoList();
assertEquals(joinMemoryBoList.size(), 2);
JoinMemoryBo joinMemoryBo = joinMemoryBoList.get(0);
assertEquals(joinMemoryBo.getId(), agentId);
assertEquals(joinMemoryBo.getTimestamp(), 1491274148454L);
assertEquals((long) joinMemoryBo.getHeapUsedJoinValue().getAvg(), 1000);
assertEquals((long) joinMemoryBo.getNonHeapUsedJoinValue().getAvg(), 300);
JoinMemoryBo joinMemoryBo2 = joinMemoryBoList.get(1);
assertEquals(joinMemoryBo2.getId(), agentId);
assertEquals(joinMemoryBo2.getTimestamp(), 1491275148454L);
assertEquals((long) joinMemoryBo2.getHeapUsedJoinValue().getAvg(), 2000);
assertEquals((long) joinMemoryBo2.getNonHeapUsedJoinValue().getAvg(), 500);
}
use of com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch in project pinpoint by naver.
the class FlinkTBaseLocator method newTypeLocator.
private TypeLocator<TBase<?, ?>> newTypeLocator() {
HeaderFactory headerFactory = new FlinkHeaderFactory();
TypeLocatorBuilder<TBase<?, ?>> typeLocatorBuilder = new TypeLocatorBuilder<>(headerFactory);
typeLocatorBuilder.addBodyFactory(AGENT_STAT_BATCH, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TFAgentStatBatch();
}
});
return typeLocatorBuilder.build();
}
use of com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch in project pinpoint by naver.
the class SendAgentStatService method save.
@Override
public void save(AgentStatBo agentStatBo) {
if (!flinkClusterEnable) {
return;
}
TFAgentStatBatch tFAgentStatBatch = tFAgentStatBatchMapper.map(agentStatBo);
sendData(tFAgentStatBatch);
}
use of com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch in project pinpoint by naver.
the class JoinAgentStatBoMapperTest method map4Test.
@Test
public void map4Test() {
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 TFActiveTraceHistogram tFActiveTraceHistogram = new TFActiveTraceHistogram();
List<Integer> activeTraceCount = new ArrayList<>(4);
activeTraceCount.add(10);
activeTraceCount.add(20);
activeTraceCount.add(40);
activeTraceCount.add(50);
tFActiveTraceHistogram.setVersion((short) 2);
tFActiveTraceHistogram.setHistogramSchemaType(1);
tFActiveTraceHistogram.setActiveTraceCount(activeTraceCount);
final TFActiveTrace tfActiveTrace = new TFActiveTrace();
tfActiveTrace.setHistogram(tFActiveTraceHistogram);
tFAgentStat.setActiveTrace(tfActiveTrace);
final TFAgentStat tFAgentStat2 = new TFAgentStat();
tFAgentStat2.setAgentId(agentId);
tFAgentStat2.setTimestamp(1491275148454L);
tFAgentStat2.setCollectInterval(5000);
final TFActiveTraceHistogram tFActiveTraceHistogram2 = new TFActiveTraceHistogram();
List<Integer> activeTraceCount2 = new ArrayList<>(4);
activeTraceCount2.add(11);
activeTraceCount2.add(21);
activeTraceCount2.add(41);
activeTraceCount2.add(51);
tFActiveTraceHistogram2.setVersion((short) 2);
tFActiveTraceHistogram2.setHistogramSchemaType(1);
tFActiveTraceHistogram2.setActiveTraceCount(activeTraceCount2);
final TFActiveTrace tfActiveTrace2 = new TFActiveTrace();
tfActiveTrace2.setHistogram(tFActiveTraceHistogram2);
tFAgentStat2.setActiveTrace(tfActiveTrace2);
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<JoinActiveTraceBo> joinActiveTraceBoList = joinAgentStatBo.getJoinActiveTraceBoList();
assertEquals(joinActiveTraceBoList.size(), 2);
JoinActiveTraceBo joinActiveTraceBo = joinActiveTraceBoList.get(0);
assertEquals(joinActiveTraceBo.getId(), agentId);
assertEquals(joinActiveTraceBo.getTimestamp(), 1491274148454L);
assertEquals(joinActiveTraceBo.getVersion(), 2);
assertEquals(joinActiveTraceBo.getHistogramSchemaType(), 1);
assertEquals(joinActiveTraceBo.getTotalCountJoinValue(), new JoinIntFieldBo(120, 120, agentId, 120, agentId));
JoinActiveTraceBo joinActiveTraceBo2 = joinActiveTraceBoList.get(1);
assertEquals(joinActiveTraceBo2.getId(), agentId);
assertEquals(joinActiveTraceBo2.getTimestamp(), 1491275148454L);
assertEquals(joinActiveTraceBo2.getVersion(), 2);
assertEquals(joinActiveTraceBo2.getHistogramSchemaType(), 1);
assertEquals(joinActiveTraceBo2.getTotalCountJoinValue(), new JoinIntFieldBo(124, 124, agentId, 124, agentId));
}
use of com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch in project pinpoint by naver.
the class TBaseFlatMapperTest method flatMapTest.
@Test
public void flatMapTest() throws Exception {
ApplicationCache applicationCache = newMockApplicationCache();
TBaseFlatMapper mapper = new TBaseFlatMapper(new JoinAgentStatBoMapper(), applicationCache, new DefaultTBaseFlatMapperInterceptor());
TFAgentStatBatch tfAgentStatBatch = createTFAgentStatBatch();
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);
assertJoinCpuLoadBo(joinAgentStatBo.getJoinCpuLoadBoList());
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);
assertJoinCpuLoadBo(joinApplicationStatBo.getJoinCpuLoadBoList());
}
Aggregations