Search in sources :

Example 16 with TFAgentStatBatch

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);
}
Also used : JoinAgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo) TFJvmGc(com.navercorp.pinpoint.thrift.dto.flink.TFJvmGc) JoinMemoryBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo) ArrayList(java.util.ArrayList) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) TFAgentStatBatch(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch) Test(org.junit.Test)

Example 17 with TFAgentStatBatch

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();
}
Also used : TBase(org.apache.thrift.TBase) HeaderFactory(com.navercorp.pinpoint.io.util.HeaderFactory) TypeLocatorBuilder(com.navercorp.pinpoint.io.util.TypeLocatorBuilder) TFAgentStatBatch(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch)

Example 18 with TFAgentStatBatch

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

Example 19 with 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));
}
Also used : ArrayList(java.util.ArrayList) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) TFAgentStatBatch(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch) JoinAgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo) JoinIntFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo) TFActiveTraceHistogram(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram) JoinActiveTraceBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo) TFActiveTrace(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace) Test(org.junit.Test)

Example 20 with TFAgentStatBatch

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());
}
Also used : RawData(com.navercorp.pinpoint.flink.vo.RawData) ArrayList(java.util.ArrayList) JoinStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo) JoinApplicationStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinApplicationStatBo) TFAgentStatBatch(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch) JoinAgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo) ListCollector(org.apache.flink.api.common.functions.util.ListCollector) Tuple3(org.apache.flink.api.java.tuple.Tuple3) JoinAgentStatBoMapper(com.navercorp.pinpoint.flink.mapper.thrift.stat.JoinAgentStatBoMapper) Test(org.junit.Test)

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