Search in sources :

Example 6 with JoinMemoryBo

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

the class MemoryCodec 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 heapUsedEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());
    JoinLongFieldEncodingStrategy nonHeapUsedEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());
    // decode values
    final List<JoinLongFieldBo> heapUsedList = this.codec.decodeValues(valueBuffer, heapUsedEncodingStrategy, numValues);
    final List<JoinLongFieldBo> nonHeapUsedList = this.codec.decodeValues(valueBuffer, nonHeapUsedEncodingStrategy, numValues);
    List<JoinStatBo> joinMemoryBoList = new ArrayList<>(numValues);
    for (int i = 0; i < numValues; i++) {
        JoinMemoryBo joinMemoryBo = new JoinMemoryBo();
        joinMemoryBo.setId(id);
        joinMemoryBo.setTimestamp(timestamps.get(i));
        joinMemoryBo.setHeapUsedJoinValue(heapUsedList.get(i));
        joinMemoryBo.setNonHeapUsedJoinValue(nonHeapUsedList.get(i));
        joinMemoryBoList.add(joinMemoryBo);
    }
    return joinMemoryBoList;
}
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) JoinMemoryBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo)

Example 7 with JoinMemoryBo

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

the class MemoryCodec method encodeValues.

public void encodeValues(Buffer valueBuffer, List<JoinStatBo> joinMemoryBoList) {
    if (CollectionUtils.isEmpty(joinMemoryBoList)) {
        throw new IllegalArgumentException("MemoryBoList must not be empty");
    }
    final int numValues = joinMemoryBoList.size();
    valueBuffer.putVInt(numValues);
    List<Long> timestamps = new ArrayList<>(numValues);
    JoinLongFieldStrategyAnalyzer.Builder heapUsedAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder();
    JoinLongFieldStrategyAnalyzer.Builder nonHeapUsedAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder();
    for (JoinStatBo joinStatBo : joinMemoryBoList) {
        JoinMemoryBo joinMemoryBo = (JoinMemoryBo) joinStatBo;
        timestamps.add(joinMemoryBo.getTimestamp());
        heapUsedAnalyzerBuilder.addValue(joinMemoryBo.getHeapUsedJoinValue());
        nonHeapUsedAnalyzerBuilder.addValue(joinMemoryBo.getNonHeapUsedJoinValue());
    }
    codec.encodeTimestamps(valueBuffer, timestamps);
    encodeDataPoints(valueBuffer, heapUsedAnalyzerBuilder.build(), nonHeapUsedAnalyzerBuilder.build());
}
Also used : JoinLongFieldStrategyAnalyzer(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldStrategyAnalyzer) 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 8 with JoinMemoryBo

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

the class JoinAgentStatBoMapperTest method map2Test.

@Test
public void map2Test() {
    final String agentId = "testAgent";
    final JoinAgentStatBoMapper joinAgentStatBoMapper = new JoinAgentStatBoMapper();
    final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch();
    tFAgentStatBatch.setStartTimestamp(1491274138454L);
    tFAgentStatBatch.setAgentId(agentId);
    final TFAgentStat tFAgentStat = new TFAgentStat();
    tFAgentStat.setAgentId(agentId);
    tFAgentStat.setTimestamp(1491274148454L);
    final TFJvmGc tFJvmGc = new TFJvmGc();
    tFJvmGc.setJvmMemoryHeapUsed(1000);
    tFJvmGc.setJvmMemoryNonHeapUsed(300);
    tFAgentStat.setGc(tFJvmGc);
    final TFAgentStat tFAgentStat2 = new TFAgentStat();
    tFAgentStat2.setAgentId(agentId);
    tFAgentStat2.setTimestamp(1491275148454L);
    final TFJvmGc tFJvmGc2 = new TFJvmGc();
    tFJvmGc2.setJvmMemoryHeapUsed(2000);
    tFJvmGc2.setJvmMemoryNonHeapUsed(500);
    tFAgentStat2.setGc(tFJvmGc2);
    final List<TFAgentStat> tFAgentStatList = new ArrayList<>(2);
    tFAgentStatList.add(tFAgentStat);
    tFAgentStatList.add(tFAgentStat2);
    tFAgentStatBatch.setAgentStats(tFAgentStatList);
    JoinAgentStatBo joinAgentStatBo = joinAgentStatBoMapper.map(tFAgentStatBatch);
    assertEquals(joinAgentStatBo.getId(), agentId);
    assertEquals(joinAgentStatBo.getAgentStartTimestamp(), 1491274138454L);
    assertEquals(joinAgentStatBo.getTimestamp(), 1491274148454L);
    List<JoinMemoryBo> joinMemoryBoList = joinAgentStatBo.getJoinMemoryBoList();
    assertEquals(joinMemoryBoList.size(), 2);
    JoinMemoryBo joinMemoryBo = joinMemoryBoList.get(0);
    assertEquals(joinMemoryBo.getId(), agentId);
    assertEquals(joinMemoryBo.getTimestamp(), 1491274148454L);
    assertEquals((long) joinMemoryBo.getHeapUsedJoinValue().getAvg(), 1000);
    assertEquals((long) joinMemoryBo.getNonHeapUsedJoinValue().getAvg(), 300);
    JoinMemoryBo joinMemoryBo2 = joinMemoryBoList.get(1);
    assertEquals(joinMemoryBo2.getId(), agentId);
    assertEquals(joinMemoryBo2.getTimestamp(), 1491275148454L);
    assertEquals((long) joinMemoryBo2.getHeapUsedJoinValue().getAvg(), 2000);
    assertEquals((long) joinMemoryBo2.getNonHeapUsedJoinValue().getAvg(), 500);
}
Also used : JoinAgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo) TFJvmGc(com.navercorp.pinpoint.thrift.dto.flink.TFJvmGc) JoinMemoryBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo) ArrayList(java.util.ArrayList) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) TFAgentStatBatch(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch) Test(org.junit.Test)

Example 9 with JoinMemoryBo

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

the class JoinMemorySamplerTest method sampleDataPointsTest.

@Test
public void sampleDataPointsTest() throws Exception {
    long currentTime = 1487149800000L;
    List<JoinMemoryBo> joinMemoryBoList = createJoinMemoryBoList(currentTime);
    AggreJoinMemoryBo aggreJoinMemoryBo = new JoinMemorySampler().sampleDataPoints(1, currentTime, joinMemoryBoList, JoinMemoryBo.EMPTY_JOIN_MEMORY_BO);
    assertEquals(aggreJoinMemoryBo.getId(), ID);
    assertEquals(aggreJoinMemoryBo.getTimestamp(), currentTime);
    assertEquals(aggreJoinMemoryBo.getHeapUsedJoinValue(), new JoinLongFieldBo(3000L, 100L, "app_4_1", 8000L, "app_3_2"));
    assertEquals(aggreJoinMemoryBo.getNonHeapUsedJoinValue(), new JoinLongFieldBo(300L, 50L, "app_1_3", 2900L, "app_5_4"));
}
Also used : AggreJoinMemoryBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinMemoryBo) JoinMemoryBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo) AggreJoinMemoryBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinMemoryBo) JoinLongFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo) Test(org.junit.Test)

Example 10 with JoinMemoryBo

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

the class JoinMemorySampler method sampleDataPoints.

@Override
public AggreJoinMemoryBo sampleDataPoints(int index, long timestamp, List<JoinMemoryBo> joinMemoryBoList, JoinMemoryBo previousDataPoint) {
    if (CollectionUtils.isEmpty(joinMemoryBoList)) {
        return AggreJoinMemoryBo.createUncollectedObject(timestamp);
    }
    JoinMemoryBo joinMemoryBo = JoinMemoryBo.joinMemoryBoList(joinMemoryBoList, timestamp);
    String id = joinMemoryBo.getId();
    final JoinLongFieldBo heapUsedJoinValue = joinMemoryBo.getHeapUsedJoinValue();
    final JoinLongFieldBo nonHeapUsedJoinValue = joinMemoryBo.getNonHeapUsedJoinValue();
    AggreJoinMemoryBo aggreJoinMemoryBo = new AggreJoinMemoryBo(id, timestamp, heapUsedJoinValue, nonHeapUsedJoinValue);
    return aggreJoinMemoryBo;
}
Also used : AggreJoinMemoryBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinMemoryBo) JoinMemoryBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo) AggreJoinMemoryBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinMemoryBo) JoinLongFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo)

Aggregations

JoinMemoryBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo)12 JoinLongFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo)5 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)4 JoinStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo)3 TFAgentStat (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat)3 TFJvmGc (com.navercorp.pinpoint.thrift.dto.flink.TFJvmGc)3 AggreJoinMemoryBo (com.navercorp.pinpoint.web.vo.stat.AggreJoinMemoryBo)3 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 JoinAgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo)1 TFAgentStatBatch (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch)1