Search in sources :

Example 1 with JoinDirectBufferBo

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

the class TBaseFlatMapperTest method assertJoinDirectBufferBo.

private void assertJoinDirectBufferBo(List<JoinDirectBufferBo> joinDirectBufferBoList) {
    assertEquals(2, joinDirectBufferBoList.size());
    JoinDirectBufferBo joinDirectBufferBo = joinDirectBufferBoList.get(0);
    assertEquals(joinDirectBufferBo.getId(), AGENT_ID);
    assertEquals(joinDirectBufferBo.getTimestamp(), 1491274143454L);
    JoinLongFieldBo directCountJoinValue = joinDirectBufferBo.getDirectCountJoinValue();
    assertEquals(directCountJoinValue.getAvg(), 10, 0);
    assertEquals(directCountJoinValue.getMin(), 10, 0);
    assertEquals(directCountJoinValue.getMax(), 10, 0);
    JoinLongFieldBo directMemoryUsedJoinValue = joinDirectBufferBo.getDirectMemoryUsedJoinValue();
    assertEquals(directMemoryUsedJoinValue.getAvg(), 20, 0);
    assertEquals(directMemoryUsedJoinValue.getMin(), 20, 0);
    assertEquals(directMemoryUsedJoinValue.getMax(), 20, 0);
    JoinLongFieldBo mappedCountJoinValue = joinDirectBufferBo.getMappedCountJoinValue();
    assertEquals(mappedCountJoinValue.getAvg(), 30, 0);
    assertEquals(mappedCountJoinValue.getMin(), 30, 0);
    assertEquals(mappedCountJoinValue.getMax(), 30, 0);
    JoinLongFieldBo mappedMemoryUsedJoinValue = joinDirectBufferBo.getMappedMemoryUsedJoinValue();
    assertEquals(mappedMemoryUsedJoinValue.getAvg(), 40, 0);
    assertEquals(mappedMemoryUsedJoinValue.getMin(), 40, 0);
    assertEquals(mappedMemoryUsedJoinValue.getMax(), 40, 0);
    joinDirectBufferBo = joinDirectBufferBoList.get(1);
    assertEquals(joinDirectBufferBo.getId(), AGENT_ID);
    assertEquals(joinDirectBufferBo.getTimestamp(), 1491274148454L);
    directCountJoinValue = joinDirectBufferBo.getDirectCountJoinValue();
    assertEquals(directCountJoinValue.getAvg(), 50, 0);
    assertEquals(directCountJoinValue.getMin(), 50, 0);
    assertEquals(directCountJoinValue.getMax(), 50, 0);
    directMemoryUsedJoinValue = joinDirectBufferBo.getDirectMemoryUsedJoinValue();
    assertEquals(directMemoryUsedJoinValue.getAvg(), 60, 0);
    assertEquals(directMemoryUsedJoinValue.getMin(), 60, 0);
    assertEquals(directMemoryUsedJoinValue.getMax(), 60, 0);
    mappedCountJoinValue = joinDirectBufferBo.getMappedCountJoinValue();
    assertEquals(mappedCountJoinValue.getAvg(), 70, 0);
    assertEquals(mappedCountJoinValue.getMin(), 70, 0);
    assertEquals(mappedCountJoinValue.getMax(), 70, 0);
    mappedMemoryUsedJoinValue = joinDirectBufferBo.getMappedMemoryUsedJoinValue();
    assertEquals(mappedMemoryUsedJoinValue.getAvg(), 80, 0);
    assertEquals(mappedMemoryUsedJoinValue.getMin(), 80, 0);
    assertEquals(mappedMemoryUsedJoinValue.getMax(), 80, 0);
}
Also used : JoinDirectBufferBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo) JoinLongFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo)

Example 2 with JoinDirectBufferBo

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

the class JoinDirectBufferBoMapper method map.

@Override
public JoinDirectBufferBo map(TFAgentStat tFAgentStat) {
    if (!tFAgentStat.isSetDirectBuffer()) {
        return JoinDirectBufferBo.EMPTY_JOIN_DIRECT_BUFFER_BO;
    }
    JoinDirectBufferBo joinDirectBufferBo = new JoinDirectBufferBo();
    final String agentId = tFAgentStat.getAgentId();
    joinDirectBufferBo.setId(agentId);
    joinDirectBufferBo.setTimestamp(tFAgentStat.getTimestamp());
    TFDirectBuffer tFDirectBuffer = tFAgentStat.getDirectBuffer();
    final long directCount = tFDirectBuffer.getDirectCount();
    joinDirectBufferBo.setDirectCountJoinValue(new JoinLongFieldBo(directCount, directCount, agentId, directCount, agentId));
    final long directMemoryUsed = tFDirectBuffer.getDirectMemoryUsed();
    joinDirectBufferBo.setDirectMemoryUsedJoinValue(new JoinLongFieldBo(directMemoryUsed, directMemoryUsed, agentId, directMemoryUsed, agentId));
    final long mappedCount = tFDirectBuffer.getMappedCount();
    joinDirectBufferBo.setMappedCountJoinValue(new JoinLongFieldBo(mappedCount, mappedCount, agentId, mappedCount, agentId));
    final long mappedMemoryUsed = tFDirectBuffer.getMappedMemoryUsed();
    joinDirectBufferBo.setMappedMemoryUsedJoinValue(new JoinLongFieldBo(mappedMemoryUsed, mappedMemoryUsed, agentId, mappedMemoryUsed, agentId));
    return joinDirectBufferBo;
}
Also used : JoinDirectBufferBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo) TFDirectBuffer(com.navercorp.pinpoint.thrift.dto.flink.TFDirectBuffer) JoinLongFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo)

Example 3 with JoinDirectBufferBo

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

the class DirectBufferCodec method encodeValues.

@Override
public void encodeValues(Buffer valueBuffer, List<JoinStatBo> joinDirectBufferBoList) {
    if (CollectionUtils.isEmpty(joinDirectBufferBoList)) {
        throw new IllegalArgumentException("directBufferBoList must not be empty");
    }
    final int numValues = joinDirectBufferBoList.size();
    valueBuffer.putVInt(numValues);
    List<Long> timestamps = new ArrayList<>(numValues);
    JoinLongFieldStrategyAnalyzer.Builder directCountAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder();
    JoinLongFieldStrategyAnalyzer.Builder directMemoryUsedAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder();
    JoinLongFieldStrategyAnalyzer.Builder mappedCountAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder();
    JoinLongFieldStrategyAnalyzer.Builder mappedMemoryUsedAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder();
    for (JoinStatBo joinStatBo : joinDirectBufferBoList) {
        JoinDirectBufferBo joinDirectBufferBo = (JoinDirectBufferBo) joinStatBo;
        timestamps.add(joinDirectBufferBo.getTimestamp());
        directCountAnalyzerBuilder.addValue(joinDirectBufferBo.getDirectCountJoinValue());
        directMemoryUsedAnalyzerBuilder.addValue(joinDirectBufferBo.getDirectMemoryUsedJoinValue());
        mappedCountAnalyzerBuilder.addValue(joinDirectBufferBo.getMappedCountJoinValue());
        mappedMemoryUsedAnalyzerBuilder.addValue(joinDirectBufferBo.getMappedMemoryUsedJoinValue());
    }
    codec.encodeTimestamps(valueBuffer, timestamps);
    encodeDataPoints(valueBuffer, directCountAnalyzerBuilder.build(), directMemoryUsedAnalyzerBuilder.build(), mappedCountAnalyzerBuilder.build(), mappedMemoryUsedAnalyzerBuilder.build());
}
Also used : JoinLongFieldStrategyAnalyzer(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldStrategyAnalyzer) JoinDirectBufferBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo) ArrayList(java.util.ArrayList) JoinStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo)

Example 4 with JoinDirectBufferBo

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

the class JoinDirectBufferSampler method sampleDataPoints.

@Override
public AggreJoinDirectBufferBo sampleDataPoints(int timeWindowIndex, long timestamp, List<JoinDirectBufferBo> joinDirectBufferBoList, JoinDirectBufferBo previousDataPoint) {
    if (CollectionUtils.isEmpty(joinDirectBufferBoList)) {
        return AggreJoinDirectBufferBo.createUncollectedObject(timestamp);
    }
    JoinDirectBufferBo joinDirectBufferBo = JoinDirectBufferBo.joinDirectBufferBoList(joinDirectBufferBoList, timestamp);
    String id = joinDirectBufferBo.getId();
    final JoinLongFieldBo directCountJoinValue = joinDirectBufferBo.getDirectCountJoinValue();
    final JoinLongFieldBo directMemoryUsedJoinValue = joinDirectBufferBo.getDirectMemoryUsedJoinValue();
    final JoinLongFieldBo mappedCountJoinValue = joinDirectBufferBo.getMappedCountJoinValue();
    final JoinLongFieldBo mappedMemoryUsedJoinValue = joinDirectBufferBo.getMappedMemoryUsedJoinValue();
    AggreJoinDirectBufferBo aggreJoinDirectBufferBo = new AggreJoinDirectBufferBo(id, directCountJoinValue, directMemoryUsedJoinValue, mappedCountJoinValue, mappedMemoryUsedJoinValue, timestamp);
    return aggreJoinDirectBufferBo;
}
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) JoinLongFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo)

Example 5 with JoinDirectBufferBo

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

the class DirectBufferCodecTest method createJoinDirectBufferBoList.

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

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