Search in sources :

Example 1 with TFAgentStatBatch

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;
}
Also used : TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) TFAgentStatBatch(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch)

Example 2 with TFAgentStatBatch

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());
}
Also used : AgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) TFAgentStatBatch(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch) Test(org.junit.Test)

Example 3 with TFAgentStatBatch

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;
}
Also used : ArrayList(java.util.ArrayList) Date(java.util.Date) TFAgentStatBatch(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch) Tuple3(org.apache.flink.api.java.tuple.Tuple3)

Example 4 with TFAgentStatBatch

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;
}
Also used : TFDirectBuffer(com.navercorp.pinpoint.thrift.dto.flink.TFDirectBuffer) ArrayList(java.util.ArrayList) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) TFAgentStatBatch(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch)

Example 5 with 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;
}
Also used : ArrayList(java.util.ArrayList) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) TFFileDescriptor(com.navercorp.pinpoint.thrift.dto.flink.TFFileDescriptor) TFAgentStatBatch(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch)

Aggregations

TFAgentStatBatch (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch)22 ArrayList (java.util.ArrayList)18 TFAgentStat (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat)14 Test (org.junit.Test)13 JoinAgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo)12 Tuple3 (org.apache.flink.api.java.tuple.Tuple3)6 JoinApplicationStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinApplicationStatBo)5 JoinStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo)5 JoinAgentStatBoMapper (com.navercorp.pinpoint.flink.mapper.thrift.stat.JoinAgentStatBoMapper)5 RawData (com.navercorp.pinpoint.flink.vo.RawData)5 ListCollector (org.apache.flink.api.common.functions.util.ListCollector)5 JoinLongFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo)4 TFCpuLoad (com.navercorp.pinpoint.thrift.dto.flink.TFCpuLoad)2 TFJvmGc (com.navercorp.pinpoint.thrift.dto.flink.TFJvmGc)2 TFTransaction (com.navercorp.pinpoint.thrift.dto.flink.TFTransaction)2 AgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo)1 JoinActiveTraceBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo)1 JoinCpuLoadBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo)1 JoinDoubleFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinDoubleFieldBo)1 JoinIntFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo)1