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;
}
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);
}
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());
}
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());
}
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);
}
Aggregations