Search in sources :

Example 6 with JoinDirectBufferBo

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

the class JoinDirectBufferSamplerTest method sampleDataPoints.

@Test
public void sampleDataPoints() throws Exception {
    JoinDirectBufferSampler joinDirectBufferSampler = new JoinDirectBufferSampler();
    List<JoinDirectBufferBo> joinDirectBufferBoList = new ArrayList<>(5);
    long timeStamp = new Date().getTime();
    joinDirectBufferBoList.add(new JoinDirectBufferBo("testApp", 11, 60, "agent1_1", 20, "agent1_2", 10, 60, "agent1_3", 47, "agent1_4", 11, 61, "agent1_5", 21, "agent1_6", 10, 60, "agent1_7", 46, "agent1_8", timeStamp + 5000));
    joinDirectBufferBoList.add(new JoinDirectBufferBo("testApp", 22, 52, "agent2_1", 10, "agent2_2", 20, 70, "agent2_3", 24, "agent2_4", 22, 53, "agent2_5", 11, "agent2_6", 20, 70, "agent2_7", 23, "agent2_8", timeStamp + 10000));
    joinDirectBufferBoList.add(new JoinDirectBufferBo("testApp", 33, 39, "agent3_1", 90, "agent3_2", 30, 85, "agent3_3", 33, "agent3_4", 33, 40, "agent3_5", 91, "agent3_6", 30, 85, "agent3_7", 32, "agent3_8", timeStamp + 15000));
    joinDirectBufferBoList.add(new JoinDirectBufferBo("testApp", 44, 42, "agent4_1", 25, "agent4_2", 40, 58, "agent4_3", 56, "agent4_4", 44, 43, "agent4_5", 26, "agent4_6", 40, 58, "agent4_7", 55, "agent4_8", timeStamp + 20000));
    joinDirectBufferBoList.add(new JoinDirectBufferBo("testApp", 55, 55, "agent5_1", 54, "agent5_2", 50, 86, "agent5_3", 76, "agent5_4", 55, 56, "agent5_5", 55, "agent5_6", 50, 86, "agent5_7", 75, "agent5_8", timeStamp + 25000));
    AggreJoinDirectBufferBo aggreJoinDirectBufferBo = joinDirectBufferSampler.sampleDataPoints(0, new Date().getTime(), joinDirectBufferBoList, new JoinDirectBufferBo());
    assertEquals(aggreJoinDirectBufferBo.getId(), "testApp");
    assertEquals(aggreJoinDirectBufferBo.getDirectCountJoinValue(), new JoinLongFieldBo(33L, 10L, "agent2_2", 60L, "agent1_1"));
    assertEquals(aggreJoinDirectBufferBo.getDirectMemoryUsedJoinValue(), new JoinLongFieldBo(30L, 24L, "agent2_4", 86L, "agent5_3"));
    assertEquals(aggreJoinDirectBufferBo.getId(), "testApp");
    assertEquals(aggreJoinDirectBufferBo.getMappedCountJoinValue(), new JoinLongFieldBo(33L, 11L, "agent2_6", 61L, "agent1_5"));
    assertEquals(aggreJoinDirectBufferBo.getMappedMemoryUsedJoinValue(), new JoinLongFieldBo(30L, 23L, "agent2_8", 86L, "agent5_7"));
}
Also used : AggreJoinDirectBufferBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinDirectBufferBo) JoinDirectBufferBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo) AggreJoinDirectBufferBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinDirectBufferBo) ArrayList(java.util.ArrayList) JoinLongFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo) Date(java.util.Date) Test(org.junit.Test)

Example 7 with JoinDirectBufferBo

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

the class DirectBufferCodec method decodeValues.

@Override
public List<JoinStatBo> decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) {
    final String id = decodingContext.getApplicationId();
    final long baseTimestamp = decodingContext.getBaseTimestamp();
    final long timestampDelta = decodingContext.getTimestampDelta();
    final long initialTimestamp = baseTimestamp + timestampDelta;
    int numValues = valueBuffer.readVInt();
    List<Long> timestamps = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues);
    // decode headers
    final byte[] header = valueBuffer.readPrefixedBytes();
    AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header);
    JoinLongFieldEncodingStrategy directCountEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());
    JoinLongFieldEncodingStrategy directMemoryUsedEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());
    JoinLongFieldEncodingStrategy mappedCountEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());
    JoinLongFieldEncodingStrategy mappedMemoryUsedEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());
    // decode values
    List<JoinLongFieldBo> directCountList = this.codec.decodeValues(valueBuffer, directCountEncodingStrategy, numValues);
    List<JoinLongFieldBo> directMemoryUsedList = this.codec.decodeValues(valueBuffer, directMemoryUsedEncodingStrategy, numValues);
    List<JoinLongFieldBo> mappedCountList = this.codec.decodeValues(valueBuffer, mappedCountEncodingStrategy, numValues);
    List<JoinLongFieldBo> mappedMemoryUsedList = this.codec.decodeValues(valueBuffer, mappedMemoryUsedEncodingStrategy, numValues);
    List<JoinStatBo> joinDirectBufferBoList = new ArrayList<>(numValues);
    for (int i = 0; i < numValues; i++) {
        JoinDirectBufferBo joinDirectBufferBo = new JoinDirectBufferBo();
        joinDirectBufferBo.setId(id);
        joinDirectBufferBo.setTimestamp(timestamps.get(i));
        joinDirectBufferBo.setDirectCountJoinValue(directCountList.get(i));
        joinDirectBufferBo.setDirectMemoryUsedJoinValue(directMemoryUsedList.get(i));
        joinDirectBufferBo.setMappedCountJoinValue(mappedCountList.get(i));
        joinDirectBufferBo.setMappedMemoryUsedJoinValue(mappedMemoryUsedList.get(i));
        joinDirectBufferBoList.add(joinDirectBufferBo);
    }
    return joinDirectBufferBoList;
}
Also used : BitCountingHeaderDecoder(com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder) ArrayList(java.util.ArrayList) JoinStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo) JoinLongFieldEncodingStrategy(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldEncodingStrategy) JoinLongFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo) AgentStatHeaderDecoder(com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder) JoinDirectBufferBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo)

Example 8 with JoinDirectBufferBo

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

the class JoinDirectBufferBoMapperTest method mapTest.

@Test
public void mapTest() throws Exception {
    final TFAgentStat tFAgentStat = new TFAgentStat();
    tFAgentStat.setAgentId("testAgent");
    tFAgentStat.setTimestamp(1491274138454L);
    final TFDirectBuffer tfDirectBuffer = new TFDirectBuffer();
    tfDirectBuffer.setDirectCount(10);
    tfDirectBuffer.setDirectMemoryUsed(11);
    tfDirectBuffer.setMappedCount(12);
    tfDirectBuffer.setMappedMemoryUsed(13);
    tFAgentStat.setDirectBuffer(tfDirectBuffer);
    final JoinDirectBufferBoMapper mapper = new JoinDirectBufferBoMapper();
    final JoinDirectBufferBo joinDirectBufferBo = mapper.map(tFAgentStat);
    assertNotNull(joinDirectBufferBo);
    assertEquals(joinDirectBufferBo.getId(), "testAgent");
    assertEquals(joinDirectBufferBo.getTimestamp(), 1491274138454L);
    final JoinLongFieldBo directCountJoinValue = joinDirectBufferBo.getDirectCountJoinValue();
    assertEquals(directCountJoinValue.getAvg(), 10, 0);
    assertEquals(directCountJoinValue.getMin(), 10, 0);
    assertEquals(directCountJoinValue.getMax(), 10, 0);
    final JoinLongFieldBo directMemoryUsedJoinValue = joinDirectBufferBo.getDirectMemoryUsedJoinValue();
    assertEquals(directMemoryUsedJoinValue.getAvg(), 11, 0);
    assertEquals(directMemoryUsedJoinValue.getMin(), 11, 0);
    assertEquals(directMemoryUsedJoinValue.getMax(), 11, 0);
    final JoinLongFieldBo mappedCountJoinValue = joinDirectBufferBo.getMappedCountJoinValue();
    assertEquals(mappedCountJoinValue.getAvg(), 12, 0);
    assertEquals(mappedCountJoinValue.getMin(), 12, 0);
    assertEquals(mappedCountJoinValue.getMax(), 12, 0);
    final JoinLongFieldBo mappedMemoryUsedJoinValue = joinDirectBufferBo.getMappedMemoryUsedJoinValue();
    assertEquals(mappedMemoryUsedJoinValue.getAvg(), 13, 0);
    assertEquals(mappedMemoryUsedJoinValue.getMin(), 13, 0);
    assertEquals(mappedMemoryUsedJoinValue.getMax(), 13, 0);
}
Also used : JoinDirectBufferBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo) TFDirectBuffer(com.navercorp.pinpoint.thrift.dto.flink.TFDirectBuffer) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) JoinLongFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo) Test(org.junit.Test)

Example 9 with JoinDirectBufferBo

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

the class JoinDirectBufferBoMapperTest method map2Test.

@Test
public void map2Test() {
    final TFAgentStat tFAgentStat = new TFAgentStat();
    tFAgentStat.setAgentId("testAgent");
    tFAgentStat.setTimestamp(1491274138454L);
    final JoinDirectBufferBoMapper mapper = new JoinDirectBufferBoMapper();
    final JoinDirectBufferBo joinDirectBufferBo = mapper.map(tFAgentStat);
    assertEquals(joinDirectBufferBo, joinDirectBufferBo.EMPTY_JOIN_DIRECT_BUFFER_BO);
}
Also used : JoinDirectBufferBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) Test(org.junit.Test)

Example 10 with JoinDirectBufferBo

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

the class JoinDirectBufferBoMapper method build.

@Override
public void build(TFAgentStat tFAgentStat, JoinAgentStatBo.Builder builder) {
    JoinDirectBufferBo joinDirectBufferBo = this.map(tFAgentStat);
    if (joinDirectBufferBo == JoinDirectBufferBo.EMPTY_JOIN_DIRECT_BUFFER_BO) {
        return;
    }
    builder.addDirectBuffer(joinDirectBufferBo);
}
Also used : JoinDirectBufferBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo)

Aggregations

JoinDirectBufferBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo)10 JoinLongFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo)6 ArrayList (java.util.ArrayList)4 JoinStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo)3 Test (org.junit.Test)3 TFAgentStat (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat)2 TFDirectBuffer (com.navercorp.pinpoint.thrift.dto.flink.TFDirectBuffer)2 AggreJoinDirectBufferBo (com.navercorp.pinpoint.web.vo.stat.AggreJoinDirectBufferBo)2 AgentStatHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder)1 BitCountingHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder)1 JoinLongFieldEncodingStrategy (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldEncodingStrategy)1 JoinLongFieldStrategyAnalyzer (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldStrategyAnalyzer)1 Date (java.util.Date)1