Search in sources :

Example 6 with JoinLoadedClassBo

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

the class JoinLoadedClassBoMapperTest method mapTest.

@Test
public void mapTest() throws Exception {
    final TFAgentStat tFAgentStat = new TFAgentStat();
    tFAgentStat.setAgentId("testAgent");
    tFAgentStat.setTimestamp(1491274138454L);
    final TFLoadedClass tfLoadedClass = new TFLoadedClass();
    tfLoadedClass.setLoadedClassCount(50);
    tfLoadedClass.setUnloadedClassCount(50);
    tFAgentStat.setLoadedClass(tfLoadedClass);
    final JoinLoadedClassBoMapper mapper = new JoinLoadedClassBoMapper();
    final JoinLoadedClassBo joinLoadedClassBo = mapper.map(tFAgentStat);
    assertNotNull(joinLoadedClassBo);
    assertEquals("testAgent", joinLoadedClassBo.getId());
    assertEquals(1491274138454L, joinLoadedClassBo.getTimestamp());
    assertEquals(new JoinLongFieldBo(50L, 50L, "testAgent", 50L, "testAgent"), joinLoadedClassBo.getLoadedClassJoinValue());
    assertEquals(new JoinLongFieldBo(50L, 50L, "testAgent", 50L, "testAgent"), joinLoadedClassBo.getUnloadedClassJoinValue());
}
Also used : TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) JoinLongFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo) JoinLoadedClassBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo) TFLoadedClass(com.navercorp.pinpoint.thrift.dto.flink.TFLoadedClass) Test(org.junit.Test)

Example 7 with JoinLoadedClassBo

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

the class JoinLoadedClassSamplerTest method sampleDataPoints.

@Test
public void sampleDataPoints() {
    JoinLoadedClassSampler joinLoadedClassSampler = new JoinLoadedClassSampler();
    List<JoinLoadedClassBo> joinLoadedClassBoList = new ArrayList<>(5);
    long timeStamp = new Date().getTime();
    joinLoadedClassBoList.add(new JoinLoadedClassBo("testApp", 11, 60, "agent1_1", 20, "agent1_2", 11, 60, "agent1_1", 20, "agent1_2", timeStamp + 5000));
    joinLoadedClassBoList.add(new JoinLoadedClassBo("testApp", 22, 52, "agent2_1", 10, "agent2_2", 22, 52, "agent2_1", 10, "agent2_2", timeStamp + 10000));
    joinLoadedClassBoList.add(new JoinLoadedClassBo("testApp", 33, 39, "agent3_1", 90, "agent3_2", 33, 39, "agent3_1", 90, "agent3_2", timeStamp + 15000));
    joinLoadedClassBoList.add(new JoinLoadedClassBo("testApp", 44, 42, "agent4_1", 25, "agent4_2", 44, 42, "agent4_1", 25, "agent4_2", timeStamp + 20000));
    joinLoadedClassBoList.add(new JoinLoadedClassBo("testApp", 55, 55, "agent5_1", 54, "agent5_2", 55, 55, "agent5_1", 54, "agent5_2", timeStamp + 25000));
    AggreJoinLoadedClassBo aggreJoinLoadedClassBo = joinLoadedClassSampler.sampleDataPoints(0, new Date().getTime(), joinLoadedClassBoList, new JoinLoadedClassBo());
    assertEquals(aggreJoinLoadedClassBo.getId(), "testApp");
    assertEquals(aggreJoinLoadedClassBo.getLoadedClassJoinValue(), new JoinLongFieldBo(33L, 10L, "agent2_2", 60L, "agent1_1"));
    assertEquals(aggreJoinLoadedClassBo.getUnloadedClassJoinValue(), new JoinLongFieldBo(33L, 10L, "agent2_2", 60L, "agent1_1"));
}
Also used : AggreJoinLoadedClassBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinLoadedClassBo) ArrayList(java.util.ArrayList) JoinLongFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo) JoinLoadedClassBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo) AggreJoinLoadedClassBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinLoadedClassBo) Date(java.util.Date) Test(org.junit.Test)

Example 8 with JoinLoadedClassBo

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

the class JoinLoadedClassSampler method sampleDataPoints.

@Override
public AggreJoinLoadedClassBo sampleDataPoints(int timeWindowIndex, long timestamp, List<JoinLoadedClassBo> joinLoadedClassBoList, JoinLoadedClassBo previousDataPoint) {
    if (CollectionUtils.isEmpty(joinLoadedClassBoList)) {
        return AggreJoinLoadedClassBo.createUncollectedObject(timestamp);
    }
    JoinLoadedClassBo joinLoadedClassBo = AggreJoinLoadedClassBo.joinLoadedClassBoList(joinLoadedClassBoList, timestamp);
    String id = joinLoadedClassBo.getId();
    JoinLongFieldBo loadedClassJoinValue = joinLoadedClassBo.getLoadedClassJoinValue();
    JoinLongFieldBo unloadedClassJoinValue = joinLoadedClassBo.getUnloadedClassJoinValue();
    AggreJoinLoadedClassBo aggreJoinLoadedClassBo = new AggreJoinLoadedClassBo(id, loadedClassJoinValue, unloadedClassJoinValue, timestamp);
    return aggreJoinLoadedClassBo;
}
Also used : AggreJoinLoadedClassBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinLoadedClassBo) JoinLongFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo) JoinLoadedClassBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo) AggreJoinLoadedClassBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinLoadedClassBo)

Example 9 with JoinLoadedClassBo

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

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

the class LoadedClassCodec 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 loadedClassEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());
    JoinLongFieldEncodingStrategy unloadedClassEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode());
    // decode values
    List<JoinLongFieldBo> loadedClassList = this.codec.decodeValues(valueBuffer, loadedClassEncodingStrategy, numValues);
    List<JoinLongFieldBo> unloadedClassList = this.codec.decodeValues(valueBuffer, unloadedClassEncodingStrategy, numValues);
    List<JoinStatBo> joinLoadedClassBoList = new ArrayList<JoinStatBo>(numValues);
    for (int i = 0; i < numValues; i++) {
        JoinLoadedClassBo joinLoadedClassBo = new JoinLoadedClassBo();
        joinLoadedClassBo.setId(id);
        joinLoadedClassBo.setTimestamp(timestamps.get(i));
        joinLoadedClassBo.setLoadedClassJoinValue(loadedClassList.get(i));
        joinLoadedClassBo.setUnloadedClassJoinValue(unloadedClassList.get(i));
        joinLoadedClassBoList.add(joinLoadedClassBo);
    }
    return joinLoadedClassBoList;
}
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) JoinLoadedClassBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo) AgentStatHeaderDecoder(com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder)

Aggregations

JoinLoadedClassBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo)10 JoinLongFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo)6 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 TFLoadedClass (com.navercorp.pinpoint.thrift.dto.flink.TFLoadedClass)2 AggreJoinLoadedClassBo (com.navercorp.pinpoint.web.vo.stat.AggreJoinLoadedClassBo)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 JoinAgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo)1 TFAgentStatBatch (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch)1 Date (java.util.Date)1