Search in sources :

Example 11 with JoinAgentStatBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo 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)

Example 12 with JoinAgentStatBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo 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());
}
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)

Example 13 with JoinAgentStatBo

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

Example 14 with JoinAgentStatBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo in project pinpoint by naver.

the class JoinAgentStatBoFunction method apply.

@Override
public void apply(Tuple tuple, TimeWindow window, Iterable<Tuple3<String, JoinStatBo, Long>> values, Collector<Tuple3<String, JoinStatBo, Long>> out) throws Exception {
    JoinAgentStatBo joinAgentStatBo = join(values);
    out.collect(new Tuple3<>(joinAgentStatBo.getId(), joinAgentStatBo, joinAgentStatBo.getTimestamp()));
}
Also used : JoinAgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo)

Aggregations

JoinAgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo)14 TFAgentStatBatch (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch)12 ArrayList (java.util.ArrayList)12 Test (org.junit.Test)12 TFAgentStat (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat)8 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 Tuple3 (org.apache.flink.api.java.tuple.Tuple3)5 JoinLongFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo)4 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 JoinLoadedClassBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo)1 JoinMemoryBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo)1 JoinResponseTimeBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo)1 JoinTotalThreadCountBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo)1