Search in sources :

Example 1 with JoinLoadedClassBo

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

the class JoinLoadedClassBoMapper method map.

@Override
public JoinLoadedClassBo map(TFAgentStat thriftObject) {
    if (!thriftObject.isSetLoadedClass()) {
        return JoinLoadedClassBo.EMPTY_JOIN_LOADED_CLASS_BO;
    }
    JoinLoadedClassBo joinLoadedClassBo = new JoinLoadedClassBo();
    final String agentId = thriftObject.getAgentId();
    final long loadedClass = thriftObject.getLoadedClass().getLoadedClassCount();
    final long unloadedClass = thriftObject.getLoadedClass().getUnloadedClassCount();
    joinLoadedClassBo.setId(agentId);
    joinLoadedClassBo.setTimestamp(thriftObject.getTimestamp());
    joinLoadedClassBo.setLoadedClassJoinValue(new JoinLongFieldBo(loadedClass, loadedClass, agentId, loadedClass, agentId));
    joinLoadedClassBo.setUnloadedClassJoinValue(new JoinLongFieldBo(unloadedClass, unloadedClass, agentId, unloadedClass, agentId));
    return joinLoadedClassBo;
}
Also used : JoinLongFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo) JoinLoadedClassBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo)

Example 2 with JoinLoadedClassBo

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

the class JoinLoadedClassBoMapper method build.

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

Example 3 with JoinLoadedClassBo

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

the class LoadedClassCodec method encodeValues.

@Override
public void encodeValues(Buffer valueBuffer, List<JoinStatBo> joinStatBoList) {
    if (CollectionUtils.isEmpty(joinStatBoList)) {
        throw new IllegalArgumentException("directBufferBoList must not be empty");
    }
    final int numValues = joinStatBoList.size();
    valueBuffer.putVInt(numValues);
    List<Long> timestamps = new ArrayList<Long>(numValues);
    JoinLongFieldStrategyAnalyzer.Builder loadedClassAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder();
    JoinLongFieldStrategyAnalyzer.Builder unloadedClassAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder();
    for (JoinStatBo joinStatBo : joinStatBoList) {
        JoinLoadedClassBo joinLoadedClassBo = (JoinLoadedClassBo) joinStatBo;
        timestamps.add(joinLoadedClassBo.getTimestamp());
        loadedClassAnalyzerBuilder.addValue(joinLoadedClassBo.getLoadedClassJoinValue());
        unloadedClassAnalyzerBuilder.addValue(joinLoadedClassBo.getUnloadedClassJoinValue());
    }
    codec.encodeTimestamps(valueBuffer, timestamps);
    encodeDataPoints(valueBuffer, loadedClassAnalyzerBuilder.build(), unloadedClassAnalyzerBuilder.build());
}
Also used : JoinLongFieldStrategyAnalyzer(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldStrategyAnalyzer) 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 4 with JoinLoadedClassBo

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

the class JoinAgentStatBoMapperTest method map7Test.

@Test
public void map7Test() {
    final String agentId = "testAgent";
    final JoinAgentStatBoMapper joinAgentStatBoMapper = new JoinAgentStatBoMapper();
    final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch();
    tFAgentStatBatch.setStartTimestamp(1491274138454L);
    tFAgentStatBatch.setAgentId(agentId);
    final TFLoadedClass tfLoadedClass = new TFLoadedClass();
    tfLoadedClass.setLoadedClassCount(100);
    tfLoadedClass.setUnloadedClassCount(100);
    final TFAgentStat tFAgentStat = new TFAgentStat();
    tFAgentStat.setAgentId(agentId);
    tFAgentStat.setTimestamp(1491274148454L);
    tFAgentStat.setLoadedClass(tfLoadedClass);
    final TFLoadedClass tfLoadedClass2 = new TFLoadedClass();
    tfLoadedClass2.setLoadedClassCount(120);
    tfLoadedClass2.setUnloadedClassCount(120);
    final TFAgentStat tFAgentStat2 = new TFAgentStat();
    tFAgentStat2.setAgentId(agentId);
    tFAgentStat2.setTimestamp(1491275148454L);
    tFAgentStat2.setLoadedClass(tfLoadedClass2);
    final List<TFAgentStat> tFAgentStatList = new ArrayList<>(2);
    tFAgentStatList.add(tFAgentStat);
    tFAgentStatList.add(tFAgentStat2);
    tFAgentStatBatch.setAgentStats(tFAgentStatList);
    JoinAgentStatBo joinAgentStatBo = joinAgentStatBoMapper.map(tFAgentStatBatch);
    assertEquals(agentId, joinAgentStatBo.getId());
    assertEquals(1491274138454L, joinAgentStatBo.getAgentStartTimestamp());
    assertEquals(1491274148454L, joinAgentStatBo.getTimestamp());
    List<JoinLoadedClassBo> joinLoadedClassBoList = joinAgentStatBo.getJoinLoadedClassBoList();
    assertEquals(joinLoadedClassBoList.size(), 2);
    JoinLoadedClassBo joinLoadedClassBo = joinLoadedClassBoList.get(0);
    assertEquals(agentId, joinLoadedClassBo.getId());
    assertEquals(1491274148454L, joinLoadedClassBo.getTimestamp());
    assertEquals(new JoinLongFieldBo(100L, 100L, agentId, 100L, agentId), joinLoadedClassBo.getLoadedClassJoinValue());
    assertEquals(new JoinLongFieldBo(100L, 100L, agentId, 100L, agentId), joinLoadedClassBo.getUnloadedClassJoinValue());
    JoinLoadedClassBo joinLoadedClassBo2 = joinLoadedClassBoList.get(1);
    assertEquals(agentId, joinLoadedClassBo2.getId());
    assertEquals(1491275148454L, joinLoadedClassBo2.getTimestamp());
    assertEquals(new JoinLongFieldBo(120L, 120L, agentId, 120L, agentId), joinLoadedClassBo2.getLoadedClassJoinValue());
    assertEquals(new JoinLongFieldBo(120L, 120L, agentId, 120L, agentId), joinLoadedClassBo2.getUnloadedClassJoinValue());
}
Also used : JoinAgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo) ArrayList(java.util.ArrayList) 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) TFAgentStatBatch(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch) TFLoadedClass(com.navercorp.pinpoint.thrift.dto.flink.TFLoadedClass) Test(org.junit.Test)

Example 5 with JoinLoadedClassBo

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

the class JoinLoadedClassBoMapperTest method map2Test.

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

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