use of com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch in project pinpoint by naver.
the class TFAgentStatBatchMapper method map.
public TFAgentStatBatch map(AgentStatBo agentStatBo) {
try {
List<TFAgentStat> tFAgentstatList = tFAgentStatMapper.map(agentStatBo);
long startTimestamp = getStartTimestamp(agentStatBo);
TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch(agentStatBo.getAgentId(), startTimestamp, tFAgentstatList);
return tFAgentStatBatch;
} catch (Exception e) {
logger.error("not create thrift object to send flink server. : " + agentStatBo, e);
}
return null;
}
use of com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch in project pinpoint by naver.
the class TFAgentStatBatchMapperTest method mapTest.
@Test
public void mapTest() {
AgentStatBo agentStatBo = createCpuLoadBoList();
TFAgentStatMapper tFAgentStatMapper = new TFAgentStatMapper(new TFCpuLoadMapper[] { new TFCpuLoadMapper() });
TFAgentStatBatchMapper mapper = new TFAgentStatBatchMapper(tFAgentStatMapper);
TFAgentStatBatch tFAgentStatBatch = mapper.map(agentStatBo);
assertEquals(TEST_AGENT, tFAgentStatBatch.getAgentId());
assertEquals(startTimestamp, tFAgentStatBatch.getStartTimestamp());
List<TFAgentStat> agentStatList = tFAgentStatBatch.getAgentStats();
assertEquals(3, agentStatList.size());
}
use of com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch in project pinpoint by naver.
the class TBaseFlatMapper method serverRequestFlatMap.
private List<Tuple3<String, JoinStatBo, Long>> serverRequestFlatMap(TBase<?, ?> tBase) {
List<Tuple3<String, JoinStatBo, Long>> outData = new ArrayList<>(5);
if (tBase instanceof TFAgentStatBatch) {
if (logger.isDebugEnabled()) {
logger.debug("raw data : {}", tBase);
}
final long time = new Date().getTime() + 3600000;
final TFAgentStatBatch tFAgentStatBatch = (TFAgentStatBatch) tBase;
final JoinAgentStatBo joinAgentStatBo;
try {
joinAgentStatBo = joinAgentStatBoMapper.map(tFAgentStatBatch);
if (joinAgentStatBo == JoinAgentStatBo.EMPTY_JOIN_AGENT_STAT_BO) {
return EMPTY_LIST;
}
if (joinAgentStatBo.getTimestamp() >= time) {
logger.error("timestamp is too big !! {}", joinAgentStatBo.toString());
return EMPTY_LIST;
}
} catch (Exception e) {
logger.error("can't create joinAgentStatBo object {}", tFAgentStatBatch, e);
return EMPTY_LIST;
}
outData.add(new Tuple3<>(joinAgentStatBo.getId(), joinAgentStatBo, joinAgentStatBo.getTimestamp()));
final ApplicationCache.ApplicationKey applicationKey = new ApplicationCache.ApplicationKey(joinAgentStatBo.getId(), joinAgentStatBo.getAgentStartTimestamp());
final String applicationId = applicationCache.findApplicationId(applicationKey);
if (ApplicationCache.NOT_FOUND_APP_ID.equals(applicationId)) {
logger.warn("can't found application id. agent id : {}, start time : {}.", joinAgentStatBo.getId(), joinAgentStatBo.getTimestamp());
return EMPTY_LIST;
}
List<JoinApplicationStatBo> joinApplicationStatBoList = JoinApplicationStatBo.createJoinApplicationStatBo(applicationId, joinAgentStatBo, ApplicationStatBoWindow.WINDOW_SIZE);
for (JoinApplicationStatBo joinApplicationStatBo : joinApplicationStatBoList) {
if (joinApplicationStatBo.getTimestamp() >= time) {
logger.error("timestamp is too big !! {}", joinApplicationStatBo.toString());
return EMPTY_LIST;
}
outData.add(new Tuple3<>(applicationId, joinApplicationStatBo, joinApplicationStatBo.getTimestamp()));
}
}
return outData;
}
use of com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch in project pinpoint by naver.
the class TBaseFlatMapperTest method createTFAgentStatBatch5.
private TFAgentStatBatch createTFAgentStatBatch5() {
final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch();
tFAgentStatBatch.setStartTimestamp(1491274142454L);
tFAgentStatBatch.setAgentId(AGENT_ID);
final TFAgentStat tFAgentStat = new TFAgentStat();
tFAgentStat.setAgentId(AGENT_ID);
tFAgentStat.setTimestamp(1491274143454L);
final TFDirectBuffer tFDirectBuffer = new TFDirectBuffer();
tFDirectBuffer.setDirectCount(10);
tFDirectBuffer.setDirectMemoryUsed(20);
tFDirectBuffer.setMappedCount(30);
tFDirectBuffer.setMappedMemoryUsed(40);
tFAgentStat.setDirectBuffer(tFDirectBuffer);
final TFAgentStat tFAgentStat2 = new TFAgentStat();
tFAgentStat2.setAgentId(AGENT_ID);
tFAgentStat2.setTimestamp(1491274148454L);
final TFDirectBuffer tFDirectBuffer2 = new TFDirectBuffer();
tFDirectBuffer2.setDirectCount(50);
tFDirectBuffer2.setDirectMemoryUsed(60);
tFDirectBuffer2.setMappedCount(70);
tFDirectBuffer2.setMappedMemoryUsed(80);
tFAgentStat2.setDirectBuffer(tFDirectBuffer2);
final List<TFAgentStat> tFAgentStatList = new ArrayList<>(2);
tFAgentStatList.add(tFAgentStat);
tFAgentStatList.add(tFAgentStat2);
tFAgentStatBatch.setAgentStats(tFAgentStatList);
return tFAgentStatBatch;
}
use of com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch in project pinpoint by naver.
the class TBaseFlatMapperTest method createTFAgentStatBatch4.
private TFAgentStatBatch createTFAgentStatBatch4() {
final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch();
tFAgentStatBatch.setStartTimestamp(1491274142454L);
tFAgentStatBatch.setAgentId(AGENT_ID);
final TFAgentStat tFAgentStat = new TFAgentStat();
tFAgentStat.setAgentId(AGENT_ID);
tFAgentStat.setTimestamp(1491274143454L);
final TFFileDescriptor tFFileDescriptor = new TFFileDescriptor();
tFFileDescriptor.setOpenFileDescriptorCount(10);
tFAgentStat.setFileDescriptor(tFFileDescriptor);
final TFAgentStat tFAgentStat2 = new TFAgentStat();
tFAgentStat2.setAgentId(AGENT_ID);
tFAgentStat2.setTimestamp(1491274148454L);
final TFFileDescriptor tFFileDescriptor2 = new TFFileDescriptor();
tFFileDescriptor2.setOpenFileDescriptorCount(20);
tFAgentStat2.setFileDescriptor(tFFileDescriptor2);
final List<TFAgentStat> tFAgentStatList = new ArrayList<>(2);
tFAgentStatList.add(tFAgentStat);
tFAgentStatList.add(tFAgentStat2);
tFAgentStatBatch.setAgentStats(tFAgentStatList);
return tFAgentStatBatch;
}
Aggregations