Search in sources :

Example 1 with ListCollector

use of org.apache.flink.api.common.functions.util.ListCollector in project pinpoint by naver.

the class TBaseFlatMapperTest method flatMap5Test.

@Test
public void flatMap5Test() throws Exception {
    ApplicationCache applicationCache = newMockApplicationCache();
    TBaseFlatMapper mapper = new TBaseFlatMapper(new JoinAgentStatBoMapper(), applicationCache, new DefaultTBaseFlatMapperInterceptor());
    TFAgentStatBatch tfAgentStatBatch = createTFAgentStatBatch5();
    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);
    assertJoinDirectBufferBo(joinAgentStatBo.getJoinDirectBufferBoList());
    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);
    assertJoinDirectBufferBo(joinApplicationStatBo.getJoinDirectBufferBoList());
}
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 2 with ListCollector

use of org.apache.flink.api.common.functions.util.ListCollector in project pinpoint by naver.

the class TBaseFlatMapperTest method flatMap4Test.

@Test
public void flatMap4Test() throws Exception {
    ApplicationCache applicationCache = newMockApplicationCache();
    TBaseFlatMapper mapper = new TBaseFlatMapper(new JoinAgentStatBoMapper(), applicationCache, new DefaultTBaseFlatMapperInterceptor());
    TFAgentStatBatch tfAgentStatBatch = createTFAgentStatBatch4();
    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);
    assertJoinFileDescriptorBo(joinAgentStatBo.getJoinFileDescriptorBoList());
    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);
    assertJoinFileDescriptorBo(joinApplicationStatBo.getJoinFileDescriptorBoList());
}
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 3 with ListCollector

use of org.apache.flink.api.common.functions.util.ListCollector in project pinpoint by naver.

the class TBaseFlatMapperTest method flatMap3Test.

@Test
public void flatMap3Test() throws Exception {
    ApplicationCache applicationCache = newMockApplicationCache();
    TBaseFlatMapper mapper = new TBaseFlatMapper(new JoinAgentStatBoMapper(), applicationCache, new DefaultTBaseFlatMapperInterceptor());
    TFAgentStatBatch tfAgentStatBatch = createTFAgentStatBatch3();
    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);
    assertJoinTransactionBo(joinAgentStatBo.getJoinTransactionBoList());
    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);
    assertJoinTransactionBo(joinApplicationStatBo.getJoinTransactionBoList());
}
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 4 with ListCollector

use of org.apache.flink.api.common.functions.util.ListCollector 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 5 with ListCollector

use of org.apache.flink.api.common.functions.util.ListCollector 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)

Aggregations

ArrayList (java.util.ArrayList)6 ListCollector (org.apache.flink.api.common.functions.util.ListCollector)6 JoinAgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo)5 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 TFAgentStatBatch (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch)5 Tuple3 (org.apache.flink.api.java.tuple.Tuple3)5 Test (org.junit.Test)5 Tuple4 (org.apache.flink.api.java.tuple.Tuple4)1 SimpleTupleJoinFunction (org.apache.flink.runtime.operators.testutils.SimpleTupleJoinFunction)1