Search in sources :

Example 31 with JoinStatBo

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

the class LoadedClassCountCodecTest method encodeAndDecodeTest.

@Test
public void encodeAndDecodeTest() {
    final String id = "test_app";
    final long currentTime = new Date().getTime();
    final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec();
    final LoadedClassCodec loadedClassCodec = new LoadedClassCodec(agentStatDataPointCodec);
    final Buffer encodedValueBuffer = new AutomaticBuffer();
    final List<JoinStatBo> joinLoadedClassBoList = createJoinLoadedClassCountBoList(currentTime);
    encodedValueBuffer.putByte(loadedClassCodec.getVersion());
    loadedClassCodec.encodeValues(encodedValueBuffer, joinLoadedClassBoList);
    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(), loadedClassCodec.getVersion());
    List<JoinStatBo> decodedJoinLoadedClassBoList = loadedClassCodec.decodeValues(valueBuffer, decodingContext);
    for (int i = 0; i < decodedJoinLoadedClassBoList.size(); i++) {
        assertEquals(decodedJoinLoadedClassBoList.get(i), joinLoadedClassBoList.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 32 with JoinStatBo

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

the class LoadedClassCountCodecTest method createJoinLoadedClassCountBoList.

private List<JoinStatBo> createJoinLoadedClassCountBoList(long currentTime) {
    final String id = "test_app";
    final List<JoinStatBo> joinLoadedClassBoList = new ArrayList<>();
    JoinLoadedClassBo joinLoadedClassBo1 = new JoinLoadedClassBo(id, 80, 900, "agent2_1", 20, "agent2_2", 70, 900, "agent2_1", 20, "agent2_2", currentTime);
    JoinLoadedClassBo joinLoadedClassBo2 = new JoinLoadedClassBo(id, 70, 900, "agent2_1", 20, "agent2_2", 70, 900, "agent2_1", 20, "agent2_2", currentTime + 5000);
    JoinLoadedClassBo joinLoadedClassBo3 = new JoinLoadedClassBo(id, 60, 800, "agent4_1", 15, "agent4_2", 60, 800, "agent4_1", 15, "agent4_2", currentTime + 15000);
    JoinLoadedClassBo joinLoadedClassBo4 = new JoinLoadedClassBo(id, 50, 700, "agent3_1", 10, "agent3_2", 50, 700, "agent3_1", 10, "agent3_2", currentTime + 10000);
    JoinLoadedClassBo joinLoadedClassBo5 = new JoinLoadedClassBo(id, 40, 600, "agent5_1", 5, "agent5_2", 40, 600, "agent5_1", 5, "agent5_2", currentTime + 20000);
    joinLoadedClassBoList.add(joinLoadedClassBo1);
    joinLoadedClassBoList.add(joinLoadedClassBo2);
    joinLoadedClassBoList.add(joinLoadedClassBo3);
    joinLoadedClassBoList.add(joinLoadedClassBo4);
    joinLoadedClassBoList.add(joinLoadedClassBo5);
    return joinLoadedClassBoList;
}
Also used : ArrayList(java.util.ArrayList) JoinStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo) JoinLoadedClassBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo)

Example 33 with JoinStatBo

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

the class ResponseTimeCodecTest method createJoinResponseTimeBoList.

private List<JoinStatBo> createJoinResponseTimeBoList(long currentTime) {
    final String id = "test_app";
    List<JoinStatBo> joinResponseTimeBoList = new ArrayList<>();
    JoinResponseTimeBo joinResponseTimeBo1 = new JoinResponseTimeBo(id, currentTime, 3000, 2, "app_1_1", 6000, "app_1_2");
    JoinResponseTimeBo joinResponseTimeBo2 = new JoinResponseTimeBo(id, currentTime + 5000, 4000, 200, "app_2_1", 9000, "app_2_2");
    JoinResponseTimeBo joinResponseTimeBo3 = new JoinResponseTimeBo(id, currentTime + 10000, 2000, 20, "app_3_1", 7000, "app_3_2");
    JoinResponseTimeBo joinResponseTimeBo4 = new JoinResponseTimeBo(id, currentTime + 15000, 5000, 20, "app_4_1", 8000, "app_4_2");
    JoinResponseTimeBo joinResponseTimeBo5 = new JoinResponseTimeBo(id, currentTime + 20000, 1000, 10, "app_5_1", 6600, "app_5_2");
    joinResponseTimeBoList.add(joinResponseTimeBo1);
    joinResponseTimeBoList.add(joinResponseTimeBo2);
    joinResponseTimeBoList.add(joinResponseTimeBo3);
    joinResponseTimeBoList.add(joinResponseTimeBo4);
    joinResponseTimeBoList.add(joinResponseTimeBo5);
    return joinResponseTimeBoList;
}
Also used : JoinResponseTimeBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo) ArrayList(java.util.ArrayList) JoinStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo)

Example 34 with JoinStatBo

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

the class ResponseTimeCodecTest method encodeAndDecodeTest.

@Test
public void encodeAndDecodeTest() {
    final String id = "test_app";
    final long currentTime = new Date().getTime();
    final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec();
    final ResponseTimeCodec responseTimeCodec = new ResponseTimeCodec(agentStatDataPointCodec);
    final Buffer encodedValueBuffer = new AutomaticBuffer();
    final List<JoinStatBo> joinResponseTimeBoList = createJoinResponseTimeBoList(currentTime);
    encodedValueBuffer.putByte(responseTimeCodec.getVersion());
    responseTimeCodec.encodeValues(encodedValueBuffer, joinResponseTimeBoList);
    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(), responseTimeCodec.getVersion());
    List<JoinStatBo> decodedJoinResponseTimeBoList = responseTimeCodec.decodeValues(valueBuffer, decodingContext);
    for (int i = 0; i < decodedJoinResponseTimeBoList.size(); i++) {
        assertEquals(decodedJoinResponseTimeBoList.get(i), joinResponseTimeBoList.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 35 with JoinStatBo

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

the class FileDescriptorCodecTest method createJoinFileDescriptorBoList.

private List<JoinStatBo> createJoinFileDescriptorBoList(long currentTime) {
    final String id = "test_app";
    final List<JoinStatBo> joinFileDescriptorBoList = new ArrayList<>();
    JoinFileDescriptorBo joinFileDescriptorBo1 = new JoinFileDescriptorBo(id, 80, 1000, "agent1_1", 30, "agent1_2", currentTime);
    JoinFileDescriptorBo joinFileDescriptorBo2 = new JoinFileDescriptorBo(id, 70, 900, "agent2_1", 20, "agent2_2", currentTime + 5000);
    JoinFileDescriptorBo joinFileDescriptorBo4 = new JoinFileDescriptorBo(id, 60, 800, "agent4_1", 15, "agent4_2", currentTime + 15000);
    JoinFileDescriptorBo joinFileDescriptorBo3 = new JoinFileDescriptorBo(id, 50, 700, "agent3_1", 10, "agent3_2", currentTime + 10000);
    JoinFileDescriptorBo joinFileDescriptorBo5 = new JoinFileDescriptorBo(id, 40, 600, "agent5_1", 5, "agent5_2", currentTime + 20000);
    joinFileDescriptorBoList.add(joinFileDescriptorBo1);
    joinFileDescriptorBoList.add(joinFileDescriptorBo2);
    joinFileDescriptorBoList.add(joinFileDescriptorBo3);
    joinFileDescriptorBoList.add(joinFileDescriptorBo4);
    joinFileDescriptorBoList.add(joinFileDescriptorBo5);
    return joinFileDescriptorBoList;
}
Also used : ArrayList(java.util.ArrayList) JoinStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo) JoinFileDescriptorBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo)

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