Search in sources :

Example 1 with JoinStatBo

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

the class FileDescriptorCodecTest method encodeAndDecodeTest.

@Test
public void encodeAndDecodeTest() {
    final String id = "test_app";
    final long currentTime = new Date().getTime();
    final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec();
    final FileDescriptorCodec fileDescriptorCodec = new FileDescriptorCodec(agentStatDataPointCodec);
    final Buffer encodedValueBuffer = new AutomaticBuffer();
    final List<JoinStatBo> joinFileDescriptorBoList = createJoinFileDescriptorBoList(currentTime);
    encodedValueBuffer.putByte(fileDescriptorCodec.getVersion());
    fileDescriptorCodec.encodeValues(encodedValueBuffer, joinFileDescriptorBoList);
    final Buffer valueBuffer = new FixedBuffer(encodedValueBuffer.getBuffer());
    ;
    final long baseTimestamp = AgentStatUtils.getBaseTimestamp(currentTime);
    final long timestampDelta = currentTime - baseTimestamp;
    final ApplicationStatDecodingContext decodingContext = new ApplicationStatDecodingContext();
    decodingContext.setApplicationId(id);
    decodingContext.setBaseTimestamp(baseTimestamp);
    decodingContext.setTimestampDelta(timestampDelta);
    assertEquals(valueBuffer.readByte(), fileDescriptorCodec.getVersion());
    List<JoinStatBo> decodedJoinFileDescriptorBoList = fileDescriptorCodec.decodeValues(valueBuffer, decodingContext);
    for (int i = 0; i < decodedJoinFileDescriptorBoList.size(); i++) {
        assertEquals(decodedJoinFileDescriptorBoList.get(i), joinFileDescriptorBoList.get(i));
    }
}
Also used : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) ApplicationStatDecodingContext(com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) JoinStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo) Date(java.util.Date) AgentStatDataPointCodec(com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec) Test(org.junit.Test)

Example 2 with JoinStatBo

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

the class MemoryCodecTest method createJoinMemoryBoList.

private List<JoinStatBo> createJoinMemoryBoList(long currentTime) {
    final String id = "test_app";
    List<JoinStatBo> joinMemoryBoList = new ArrayList<JoinStatBo>();
    JoinMemoryBo joinMemoryBo1 = new JoinMemoryBo(id, currentTime, 3000, 2000, 5000, "app_1_1", "app_1_2", 500, 50, 600, "app_1_3", "app_1_4");
    JoinMemoryBo joinMemoryBo2 = new JoinMemoryBo(id, currentTime + 5000, 4000, 1000, 7000, "app_2_1", "app_2_2", 400, 150, 600, "app_2_3", "app_2_4");
    JoinMemoryBo joinMemoryBo3 = new JoinMemoryBo(id, currentTime + 10000, 5000, 3000, 8000, "app_3_1", "app_3_2", 200, 100, 200, "app_3_3", "app_3_4");
    JoinMemoryBo joinMemoryBo4 = new JoinMemoryBo(id, currentTime + 15000, 1000, 100, 3000, "app_4_1", "app_4_2", 100, 900, 1000, "app_4_3", "app_4_4");
    JoinMemoryBo joinMemoryBo5 = new JoinMemoryBo(id, currentTime + 20000, 2000, 1000, 6000, "app_5_1", "app_5_2", 300, 100, 2900, "app_5_3", "app_5_4");
    joinMemoryBoList.add(joinMemoryBo1);
    joinMemoryBoList.add(joinMemoryBo3);
    joinMemoryBoList.add(joinMemoryBo2);
    joinMemoryBoList.add(joinMemoryBo5);
    joinMemoryBoList.add(joinMemoryBo4);
    return joinMemoryBoList;
}
Also used : JoinMemoryBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo) ArrayList(java.util.ArrayList) JoinStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo)

Example 3 with JoinStatBo

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

the class TransactionCodecTest method createJoinTransactionBoList.

private List<JoinStatBo> createJoinTransactionBoList(long currentTime) {
    final String id = "test_app";
    List<JoinStatBo> joinTransactionBoList = new ArrayList<JoinStatBo>();
    JoinTransactionBo joinTransactionBo1 = new JoinTransactionBo(id, 5000, 150, 10, "app_1_1", 230, "app_1_2", currentTime);
    JoinTransactionBo joinTransactionBo2 = new JoinTransactionBo(id, 10000, 110, 22, "app_2_1", 330, "app_2_2", currentTime + 5000);
    JoinTransactionBo joinTransactionBo3 = new JoinTransactionBo(id, 15000, 120, 24, "app_3_1", 540, "app_3_2", currentTime + 10000);
    JoinTransactionBo joinTransactionBo4 = new JoinTransactionBo(id, 20000, 130, 25, "app_4_1", 560, "app_4_2", currentTime + 15000);
    JoinTransactionBo joinTransactionBo5 = new JoinTransactionBo(id, 25000, 140, 12, "app_5_1", 260, "app_5_2", currentTime + 20000);
    joinTransactionBoList.add(joinTransactionBo1);
    joinTransactionBoList.add(joinTransactionBo2);
    joinTransactionBoList.add(joinTransactionBo3);
    joinTransactionBoList.add(joinTransactionBo4);
    joinTransactionBoList.add(joinTransactionBo5);
    return joinTransactionBoList;
}
Also used : ArrayList(java.util.ArrayList) JoinStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo) JoinTransactionBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo)

Example 4 with JoinStatBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo 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 5 with JoinStatBo

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

Aggregations

JoinStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo)47 ArrayList (java.util.ArrayList)36 Test (org.junit.Test)15 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)11 ApplicationStatDecodingContext (com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext)11 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)10 FixedBuffer (com.navercorp.pinpoint.common.buffer.FixedBuffer)10 AgentStatDataPointCodec (com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec)10 Date (java.util.Date)10 AgentStatHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder)9 BitCountingHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder)9 JoinLongFieldEncodingStrategy (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldEncodingStrategy)8 JoinLongFieldStrategyAnalyzer (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldStrategyAnalyzer)8 JoinLongFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo)8 JoinAgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo)5 JoinApplicationStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinApplicationStatBo)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 ListCollector (org.apache.flink.api.common.functions.util.ListCollector)5