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